Skip to content

Instantly share code, notes, and snippets.

View bcambel's full-sized avatar
🌴
On vacation

Bahadir Cambel bcambel

🌴
On vacation
View GitHub Profile
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 19, 2025 17:31 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@bcambel
bcambel / sql_mongodb_dump_middleware.py
Created May 21, 2012 09:12 — forked from kesor/sql_mongodb_dump_middleware.py
Django MongoDB + SQL dump middleware
from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
from django.db import connection
from pymongo.connection import Connection
from time import time
import struct
import bson
from bson.errors import InvalidBSON
class SqldumpMiddleware(object):
@hrldcpr
hrldcpr / tree.md
Last active January 6, 2025 22:43
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@vinioliveira
vinioliveira / Additional Commands
Created June 29, 2011 13:10 — forked from lsbardel/redis-server-for-init.d-startup
Init.d Redis script for Ubuntu
$ sudo adduser --system --no-create-home --disabled-login --disabled-password --group redis
$ sudo mv ~/init-deb.sh /etc/init.d/redis
$ sudo mkdir /etc/redis
$ sudo mv ~/redis.conf /etc/redis/redis.conf
$ sudo chmod +x /etc/init.d/redis
$ sudo chown -R redis:redis /opt/redis
$ sudo touch /var/log/redis.log
$ sudo chown redis:redis /var/log/redis.log
$ sudo update-rc.d -f redis defaults
# Redis
God.watch do |w|
w.name = "redis"
w.interval = 30.seconds
w.start = "/etc/init.d/redis start"
w.stop = "/etc/init.d/redis stop"
w.restart = "/etc/init.d/redis restart"
w.start_grace = 10.seconds
w.restart_grace = 10.seconds
@hamin
hamin / mongomapper_rails3_template.rb
Created January 20, 2011 22:41
A Rails 3 Application template for MongoMapper
# Some basic flags
use_mongomapper = false
use_compass = false
use_simplenavigation = false
rails3_branch = false
run "cp config/database.yml config/database.example.yml"
# Remove redundant files
remove_file "public/index.html"
@cyberdelia
cyberdelia / fabfile.py
Created April 3, 2010 14:05
Fabric deploy script with : south migrations, rollback and maintenance page.
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }
@onyxfish
onyxfish / fabfile.py
Created February 9, 2010 23:05
Chicago Tribune News Applications fabric deployment script
from fabric.api import *
"""
Base configuration
"""
env.project_name = '$(project)'
env.database_password = '$(db_password)'
env.site_media_prefix = "site_media"
env.admin_media_prefix = "admin_media"
env.newsapps_media_prefix = "na_media"
@ambethia
ambethia / _index.md
Created October 18, 2008 01:28
All kinda of deployment notes