Skip to content

Instantly share code, notes, and snippets.


Wesley Childs mrchilds

  • Hampshire
View GitHub Profile
mrchilds / gist:3150241
Created Jul 20, 2012
Mysql CSV Import
View gist:3150241
Example File
Import file from command line:
$ mysqlimport -u root -p --local --fields-terminated-by=',' DATABASE FILENAME
mrchilds / gist:3164367
Created Jul 23, 2012
Mysql - Add New User With Specific DB Permissions
View gist:3164367
#Connect to mysql command line...
$ mysql -u root -p
#Create user
$ create user USERNAME;
#Assign Permissions
$ grant PERMISSIONS on DATABASE.* to 'USERNAME'@'localhost' identified by 'PASSWORD';
mrchilds / gist:3394025
Created Aug 19, 2012
Django Unit Test - Ajax
View gist:3394025
from django.utils import simplejson
#Go to a url
response = self.client.get(self.url)
foobar = simplejson.loads(response.content)
print foorbar['item']
mrchilds / gist:3776003
Created Sep 24, 2012
Django Performance Fact Finding
View gist:3776003
Very quick way to get some timing info...
import time
class Timer():
def __enter__(self): self.start = time.time()
def __exit__(self, *args): print time.time() - self.start
with Timer():
mrchilds / gist:5886088
Created Jun 28, 2013
Puppet - Templates - Join list
View gist:5886088
# Useful when creating lists in config files...
<%= my_list.join(',') %>
View gist:5957577
# Using (currently in master)
# Jenkins config...
# Wes Code (e.g. before any help)
source /home/ubuntu/production/bin/activate
cd /srv/
echo "Generating 'doc' folder..."
View gist:6523737
from django.core.cache import cache
cache_key = 'CM:recent-jobs'
mrchilds / gist:6573907
Last active Dec 23, 2015
Simple Fabric Script
View gist:6573907
# Deploy branch to staging
from fabric.api import cd, env, parallel, run, task
from fabric.decorators import roles
# Define your servers
env.roledefs = {
'staging-web-servers': ['',
mrchilds / gist:6573925
Created Sep 15, 2013
Simple hubot plugin
View gist:6573925
# Description:
# Deploy branches to staging.
# Commands:
# hubot deploy <branch> to <environment>
# hubot show branches
{spawn, exec} = require 'child_process'
module.exports = (robot) ->
mrchilds / gist:6573934
Created Sep 15, 2013
Example Supervisor Config
View gist:6573934
command=/srv/hubot/bin/hubot --adapter hipchat
You can’t perform that action at this time.