Skip to content

Instantly share code, notes, and snippets.

View d0ugal's full-sized avatar
👋
Hi!

Dougal Matthews d0ugal

👋
Hi!
View GitHub Profile
@d0ugal
d0ugal / auto_star_openstack_repos.py
Last active May 25, 2016 13:34 — forked from jd/auto-star-openstack-repo
Starring all OpenStack Git repositories
#!/usr/bin/env python
from github import Github
import os
TOKEN = os.environ.get("GITHUB_TOKEN")
USERS = ("openstack", "stackforge", "openstack-dev", "openstack-infra", "openstack-attic", "stackforge-attic", "hackebrot")
g = Github(TOKEN)
me = g.get_user()
@d0ugal
d0ugal / install_vagrant_sudoers.sh
Created December 11, 2012 09:26 — forked from beddari/install_vagrant_sudoers.sh
Allow Vagrant sudo-access without password for NFS-setup
#!/bin/bash
# Script for placing sudoers.d files with syntax-checking
if [ -z "$1" ]; then
# Making a temporary file to contain the sudoers-changes to be pre-checked
TMP=$(mktemp)
cat > $TMP <<EOF
Cmnd_Alias VAGRANT_EXPORTS_ADD = /bin/su root -c echo '*' >> /etc/exports
Cmnd_Alias VAGRANT_NFSD = /etc/init.d/nfs-kernel-server restart
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /bin/sed -e /*/ d -ibak /etc/exports
@d0ugal
d0ugal / contribute_to_model.py
Created April 3, 2012 14:09
Patch an existing django model.
from django.db import models
from django.utils.functional import curry
def contribute_to_model(contrib, destination):
"""
Update ``contrib`` model based on ``destination``.
Every new field will be created. Existing fields will have some properties
updated.
@d0ugal
d0ugal / Chrome cross-domain loading
Created May 10, 2011 18:26
Do this from the command line to run chrome so that it can load AJAX etc cross-domain
open -a /Applications/Google\ Chrome.app --args --disable-web-security
# Prevent pip from doing anything unless you're inside an activated virtualenv.
PIP=/usr/local/bin/pip
function pip {
if [ "x$VIRTUAL_ENV" = 'x' ]; then
echo "No virtualenv activated; bailing."
else
PIP -E `basename $VIRTUAL_ENV` "$@"
fi
}