Skip to content

Instantly share code, notes, and snippets.

View inirudebwoy's full-sized avatar
🏗️
putting things on top of other things

Michael Klich inirudebwoy

🏗️
putting things on top of other things
View GitHub Profile
@inirudebwoy
inirudebwoy / initial_data.json
Last active August 29, 2015 14:17
Admin user initial data for Django < 1.7, password is 'admin'
[{"model": "auth.user",
"pk": 1,
"fields":
{"username": "admin",
"first_name": "",
"last_name": "",
"is_active": true,
"is_superuser": true,
"is_staff": true,
"password": "pbkdf2_sha256$15000$TrGrqtzwNJUa$omLG886xVSLNxYOvjrceDbWQS5ISmzyPM9ka0rAhu3Y=",
@inirudebwoy
inirudebwoy / 0001_createsuperuser.py
Created March 13, 2015 12:18
Django 1.7+ migration for creating superuser
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.contrib.auth.admin import User
def create_superuser(apps, schema_editor):
superuser = User()
superuser.is_active = True
@inirudebwoy
inirudebwoy / api_check_logger.py
Last active August 29, 2015 14:15
Decorator logging calls with specified arguments, useful when deprecating API's
import logging
from inspect import getouterframes, currentframe
from functools import wraps
logger = logging.getLogger(__name__)
def _get_caller_details(curframe):
"""
Helper retrieving caller details from current frame
@inirudebwoy
inirudebwoy / Vagrantfile
Created February 11, 2015 12:53
Install Ubuntu 10.04 with couchdb 1.2.1
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box_url = "http://files.vagrantup.com/lucid64.box"
config.vm.box = "ubuntu/lucid64"
config.vm.network "forwarded_port", guest: 5984, host: 5984
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install -y python-software-properties curl
@inirudebwoy
inirudebwoy / gist:ffddb854ce537dd21053
Created February 6, 2015 15:44
Pretty print json in curl.
function p_curl() {
{
curl "$@"
}|python -mjson.tool
}
class SettingsReader:
def __init__(self, opts, config, settings):
self.opts = opts
self.config = config
self.settings = settings
def __contains__(self, key):
if (key in self.opts or
key in self.config or
key in self.settings):