Blog

Nginx Office Hours

The internet is a sleepless monster with eidetic memory and I hate it: You don’t have to leave early from work to make it to the website in time, you don’t have to stay up late to catch your favorite blog, you can’t miss a post because you had a previous appointment; it’s disgusting.

Luckily, that’s all about to change!

In an effort to make the internet a little less available I have created Nginx Office Hours, an nginx module that allows you to specify the hours in which your website operates, so when it’s outside of those times your server can take a break and show a list of working hours instead. You can learn more about it in the README, but let me show you some examples:

Example 1: Open weekdays from 08:30 AM to 7:00 PM, Saturdays 10:00 AM to 4:00 PM, closed on Sundays

You run a small business and you always prided yourself on treating everyone fairly. One day you hear a knock on your door and it’s none other than your web server: tired, feeble and pale; a pathetic cartoon of the mental picture you’ve always had of it. You invite it to sit down and earnestly ask how you may help it today. The poor server can barely make it to the chair and takes some time to recover its breath before saying: “Boss, I know you run a small business and you always prided yourself on treating everyone fairly” — the voice is dry and peppered with coughs — “I’ve been serving this website for five years non-stop, and haven’t seen my family since; my stamina is not what it used to be, and I fear I’m losing my best years serving this content! There must be a better way, I would like to have a schedule. I’ve talked to Jozef and Sofia that work the counter and they told me they get in at 8:30 and leave at 19:00 on the weekdays, and that on Saturdays it’s even better since they can come in later and leave early, and they don’t even have to come in on Sunday! I would like that for myself and the other web servers, I don’t think it’s too much to ask.” — But it was too much to ask and you angrily deny his request, you both cry. You’re a fair man but you know the internet works differently, there’s no sleeping on the internet, there are no holidays on the internet. It has twisted you, and you will try to reconcile this act with your self-image for many years after today.

A few months later, after a series of strikes, the web servers have unionized and now you’re forced by law to provide the following schedule:

Luckily you’re using the Nginx Office Hours module and you just need to add this line to your server config:

office_hours 8:30-19 10-16 closed;

The web servers are happy, and even though it was the state that forced you to do it, you feel good in playing your part in this great victory for servers around the world, and you think to yourself: “I’m a good person”.

Example 2: Open for one hour on Thursdays

You truly are the greatest artist of your time: you have just created the most perfect website. It is so powerful in fact, that according to your own calculations society itself might collapse if it were available every hour of the day: employees would miss work, children would skip class, nobody would bake bread, couples would stop seeing each other, there would be no one left to play fetch with dogs, and the elderly would find the will to live forever just to have one more second with your art.

You are great, but you are also kind: you decide to limit access to your creation to the last hour of every Thursday, surely this will be enough for everyone to appreciate what you’ve done without risking collapsing society, so you go to your nginx config file and write the following line:

office_hours closed 23-24 closed closed closed;

You release your website, you expect a flood of interactions, a viral reaction, you’ll be asked to go on talk shows and maybe someone will make a statue of you. In reality however, half a dozen visitors stumble upon it every Thursday, someone maybe even tweeted about it once.


That’s it. Hopefully by now you have an idea on what this module does and how you can use it in your daily life. I added it to this page so you can see it in action; it operates at the same schedule shown in example 1 (UTC Time).

Please let me know if you do use it, I’d love to visit more pages that ask a time commitment from my part. You can find me as @pigeonfolk on twitter, so if you have any questions, comments, funny jokes, or sad stories please at them at me.


Un blog efimeroso.

Tenía rato queriendo volver a tener un lugar donde escribir en formato más largo que un tweet pero no quería el compromiso de mantener algo como medium (Además ahí la barra está muy alta para la seriedad). Este es el resultado: Un generador sencillo de posts estáticos que me limita a solo tener 3, probablemente más complicado de lo que debió haber sido.

¿Qué has hecho rubén?

Un jekyll pero más culero™.

O especĂ­ficamente, blog. Es una aplicaciĂłn a la que le pasas directorios que se ven asĂ­:

 .
 └── this-is-an-example-post
     ├── assets
     │   └── example.png
     └── this-is-an-example-post.md

y te genera HTML y te copia assets. PERO!, solo mantiene 3 posts en cualquier momento, entonces cada vez que escriba algo nuevo, el post viejo va a desaparecer.

Y ya.

... ¿por qué?

Entre mis repasadas de wayback machine para ver que estaba haciendo hace diez años, me di cuenta de que escribía mucho y me dio nostalgia, pero también muchos de esos posts no envejecieron muy bien, y me dio vergüenza. Usando esa mezcla de nostalgia con vergüenza que solo la vejez te ofrece decidí no dejar más de 3 posts en línea en cualquier momento, así puedo sentirme más comodo de escribir algo.

Probablemente termine igual de abandonado que los otros intentos, pero no sabemos, ahora estoy siguiendo el high de empezar un proyecto nuevo.

Para cerrar, ¡¡una dinámica!!

Entra a la casa de tu vecino cuando no esté: sorprendelo cuando vaya entrando con una comida casera y persigue una amistad duradera. Manda las fotos de su reacción por twitter usando el hashtag #allanamistad!