Instantly share code, notes, and snippets.

import boto3
import sys
import Queue
import threading
work_queue = Queue.Queue()
sqs = boto3.resource('sqs')
from_q_name = sys.argv[1]
View TestHarnessHTTPServer.groovy
import java.util.concurrent.CompletableFuture
import java.util.concurrent.TimeUnit
import java.util.concurrent.CancellationException
import java.util.concurrent.TimeoutException
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
import argparse