Skip to content

Instantly share code, notes, and snippets.

tushar babbar tusharbabbar

Block or report user

Report or block tusharbabbar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tusharbabbar
tusharbabbar / retries.py
Last active Jan 29, 2018
Configurable retry wrapper in Python
View retries.py
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 Apr 25, 2018
Setting up AngularJS dev env for Ubuntu
View AngularDevEnvUbuntu.md
@tusharbabbar
tusharbabbar / flaskDeployment.md
Last active Aug 29, 2015
Flask with uWSGI behind Nginx
View flaskDeployment.md

The Flask App -- app.py

from flask import Flask

app = Flask(__name__)

@app.route('/', methods=['GET'])
def hello():
  return 'HELLO WORLD'
View mongo_setup
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
View venv_setup
#!/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 Aug 29, 2015
A simple mailer for geeks who don't like to leave their terminal. P.S. Can send attachments from terminal.
View gmailer.py
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
You can’t perform that action at this time.