View sum-of-squares.clj
(defn sum [coll]
(apply + coll))
(defn squares [coll]
(map #(* % %) coll))
(def first-n take)
(defn integers []
(iterate inc 1))
View fizzbuzz
#!/bin/bash -e
#set -o xtrace
if [[ $# -lt 1 ]]; then
echo '
Usage: fizzbuzz upto
upto: The number upto which to count

As posted on Facebook; and subsequently deleted

As an American and a self confessed Indophile, I had a lot of insights I gleaned while traversing the length and breadth of the country. Incidentally I take care of funded projects and this exposes me to a interactions with the poor and ultra poor of the country. Hopefully I will debunk a few myths about India, which my North American colleagues should know, along with some Indians who will hopefully read this post:

  1. Like it or leave it, the hinterland of India is firmly behind Modi. They don't give a rat's ass if you call them his followers, or "bakts" as I have heard. For the first time they have a leader and a party that has gone through almost 3 years without a single financial scam against their name. For a country used to spectacular monetary frauds and a silent PM who took plausible deniability to laughable proportions, this is a great and welcome change
  2. Muslim don't hate Modi. Educated intelligent non Muslims (read Hindus) hate him more! Simply
View download.html
<form method="GET" action="/file" target="_blank">
<input name="filename" type="text" />
<input name="submit" type="submit" />
from __future__ import print_function
from itertools import ifilter
import re
def snake_case(string):
return re.sub('[A-Z]+', lambda m: '_' +, string).lstrip('_')
View fix-multi
#!/bin/sed -nrf
s_,,,,_,"","","",_g # first we substitute blank fields with quoted blanks for consistency
s_,,,_,"","",_g # first we substitute blank fields with quoted blanks for consistency
s_,,_,"",_g # first we substitute blank fields with quoted blanks for consistency
s_,$_,""_ # then we handle similar blank trailing fields
/^([^"]|",|"")/ { # if the line does not start with " (incomplete line)
x # first swap the previous line [see (*)] into pattern space and this incomplete line into hold space
G # add the above held incomplete like to the pattern separated by \n
export PGPASSWORD='password'
echo ''
date '+%F %T'
for HOST in www.{foo,bar}.com; do
from __future__ import print_function
import sys
import threading
import Queue
STOP = object()
vault mount-tune -default-lease-ttl=1800s -max-lease-ttl=1800s auth/ldap
View swap-ctrl-caps.reg
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3a,00,1d,00,1d,00,3a,00,00,00,00,00