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 / domain.net
Created March 1, 2014 02:11
nginx config for a site under gunicorn
server {
listen 80;
server_name subdomain.domain.net;
access_log /path/to/access.log;
error_log /path/to/error.log;
location / {
proxy_pass http://127.0.0.1:8001/;
proxy_redirect off;
<?php
$this->log($data);
Cakelog::write('error', $data);
// If $data is an array
Cakelog::write('error', print_r($data, true));
?>
@sc0tt
sc0tt / picker.py
Created July 12, 2014 12:49
Player picker
import random
name_list = None
with open("names.txt") as name_file:
name_list = [n.strip() for n in name_file.readlines()]
if len(name_list) % 2:
exit("Number of Players is not Even")
with open("out_names.txt", "w") as out:
Sentence:
That is a really cool fire truck you got there!
Left side is a key, right is a value
That is a -> really cool fire
is a really -> cool fire truck
a really cool -> fire truck you
really cool fire -> truck you got
cool fire truck -> you got there!
@sc0tt
sc0tt / pokeparser.py
Created September 23, 2014 01:55
Parses the pokemon tcg website.
import re
import time
from selenium import webdriver
# You will need to have the phantomjs exe in your path or alongside this script.
driver = webdriver.PhantomJS()
current_page = 0
total_pages = -1
### Keybase proof
I hereby claim:
* I am sc0tt on github.
* I am sc0tt (https://keybase.io/sc0tt) on keybase.
* I have a public key whose fingerprint is 4FDE 9BAC 0401 F8D7 4780 85C3 AE61 77CB 40DC 6C46
To claim this, I am signing this object:
@sc0tt
sc0tt / webm.md
Last active August 29, 2015 14:24 — forked from ndarville/webm.md

Grab ffmpeg from https://www.ffmpeg.org/download.html

It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.

The most trivial operation would be converting gifs:

ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
  • -crf values can go from 4 to 63. Lower values mean better quality.
  • -b:v is the maximum allowed bitrate. Higher means better quality.
@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]
@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 / 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: