Skip to content

Instantly share code, notes, and snippets.

Danny Cosson dcosson

Block or report user

Report or block dcosson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View open-r10k-repo-pull-request
#!/bin/bash
#
# 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)
#
View keybase.md

Keybase proof

I hereby claim:

  • I am dcosson on github.
  • I am dcosson (https://keybase.io/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:

@dcosson
dcosson / hello.py
Last active Aug 29, 2015
Flask Hello
View hello.py
# Simple http server to test concurrency or load balancing or whatever,
# specifying numprocs greater than 1 will run that many instances of the
# flask app in subprocesses on incrementing ports beginning with the one specified
# Run:
# sudo pip install flask
# python hello.py [PORT-NUM] [NUMPROCS]
from flask import Flask
import os
import signal
@dcosson
dcosson / gist:27bcca9b9ad28a38ab60
Last active Aug 29, 2015
Rename an ios project
View gist:27bcca9b9ad28a38ab60

I was renaming a project from GrowthKit to Mave, and updating the prefix.

This got me 95% of the way there, there were a few things to clean up manually (not really sure why because the things I fixed manually matched these rules). Luckily the previous project name wasn't "View" or something that would conflict with any builtin types or setting names

rm -rf Pods
brew install rename 
shopt -s globstar     # requires bash 4.0+, makes ** recursive

rename s/GrowthKit/Mave/ **
@dcosson
dcosson / gist:2defd0bd596f00e14f60
Last active Aug 29, 2015
Add an extra share button to mave
View gist:2defd0bd596f00e14f60
MaveSDK *mave = [MaveSDK sharedInstance];
[mave presentInvitePageModallyWithBlock:^(UIViewController *inviteController) {
if ([inviteController isKindOfClass:[UINavigationController class]]) {
UINavigationController *navController = (UINavigationController *)inviteController;
// Here replace the method "foo" with your method to present a share sheet
// And you can of course use a button with an image instead of the title "Share"
UIBarButtonItem *shareButton = [[UIBarButtonItem alloc] initWithTitle:@"Share"
style:UIBarButtonItemStylePlain
target:self action:@selector(foo)];
@dcosson
dcosson / ableton-post-merge.py
Created Mar 3, 2012
A post-merge script to go with the ableton-pre-commit.py
View ableton-post-merge.py
#!/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
dcosson / gist:2698090
Created May 14, 2012
Brubeck Websockets - testing them out based on implementation in https://github.com/stuntgoat/brubeck.git 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"
else:
conn_ids = WSSession.get_active_conn_ids(to_user_id)
@dcosson
dcosson / gist:2918201
Created Jun 12, 2012
Archive a website (in this case, tourbie.com)
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 http://tourbie.com
# --mirror mirrors the site (recurses all links)
# -p downloads all the links necessary to view the site
# --convert-links converts all links starting with http://tourbie.com to be relative
# -e robots=off optional, ignore robots.txt (on tourbie.com, I had disallowed the static files directory in robots.txt)
@dcosson
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 'manage.py runserver' | grep -v grep | awk '{ printf "%s ", $2 }'` ; do sudo kill $i ; done
@dcosson
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
/^\(?[0-9]{3}[.\-\)]?\s?[0-9]{3}[.-\s]?[0-9]{4}$/
You can’t perform that action at this time.