Skip to content

Instantly share code, notes, and snippets.

@flowolf
flowolf / transmission_sum_up.py
Last active February 22, 2016 12:34
Sum up your transmission uploads
#!/usr/bin/python
# tested with transmission-remote 2.51 (13280)
# call like:
# $ transmission-remote -l | ./sum_up.py
# units: https://en.wikipedia.org/wiki/Megabyte
import sys
total = 0
input = sys.stdin
for l in input:
#!/usr/bin/env sh
# Download lists, unpack and filter, write to gzipped file
curl -s https://www.iblocklist.com/lists.php \
| grep -A 2 Bluetack \
| sed -n "s/.*value='\(http:.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#' \
| gzip - > bt_blocklist.gz
### Keybase proof
I hereby claim:
* I am flowolf on github.
* I am flowolf (https://keybase.io/flowolf) on keybase.
* I have a public key whose fingerprint is 82CB C28E 4125 ABF9 DB0C 0E07 0167 D15E 878D 8361
To claim this, I am signing this object:
@flowolf
flowolf / gist:7247585
Last active December 27, 2015 01:49
simple python solution to puddle problem found here: http://qandwhat.apps.runkite.com/i-failed-a-twitter-interview/
# Python solution to the puddle problem
# from: http://qandwhat.apps.runkite.com/i-failed-a-twitter-interview/
#
# single pass, streaming capable. O(n), memory as much as wall size.
#
def calc_vol(a):
vol = 0
count = [0]
maxi = 0
last = 0