Monthly Archives: October 2010

Nginx modules for a memcached page cache cluster

Nginx already has a neat module included with it to proxy requests to a memcached server (memcached_pass). Combine that with the upstream round robin load balancer, you have the beginnings of a memcached page cache cluster for your nginx. However, calling each server sequentially can become quite expensive if the key resides in one of the last servers.

Continue reading

Introducing myvault

I wanted someway from a Unix shell to edit an encrypted file that would store some semi-sensitive information. Google failed to bring me any acceptable candidates. So I decided to dive into the world of shell scripting and came up with something I’m going to call myvault.

It uses OpenSSL to generate a random 32 character password, which it then uses to symmetrically encrypt the file. The password is then asymmetrically encrypted using an RSA key. A new random 32 character password is generated every time it is run.

By default, it uses your SSH key to open a file called “.myvault” in your $HOME directory using Vim. You can pass it arguments to use a different encrypted file and/or private/public key(s). You can even encrypt/decrypt any file which it then spits to STDOUT for your use.

Now I’m no shell scripting genius nor a complete beginner. So I may have done things inefficiently or down right wrong. Please leave feedback for improvements or changes.

Check it out here:

Reset file’s modification time to their birth time

NOTE:This only works for FreeBSD.

This will change the modification time (ls -l) of the current directory and all files and directories under it back to their “birth time” (creation time). If you want to limit this use man find to figure out the proper arguments.

find . -exec sh -c 'touch -t $(date -r $(stat -f %B {}) "+%Y%m%d%H%M.%S") {}' \;