Skip to content

Instantly share code, notes, and snippets.

View jsoncorwin's full-sized avatar

Jason Corwin jsoncorwin

View GitHub Profile
@jsoncorwin
jsoncorwin / gist:4300115
Last active December 9, 2015 16:58 — forked from zain/gist:4291724
import re
import string
# find the first quote in a string
quotere = re.compile(
r"""(?P<quote>"[^\"\\]*(?:\\"|[^"])*") # Quote, possibly containing encoded
# quotation mark
\s*(?P<rest>.*)$ """,
re.VERBOSE)
@jsoncorwin
jsoncorwin / commit-msg
Created October 2, 2013 22:58
Automatically converts my commits to iOS repo to TitleCase to prevent driving my co-founder crazy
#!/usr/bin/env python
import sys
filename = sys.argv[1]
with open(filename, 'r+w') as f:
msg = f.read()
msg = msg.title()
f.seek(0)
f.write(msg)
@jsoncorwin
jsoncorwin / reboot_droplet.py
Created December 20, 2013 07:30
A quick script to reboot a Digital Ocean droplet that's being finicky.
import argparse
import digitalocean
def reboot_droplet(name, client_id, api_key):
manager = digitalocean.Manager(client_id=client_id, api_key=api_key)
droplets = manager.get_all_droplets()

Keybase proof

I hereby claim:

  • I am jsoncorwin on github.
  • I am jsoncorwin (https://keybase.io/jsoncorwin) on keybase.
  • I have a public key whose fingerprint is 4C3F 3F74 4ACF A7E8 81EF AD1A D95D 993E 0749 64AE

To claim this, I am signing this object:

function sendOptimizelyEvent(eventId, key) {
try {
function guid() {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();