Skip to content

Instantly share code, notes, and snippets.

import sys
from collections import Counter
c = Counter()
for line in map(str.rstrip, sys.stdin):
# Split from right so this handles commas embedded in token values
token, count = line.rsplit(",", 2)
c[token] += 1
for token, count in c.items():
from urllib.parse import urlparse, parse_qsl
import sys
# format, clean and dump token with a count
def emit(delim, token):
if token and len(token) > 0:
token = token.lower().replace(" ", "_")
print("{0}:{1},1".format(delim, token))
# iterate over each line in input and emit tokens with a count

Keybase proof

I hereby claim:

  • I am ajstiles on github.
  • I am ajstiles (https://keybase.io/ajstiles) on keybase.
  • I have a public key ASARHkTvBhsw4VPwSDGT53bDqe8-IGGoLCksKKdSxQembwo

To claim this, I am signing this object:

@ajstiles
ajstiles / pullrequest.rb
Last active August 29, 2015 14:25
Pull Request
def validate_user_group_association!
if !group_user_finder.associated?
redirect_path = group ? not_found_path : '/'
redirect_to redirect_path
end
end
@ajstiles
ajstiles / resign.sh
Last active August 29, 2015 14:19 — forked from 4c00h/resign_ipa.sh
#!/bin/bash
# usage: sh resign.sh file.ipa file.mobileprovision "CERTIFICATE NAME"
IPA="$1"
# path to .mobileprovision
PROVISION="$2"
# certificate name as appears in the keychain e.g. "iPHONE Distribution: Example "
CERTIFICATE=$3
unzip -q "$IPA"
#!/bin/bash
#usage: sh resign.sh file.ipa file.mobileprovision "CERTIFICATE NAME"
IPA="$1"
#path to .mobileprovision
PROVISION="$2"
#certificate name as appears in the keychain e.g. "iPHONE Distribution: Example "
CERTIFICATE=$3
unzip -q "$IPA"
# remove the signature
rm -rf Payload/*.app/_CodeSignature Payload/*.app/CodeResources
@ajstiles
ajstiles / rosters.txt
Created November 8, 2014 17:42
Optimal Fan Duel Week 10 2014 Rosters - Sunday Only
> Michael Vick (QB), Dan Bailey (K), Jimmy Graham (TE), Justin Forsett (RB), Percy Harvin (WR), Ravens (DST)
- Andre Ellington (RB), Brandon Marshall (WR)
- Ronnie Hilman (RB), Julio Jones (WR)
> Colin Kaepernick (QB), Dan Baily (K), Jimmy Graham (TE), Ravens (DST), Justin Forsett (RB)
- Andre Ellington (RB), Roddy White (WR), Percy Harvin (WR), Vincent Jackscon (WR)
> Ronnie Hilman (RB), Roddy White (WR)
- Harry Douglas (WR), Antonio Brown (WR)
- Percy Harvin (WR), Brandon Marshall (WR)
- Vincent Jackson (WR), Brandon Marshall (WR)
# Load environment variables
require 'dotenv'
Dotenv.load
require 'sinatra'
require 'twilio-ruby'
require 'pony'
# Set our xml response content type for all responses
before do
# Record the user voicemail and email link to us
post "/record_voicemail" do
forward_voicemail(params)
response = Twilio::TwiML::Response.new do |r|
r.Say "Thank you for calling. Bye!"
r.Hangup
end
response.text
end
post "/record_or_connect" do
response = Twilio::TwiML::Response.new do |r|
if params['DialCallStatus'] == 'completed'
r.Hangup
return
end
if params[:Digits] == "1"
r.Dial do
r.Number ENV['CONNECT_1_NUMBER']