Skip to content

Instantly share code, notes, and snippets.

View sc0tt's full-sized avatar
🍦
grinding

Scott Adie sc0tt

🍦
grinding
View GitHub Profile
@sc0tt
sc0tt / watch.py
Created November 13, 2013 15:31
BTC Price Watch
import requests
import time
import decimal
lastPrice = decimal.Decimal("0")
while True:
ret = requests.get("https://coinbase.com/api/v1/prices/spot_rate").json()
price = decimal.Decimal(ret['amount'])
diff = price - lastPrice
if diff > 0:
@sc0tt
sc0tt / animate.py
Last active December 28, 2015 03:49
Animation
import os
import time
expander = {"n":"\n", "s": " ", "q": "~~~~~~"}
os.system(['clear','cls'][os.name == 'nt'])
animation = []
animation.append("""nnnnnnqqq""")
animation.append("""n/nnnnnqqq""")
animation.append("""n /n/nnnnqqq""")
@sc0tt
sc0tt / outerdiff.py
Last active December 23, 2015 20:09
Performs an outer join type deal on two files. Finds lines in A not found in B and lines in B not found in A
import sys
def getContents(inFile):
return sorted(list(set(inFile.read().split("\n"))), key=lambda k: k.lower())
lFileName = raw_input("Enter the first file name: ") if len(sys.argv) < 2 else sys.argv[1]
with open(lFileName, "r") as left:
leftLines = getContents(left)
rFileName = raw_input("Enter the second file name: ") if len(sys.argv) < 3 else sys.argv[2]