Skip to content

Instantly share code, notes, and snippets.

View albums_nov_2017.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 8 columns, instead of 4. in line 6.
id,album,artist,url,img,available,channel,added
3274251919,Horehound Debut Self-titled,Horehound,https://horehound.bandcamp.com/album/horehound-debut-self-titled,https://f4.bcbits.com/img/a1161795522_16.jpg,True,,2016-08-28T12:03:19.656392
1430603235,Origins,Mount Soma,https://mountsoma.bandcamp.com/album/origins,https://f4.bcbits.com/img/a4202223841_16.jpg,True,,2016-08-28T12:03:19.656392
4218933258,/ABRACADABRA\,abracadabra,https://abracadabrabracadabrabracadabra.bandcamp.com/album/abracadabra,https://f4.bcbits.com/img/a0903751040_16.jpg,True,,2016-08-28T12:03:19.656392
2160951328,Revenge of Swampy's Creature EP,Los Savages,https://lossavages.bandcamp.com/album/revenge-of-swampys-creature-ep,https://f4.bcbits.com/img/a3177664259_16.jpg,True,,2016-08-28T12:03:19.656392
1847541816,Mrtav,Hesperian Death Horse,https://hesperiandeathhorse.bandcamp.com/album/mrtav,https://f4.bcbits.com/img/a3395229351_16.jpg,True,doom,2016-08-29T13:21:51.946040
1950657943,Jason...The Dragon,Weedeater,https://weedeater.bandcamp.co
View timed_cached.py
import datetime
def timed_cached(timeout=60 * 60, now=datetime.datetime.now):
def outer(method_or_attribute):
if not hasattr(timed_cached, '__mapping'):
timed_cached.__mapping = {}
View doombot.py
#! /usr/bin/python
import requests
import json
import click
import os
import datetime
requests.packages.urllib3.disable_warnings()
View hangouts_link_hack.py
View cached_json_server.py
import json
from flask import request, url_for
from flask.ext.api import FlaskAPI, status, exceptions
from werkzeug.contrib.cache import SimpleCache
app = FlaskAPI(__name__)
cache = SimpleCache()
@Ogreman
Ogreman / deduper.py
Created Oct 22, 2014
deduper with history of duplicates and support for hashable types
View deduper.py
from collections import deque
def dedupe_with_history(items, key=None, history=None):
previous = deque(maxlen=history)
seen = set()
for item in items:
val = item if key is None else key(item)
if val not in seen:
yield item
@Ogreman
Ogreman / nginx.conf
Created May 23, 2014
battle ready nginx
View nginx.conf
user www-data;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 65000;
events {
worker_connections 2048;
multi_accept on;
use epoll;
}
View varname_hack.py
import itertools
def name_func(var, scope=globals):
try:
return itertools.ifilter(
lambda x: var is scope().get(x),
scope().keys()
).next()
except StopIteration:
View speed_check.py
from __future__ import division
from __future__ import print_function
import requests
import time
from contextlib import closing
import sys
# in bytes
CHUNKS = 1024
View keybase.md

Keybase proof

I hereby claim:

  • I am ogreman on github.
  • I am ogre (https://keybase.io/ogre) on keybase.
  • I have a public key whose fingerprint is D715 5891 CB08 3D6A 58B3 11FC 5D46 E55E FD80 2E8F

To claim this, I am signing this object: