Skip to content

Instantly share code, notes, and snippets.

View peterarnott's full-sized avatar

Peter peterarnott

View GitHub Profile
@peterarnott
peterarnott / challenge.py
Created August 27, 2012 10:36
My solution to the week5 challenge
#peterarenot
import requests; i = open("input.txt"); o = open("output.txt", 'w'); d = {}
for l in i.readlines(): d[l] = float(requests.get("http://finance.yahoo.com/d/quotes.csv", params={'s': l, 'f': 'j1'}).text[:-3])
for k in sorted(d, key=d.get, reverse=True): o.write("%s - %sB\n" % (k.strip(), d[k]))
@peterarnott
peterarnott / fizzbuzz.py
Created August 21, 2012 01:38
My FizzBuzz script: Smaller is better, not following best practises! (score 105)
n = input("Number Play To: "); i=0
while i < n:
s=''; i+=1
if i%3==0: s+='fizz'
if i%5==0: s+='buzz'
if s: print s
else: print i
@matthewphiong
matthewphiong / Procfile
Created November 9, 2011 18:21
Heroku Django Procfile
web: python my_django_app/manage.py collectstatic --noinput; bin/gunicorn_django --workers=4 --bind=0.0.0.0:$PORT my_django_app/settings.py
import socket
import struct
import json
def unpack_varint(s):
d = 0
for i in range(5):
b = ord(s.recv(1))
d |= (b & 0x7F) << 7*i
if not b & 0x80:
@olivierlacan
olivierlacan / launch_sublime_from_terminal.markdown
Created September 5, 2011 15:50
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation