Flickr.com down


beepbeep:~ zen$ date
Tue Oct 20 19:34:42 CEST 2009
beepbeep:~ zen$ host www.flickr.com
www.flickr.com is an alias for www.flickr.vip.mud.yahoo.com.
www.flickr.vip.mud.yahoo.com has address 68.142.214.24
www.flickr.vip.mud.yahoo.com mail is handled by 0 .
beepbeep:~ zen$ telnet www.flickr.com 80
Trying 68.142.214.24...
telnet: connect to address 68.142.214.24: Connection refused
telnet: Unable to connect to remote host

weird.
The very same www.flickr.vip.mud.yahoo.com handles api.flickr.com (which is, unsurprisingly, down).
Doesn’t look smart from here.

Verbosely emptying the trash

Like it happens on Windows, when you decide to delete something OSX simply moves that file or directory to “the Trash”, which is just a hidden directory on the volume you’re deleting from. Then, you right click on the Trash icon and select “Empty trash”.
This action pops up a small window like this:

osx trash progress window

I grew tired of asking myself what OSX was deleting (the operation can take a while, especially when — as I often do — you’re doing a secure erase) so this ugly one-liner, run as root, will give you the file the OS is working on:


ps auxw | grep -i locum | grep -v grep | awk '{print $2}' | xargs lsof -p | grep -i Trash | awk '{print $9}'

It will output something like this:
/Volumes/FAT80GB/.Trashes/502/xcode3210a432.dmg

You can wrap that command inside the usual while/sleep loop if you want something that keeps you updated on what is going on — or make it an alias for your favourite shell.

Snow Leopard, ssh-agent and an everlasting memory

If you recently switched from an older (pre 10.6) version of OS X to the latest baby, and have the old habit of using ssh to connect around, you may have noticed a singular behaviour: while the older versions always asked you for a passphrase (you have a passphrase set on your private key, right?) the new OS 10.6.x does it just the first time you use it.

Now, no doubt it is handy and user-friendly and automagical and… but I feel it disturbing: if by chance I hand over the laptop to somebody for a quick glance at a web page, for example, she can use it to connect anywhere without my consent — ok, I’m oversimplifying, but you get the idea.

The mistery lies into our old friend ssh-agent: it is spawn using
/System/Library/LaunchAgents/org.openbsd.ssh-agent.plist
[on a single line for yout copying pleasure] as a configuration file and it will cache your passphrase the first time you use ssh.
Up to here it’s fine.

What is troublesome to me is that the default cache time is unlimited (see the man page, this is the default behaviour when it is launched without specifying a “-t” option) therefore it will never forget the passphrase until I logout — being the only user of my laptop, this does not happen often.

Enter the joy of xml configuration files: edit the org.openbsd.ssh-agent.plist, and add the option to your liking, that is change this

<array>
<string>/usr/bin/ssh-agent</string>
<string>-l</string>
</array>

to something like this

<array>
<string>/usr/bin/ssh-agent</string>
<string>-l</string>
<string>-t</string>
<string>120</string>
</array>

if a couple of minutes of “grace period” suit your usage.
Then, just kill the process — it will spawn again the next time you use ssh.

[By the way:
Dear Internet, posting code like the XML up here sucks big time.
It took me more time to format the two snippets to render correctly then writing the whole post.
What do you use to ease this pain?
thank you.]

Bump alla v2.5! Yeah.

Ieri sera ho deciso che era ora di portare a 2.5 la “versione” di questo blog su cui scrivo sempre piu` di rado.
Non temete: queste pagine continuano ad esser servite da vigorosi 167Mhz di CPU e 192Mb di ram, ma ho fatto oggi il “porting” da un eccellente webserver leggero (lighttpd) che pero` mi dava alcuni problemi ad nginx.

Avevo sempre avuto la curiosita` di provare nginx, ma l’ultima volta che ci avevo guardato era ricco di documentazione, in una sola lingua, e non quella che speravo: il russo. :-)

Invece dopo aver dato un’occhiata al wiki di documentazione, oggi ci ho provato.
E` stata una migrazione pressoche` indolore, a parte un fastidioso problema (mio) all’interno di una stanza di configurazione (sua). Una volta capito il perche` alcune cose non funzionavano come mi aspettavo (dopo che mettere l’access.log a livello di debug, aver ricompilato l’eseguibile con --with-debug, e — alla soglia della disperazione — essermi attaccato con ktrace all’eseguibile).

Rispetto a “lighty” la complessita` del file di configurazione e` forse di poco minore, come l’occupazione di memoria. Le performance sono per entrambi indiscutibili, nei prossimi mesi vedremo se quello che mi ha spinto a provare altro rispetto a lighty funziona meglio.
Da sottolineare che rispetto a lighty (singolo processo, singolo thread e I/O non bloccante con poll/epoll/kqueue/…), nginx e` piu` “alla Apache”, con un processo master e un numero configurabile di figli.
Apprezzabile, dal mio punto di vista, che nginx di default tenda ad installarsi in una directory di /usr/local dentro cui mette tutto (log, configurazione, file html): dal mio punto di vista questo permette di mantenere piu` pulito il filesystem.
Se siete interessati, qui c’e` un documento che spiega come configurarlo con particolare attenzione alla sicurezza.

Una curiosita`: lighttpd e` un progetto figlio di Dan Kegel, autore dell’interessante documento (nonostante sia del 2006) “The C10K problem” — problema che anche nginx afferma esplicitamente di risolvere. :-)