Skip to content

Instantly share code, notes, and snippets.

Avatar

Ry4an Brase Ry4an

View GitHub Profile
@Ry4an
Ry4an / pre-commit
Created Feb 13, 2014
Put this in your repo's www/.git/hooks as pre-commit to make sure you can't commit with 'KILL ME' in a line
View pre-commit
#!/bin/sh
#
if git diff --cached | grep --quiet 'KILL ME' ; then
echo FORGOT TO REMOVE KILL ME
exit 1
fi
View request
curl 'http://api.swiftype.com/api/v1/public/engines/suggest.json?callback=jQuery17202572345747612417_1392736179267&q=lov&engine_key=CywzyscJAHKCwrezfzpN&search_fields%5Bactor%5D%5B%5D=name&search_fields%5Bactor%5D%5B%5D=alt_names&search_fields%5Btag%5D%5B%5D=title&search_fields%5Bseries%5D%5B%5D=title%5E4&search_fields%5Bseries%5D%5B%5D=alt_title%5E2&search_fields%5Bseries%5D%5B%5D=genre&search_fields%5Bseries%5D%5B%5D=tags&search_fields%5Bseries%5D%5B%5D=description&search_fields%5Bseries%5D%5B%5D=description_short&search_fields%5Bseries%5D%5B%5D=description_flipper_es&search_fields%5Bseries%5D%5B%5D=description_es&fetch_fields%5Bactor%5D%5B%5D=external_id&fetch_fields%5Bactor%5D%5B%5D=url&fetch_fields%5Bactor%5D%5B%5D=name&fetch_fields%5Bactor%5D%5B%5D=thumbnail&fetch_fields%5Bactor%5D%5B%5D=series_count&fetch_fields%5Btag%5D%5B%5D=external_id&fetch_fields%5Btag%5D%5B%5D=url&fetch_fields%5Btag%5D%5B%5D=title&fetch_fields%5Bseries%5D%5B%5D=external_id&fetch_fields%5Bseries%5D%5B%5D=url&fetch_fields%5Bseries%
@Ry4an
Ry4an / unloved-issue.py
Created Jul 7, 2014
nag least recently updated issue for this release
View unloved-issue.py
#!/usr/bin/python
import json
import pytz
import urllib2
import datetime
import dateutil.parser
import re
import sys
import humanize
View keybase.md

Keybase proof

I hereby claim:

  • I am ry4an on github.
  • I am ry4an (https://keybase.io/ry4an) on keybase.
  • I have a public key whose fingerprint is 9F62 F388 0680 DB9C 199C E813 D2F8 E7C5 03B7 1364

To claim this, I am signing this object:

View gist:d10b97a3c47c54601c3c
foobar</div>
> quote in code block

quote outside code block

View gist:1792078
// the solution
// 1. declare the class Number(Int)
// 2. define method Number.inc(): Number
// 3. define method Number.dec(): Number
// 4. define getNumber():Int
class Number(val n : Int) { // n cannot be changed!
def inc(): Number = new Number(n + 1)
@Ry4an
Ry4an / gist:2051149
Created Mar 16, 2012
grove.io connection error
View gist:2051149
This has been going on for 10 minutes now:
[eighth] (!) Irssi: Looking up irc.8thbridge.net
[eighth] (!) Irssi: Reconnecting to irc.8thbridge.net [184.106.113.202] port 6697 - use
/RMRECONNS to abort
(!) Irssi: warning SSL write error: Connection reset by peer
[eighth] (!) Irssi: Connection to irc.8thbridge.net established
(!) Irssi: warning SSL read error: server closed connection unexpectedly
[eighth] (!) Irssi: Connection lost to irc.8thbridge.net
@Ry4an
Ry4an / gist:2089965
Created Mar 19, 2012
Share doesn't save time or space vs. local clones
View gist:2089965
ry4an@ry4an:~/projects$ time hg clone mercurial mercurial.localclone
updating to branch default
964 files updated, 0 files merged, 0 files removed, 0 files unresolved
real 0m5.908s
user 0m5.092s
sys 0m0.392s
ry4an@ry4an:~/projects$ time hg --config extensions.share= share mercurial mercurial.shareupdating working directory
964 files updated, 0 files merged, 0 files removed, 0 files unresolved
View gist:2715764
#!/bin/bash
THIS_FOLDER=`dirname $0`
node=$1
# What files have changed
files=`hg log --template="{files}" -r $node`
# Check each
for file in $files; do
@Ry4an
Ry4an / session.py
Created Oct 13, 2015
default dict is your friend
View session.py
from collections import defaultdict, namedtuple
class Session:
def __init__(self):
self.seconds = 0
self.session_id = None
self.events_by_type = defaultdict(int)
def add_event(self, event):
if self.session_id and event.session_id != self.session_id: