I have often regretted my speech, never my silence. -- Publilius Syrus
Category Archives: Personal
The Perfect Programmer
"No program is perfect," They said with a shrug. "The customer's happy-- What's one little bug?" But he was determined, Then change two, then three more, The others went home. As year followed year. He dug out the flow chart And strangers would comment, Deserted, alone. "Is that guy still here?" Night passed into morning. He died at the console The room was cluttered Of hunger and thirst With core dumps, source listings. Next day he was buried "I'm close," he muttered. Face down, nine edge first. Chain smoking, cold coffee, And his wife through her tears Logic, deduction. Accepted his fate. "I've got it!" he cried, Said "He's not really gone, "Just change one instruction." He's just working late." -- The Perfect Programmer
Funny People
Recursively checking out ports tree
I’ve come across a problem posted on #bsdports
channel few days ago, how to download a port (FreeBSD) and its dependencies without checking out complete ports tree. So, I hacked a solution for this in Haskell to celebrate my recently attained bliss moment:
Ξ» ghci GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> :load download-portstree.hs [1 of 1] Compiling Main ( download-portstree.hs, interpreted ) Ok, modules loaded: Main. *Main> downloadPortsTree "editors/emacs-nox11" Loading package transformers-0.3.0.0 ... linking ... done. Loading package mtl-2.1.2 ... linking ... done. Loading package array-0.4.0.1 ... linking ... done. Loading package deepseq-1.3.0.1 ... linking ... done. Loading package containers-0.5.0.0 ... linking ... done. Loading package bytestring-0.10.0.2 ... linking ... done. Loading package old-locale-1.0.0.5 ... linking ... done. Loading package time-1.4.0.1 ... linking ... done. Loading package unix-2.6.0.1 ... linking ... done. Loading package filepath-1.3.0.1 ... linking ... done. Loading package directory-1.2.0.1 ... linking ... done. Loading package process-1.1.0.2 ... linking ... done. PortsList {portsSeen = fromList ["converters/libiconv","devel/gettext","devel/gmake","devel/libffi","devel/ncurses","devel/pkgconf","editors/emacs-nox11","lang/perl5.16","math/gmp","print/indexinfo","security/ca_root_nss","security/gnutls","security/libgpg-error","security/libtasn1","security/nettle","security/openssl","security/p11-kit","textproc/libxml2"], portsNew = fromList []} Checking out port editors/emacs-nox11 Checking out port devel/gmake Checking out port converters/libiconv Checking out port devel/gettext Checking out port devel/ncurses Checking out port devel/pkgconf Checking out port print/indexinfo Checking out port security/gnutls Checking out port lang/perl5.16 Checking out port security/libgpg-error Checking out port security/libtasn1 Checking out port security/nettle Checking out port math/gmp Checking out port security/openssl Checking out port security/p11-kit Checking out port devel/libffi Checking out port security/ca_root_nss Checking out port textproc/libxml2
Happy hacking lambdas… π
Small key
βStrength doesn't open big iron doors but a small key does.β (Superman, "A Man Who Was Superman")
Free
βA man can be himself so long as he is alone. If he does not love solitude, he will not love freedom; for it is only when is alone that he is really free.β (Arthur Schopenhauer)
Victory
So, again we are defeated. This victory belongs to the farmers, not us. (Kambei Shimada, "Seven Samurai")
Duplicity
Recently I needed to do some backups on a host (not managed by me), and being somewhat paranoid, and lazy, I didn’t schedule backups for sometime. Recently while trying to be just paranoid, I decided it’s finally time to close this task pending for a while, so gave a shot to duplicity again. Its manpage is quite well written, and so is the software.
My backup provider offers SFTP space (courtesy: ProFTPD, I think). So to login to SFTP account, I created a SSH public key to be used by backup script, and converted it into RFC4716 format (ssh-keygen -e
), and uploaded to remote host. For encrypting backups, I used GPG, so generated a GPG key locally, and copied the public key to the host which is to be backed up. Since decryption of backups is not needed, unless it’s to be restored therefore I don’t need to copy private GPG key on remote host.
Now with a duplicity
command-lines similar to below, I was able to do full, and incremental backups respectively:
duplicity full --encrypt-key ${GPG_KEY} --log-file=${LOG_FILE} ${SOURCE_DIRECTORY_TO_BACKUP} scp://${BACKUP_USER}@${BACKUP_HOST}/${BACKUP_DIRECTORY}
duplicity incremental --encrypt-key ${GPG_KEY} --log-file=${LOG_FILE} ${SOURCE_DIRECTORY_TO_BACKUP} scp://${BACKUP_USER}@${BACKUP_HOST}/${BACKUP_DIRECTORY}
And to periodically clean old backups:
duplicity remove-all-but-n-full --force --log-file=${LOG_FILE} ${NUMBER_OF_OLD_BACKUPS_TO_KEEP} scp://${BACKUP_USER}@${BACKUP_HOST}/${BACKUP_DIRECTORY}
That’s it. Put these things in a script in a cron job scheduled at appropriate times, I can now do encrypted backups. As an anonymous guy puts it:
It’s better to have dump-ed, and restored, than to never have dumped at all
Now go backup yourself!
γ²γγγͺ
Purpose of life
It’s possible that the whole purpose of your life is to serve as a warning to others.