View dater.py
#!/usr/bin/env python
import os
import sys
import subprocess
import re
regexes = map(re.compile, [
r'(IMG|PANO)_(?P<YEAR>\d{4})(?P<MONTH>\d{2})(?P<DAY>\d{2})_(?P<HOUR>\d{2})(?P<MINUTE>\d{2})(?P<SECOND>\d{2})(?P<EXTRA>.*).jpg',
View async_slot2.py
import math
import sys
import asyncio
from functools import partial
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QGridLayout, QProgressBar
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
from PyQt5.QtCore import QUrl
from quamash import QEventLoop
View async_slot.py
import math
import sys
import asyncio
from functools import partial
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QGridLayout, QProgressBar
from quamash import QEventLoop
class MyWidget(QWidget):
View slice.py
#!/usr/bin/env python
# based on slice example from
# https://medium.com/@tucnak/why-go-is-a-poorly-designed-language-1cc04e5daf2#.pr6pifnky
from itertools import count
def log(item, log_counter=count(start=1)):
print next(log_counter), item
View bloom_filter.py
#!/usr/bin/env python
import hashlib
from math import ceil, log
def hasher(x, n):
ret = []
h = hashlib.sha1()
h.update(x)
for i in range(n):
View untar
#!/usr/bin/env python
from cleantar import single_prefix
import sys
import os
import time
single, msg = single_prefix(sys.argv[1])
if single:
print 'tar file is clean; just one prefix; will untar',; sys.stdout.flush()
for i in range(5, 0, -1):
View cleantar.py
#!/bin/sh
if "true" : '''\'
then
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $DIR/venv/bin/activate
exec python "$0" "$@"
exit 127
fi
'''
View exmaple_outputs.txt
#
# example output with redirect cache and 301 response
#
# first request to /old
127.0.0.1 - - [11/Jun/2014 13:45:13] "GET /old HTTP/1.1" 301 6
127.0.0.1 - - [11/Jun/2014 13:45:13] "GET /new HTTP/1.1" 301 6
127.0.0.1 - - [11/Jun/2014 13:45:13] "GET /newer HTTP/1.1" 301 6
127.0.0.1 - - [11/Jun/2014 13:45:13] "GET /newest HTTP/1.1" 200 6
# 3 more requests to /old
View example_client.py
#!/usr/bin/env python
import sys
port = int(sys.argv[1])
import requests
s = requests.session()
base_url = 'http://localhost:%d' % port
print '-------- request /old'
View example_server.py
#!/usr/bin/env python
import sys
from bottle import get, run, response
PORT = int(sys.argv[1])
STATUS = int(sys.argv[2])
@get('/old')
def index():