Skip to content

Instantly share code, notes, and snippets.


Danny Cosson dcosson

View GitHub Profile
dcosson /
Created Mar 3, 2012
Quick first attempt at using git for Ableton Live projects.
#!/usr/bin/env python
""" A pre-commit git hook that gunzips the .als file and adds the resulting xml file to the git staging index.
It doesn't work perfectly to do a `git add` in a pre-commit hook - if nothing else in the repo has changed,
the pre-commit won't even be fired so nothing happens. If something else has changed, the pre-commit hook
doesn't get fired in time for the files it creates to show up in the list of files to be committed but the
files it creates do actually go into the commit. So it works, but that's kind of weird.
dcosson /
Created Mar 3, 2012
A post-merge script to go with the
#!/usr/bin/env python
""" Converts all the .xml files back to .als (i.e. gzips them)
import os
import sys
import subprocess
import gzip
dcosson / gist:2698090
Created May 14, 2012
Brubeck Websockets - testing them out based on implementation in commit=1e97a9ff196927523a506b6423a1a34d0e6959c0
View gist:2698090
class TestHandler(WebMessageHandler):
""" Testing out sending data to arbitrary websockets
def get(self):
ws_message = "I like websockets"
to_user_id = self.get_argument('to_user_id')
if not to_user_id:
body = "enter arg ?to_user_id=X"
conn_ids = WSSession.get_active_conn_ids(to_user_id)
dcosson / gist:2918201
Created Jun 12, 2012
Archive a website (in this case,
View gist:2918201
# Just a note to myself on how to archive a website
mkdir tourbie_archive
cd tourbie_archive
wget --mirror -p -nH -e robots=off --convert-links
# --mirror mirrors the site (recurses all links)
# -p downloads all the links necessary to view the site
# --convert-links converts all links starting with to be relative
# -e robots=off optional, ignore robots.txt (on, I had disallowed the static files directory in robots.txt)
dcosson / gist:3321717
Created Aug 11, 2012
kill zombie procs
View gist:3321717
# a quick shell command to kill all procs matching a grep pattern
for i in `ps aux | grep ' runserver' | grep -v grep | awk '{ printf "%s ", $2 }'` ; do sudo kill $i ; done
dcosson / gist:3430463
Created Aug 22, 2012
Phone number regex in js
View gist:3430463
// allows:
// 1235554567
// (123) 555-4567
// 123.555.4567
// 123-555-4567
dcosson / gist:3686437
Created Sep 9, 2012
Compile Vim on OSX (Mountain Lion)
View gist:3686437
# default vim on osx doesn't have python, ruby support or clipboard support. These configure options add all that
# I also ran into problems using rvm ruby, had to include those libs in the LDFLAGS for vim
# Steps:
$ rvm install 1.9.1
$ rvm use 1.9.1 # vim doesn't support anything higher
$ curl | tar xj
$ cd vim73
$ ./configure --with-features=huge --enable-perlinterp=yes --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-multibyte
dcosson / gist:3839768
Created Oct 5, 2012
Count viewers on a mongrel2 site
View gist:3839768
# bash command to count the number of unique ip addresses in the mongrel2 access log (default format)
cat mongrel2.access.log | cut -f 4 -d : | cut -f 1 -d , | sort | uniq | wc -l
View open-r10k-repo-pull-request
# Uses github's hub command line tool and r10kdiff gem to open a pull request
# for a repository containing a Puppetfile used by r10k.
# Assumes it should be from the current branch <Puppet Environment Name> in a
# fork to the same branch upstream (since you can't use feature branches in the
# same repository with r10k as it might deploy them as environments)

Keybase proof

I hereby claim:

  • I am dcosson on github.
  • I am dcosson ( on keybase.
  • I have a public key whose fingerprint is 7315 7FF6 9E72 ABBC 1CB1 0C11 5399 BD81 8F48 C11F

To claim this, I am signing this object:

You can’t perform that action at this time.