Skip to content

Instantly share code, notes, and snippets.

View asimihsan's full-sized avatar

Asim Ihsan asimihsan

View GitHub Profile
@asimihsan
asimihsan / gist:2266588
Created March 31, 2012 16:35
python retry decorator
import pymongo.errors
# Retry decorator with exponential backoff
def retry(tries=5, delay=0.1, backoff=2):
"""Retries a function or method until it returns True.
delay sets the initial delay in seconds, and backoff sets the factor by which
the delay should lengthen after each failure. backoff must be greater than 1,
or else it isn't really a backoff. tries must be at least 0, and delay
greater than 0.
@asimihsan
asimihsan / .vimrc
Created January 9, 2012 10:53
My .vimrc (#1)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer: amix the lucky stiff
" http://amix.dk - [email protected]
"
" Version: 3.6 - 25/08/10 14:40:30
"
" Blog_post:
" http://amix.dk/blog/post/19486#The-ultimate-vim-configuration-vimrc
" Syntax_highlighted:
" http://amix.dk/vim/vimrc.html
@asimihsan
asimihsan / google-reader-subscriptions.xml
Created May 13, 2011 08:59
Google Reader Subscriptions
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Asymptote subscriptions in Google Reader</title>
</head>
<body>
<outline text="24in60.com" title="24in60.com" type="rss"
xmlUrl="http://www.24in60.com/feed" htmlUrl="http://www.24in60.com"/>
<outline title="android" text="android">
<outline text="Android Developers Blog"
@asimihsan
asimihsan / gist:938983
Created April 23, 2011 21:12
Erlang on AWS - part 3
We couldn’t find that file to show.
@asimihsan
asimihsan / haproxyd
Created April 20, 2011 12:06
/etc/init.d/haproxyd
#!/usr/bin/env bash
# haproxyd
# Script to start|stop|restart haproxy from /etc/init.d/
# By Gubatron.
HAPROXY_CONFIG_PATH=/home/ubuntu/canvas/src/loadbalancer/haproxy.conf
HAPROXY_DAEMON=/usr/local/sbin/haproxy
test -x $HAPROXY_DAEMON || exit 0
# file: /home/ubuntu/.aws_keys
export AWS_ACCESS_KEY_ID=XXXXXXXXX
export AWS_ACCOUNT_ID=1111111111
export AWS_SECRET_ACCESS_KEY=fFjerT235Fj
# subsequently modify /home/ubuntu/.bash_profile and "dot this in" by using:
# . /home/ubuntu/.aws_keys