Skip to content

Instantly share code, notes, and snippets.

View tusharbabbar's full-sized avatar

tushar babbar tusharbabbar

View GitHub Profile
@tusharbabbar
tusharbabbar / retries.py
Last active January 29, 2018 08:54
Configurable retry wrapper in Python
import traceback
from functools import wraps
def retry(retries=5, quantum_backoff=5, exception=Exception):
def real_retry(func):
@wraps(func)
def wrapper(*args, **kwargs):
tries = 0
exc = None
while tries <= retries:
@tusharbabbar
tusharbabbar / AngularDevEnvUbuntu.md
Last active January 23, 2023 23:45
Setting up AngularJS dev env for Ubuntu
@tusharbabbar
tusharbabbar / flaskDeployment.md
Last active August 29, 2015 14:22
Flask with uWSGI behind Nginx

The Flask App -- app.py

from flask import Flask

app = Flask(__name__)

@app.route('/', methods=['GET'])
def hello():
  return 'HELLO WORLD'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install -y mongodb-org
#!/bin/bash
sudo pip install virtualenv
sudo pip install virtualenvwrapper
export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.sh
@tusharbabbar
tusharbabbar / gmailer.py
Last active August 29, 2015 14:04
A simple mailer for geeks who don't like to leave their terminal. P.S. Can send attachments from terminal.
import smtplib, os
from email import Encoders
from email.Utils import COMMASPACE, formatdate
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email.MIMEMultipart import MIMEMultipart
import argparse
import sys
#INFO