Skip to content

Instantly share code, notes, and snippets.

View spladug's full-sized avatar
🐕
eating a tortilla

Neil Williams spladug

🐕
eating a tortilla
View GitHub Profile
"""Check the time penalty for checking socket liveliness"""
import errno
import gc
import socket
import time
import gevent.socket
ITERATIONS = 10_000
### Keybase proof
I hereby claim:
* I am spladug on github.
* I am spladug (https://keybase.io/spladug) on keybase.
* I have a public key whose fingerprint is 2A2D AD15 78F0 5F89 5CF7 336A 4343 B50C 8F8D 8190
To claim this, I am signing this object:
#!/usr/bin/python
import itertools
import random
IDEAL_SLEEP = 300
SLEEPER_COUNT = 3000
function retry {
local retry_max=$1
shift
local count=$retry_max
while [ $count -gt 0 ]; do
"$@" && break
count=$(($count - 1))
sleep 1
done
@spladug
spladug / gist:1711628
Created January 31, 2012 17:08
precomputed queries
### Following are all the precomputed queries in reddit including
### those from queries.py and promote.py. user/author_id is an account
### sr is a subreddit, sort is one of ("hot", "new", "top", "controversial")
### and time is one of ("all", "hour", "day", "week", "month", "year").
### I've divided them into two rough groupings: user and subreddit.
def get_links(sr, sort, time):
def get_spam_links(sr):
def get_spam_comments(sr):
def get_reported_links(sr):
The install script has moved to the main reddit repository:
https://github.com/reddit/reddit/blob/master/install-reddit.sh