Skip to content

Instantly share code, notes, and snippets.

import math
def get_digits_string_map(num):
return list(map(int, str(num)))
def get_digits_string_list(num):
return [int(char) for char in str(num)]
def get_digits(num):
return [(num // (10 ** i)) % 10 for i in range(int(math.log10(num)), -1, -1)]
@bdejong
bdejong / fabfile.py
Created September 13, 2012 13:59
fabric + virtualenv + django copy remote db (*) to local (in my case sqlite)
def production():
env.hosts = ['you.web.server']
env.user = 'something'
env.project_root = '/path/to/your.project/'
env.activate = 'source /path.to/your/virtualenv/bin/activate' # virtualenv
def virtualenv(command):
run(env.activate + '&&' + command)
def copy_db_to_local():