This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def piechart(data, labels=None, colors=None, size='600x400'): | |
'''Accepts a list to graph. Optionally accepts labels and colors. Both optional arguments | |
must have the same len as the data.''' | |
baseurl = 'https://chart.googleapis.com/chart?cht=p' | |
chs = 'chs={}'.format(size) | |
chd = 'chd=t:{}'.format(','.join([str(i) for i in data])) | |
chds = 'chds=0,{}'.format(sum(data)) | |
if labels: | |
chl = 'chl={}'.format('|'.join( | |
['{}: {}'.format(y, data[x]) for x,y in enumerate(labels)])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python3 | |
import json, signal, sys, time | |
import urllib.request | |
from urllib.parse import urlencode | |
import http.cookiejar | |
def sigint_handler(signal, frame): | |
'''Handles ^c''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin env python3 | |
import json | |
import urllib.request | |
import time | |
import sys | |
import signal | |
from urllib.parse import urlencode | |
import http.cookiejar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin env python3 | |
import re | |
import json | |
import os | |
import sys | |
import time | |
import signal | |
import urllib.request | |
opener = urllib.request.build_opener() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin env python3 | |
import json | |
import urllib.request | |
import time | |
import sys | |
import signal | |
from urllib.parse import urlencode | |
import http.cookiejar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# | |
# moderator-bot.py | |
# | |
# Copyright 2012 Zach McCullough <nosrepa@gmail.com> | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib.request | |
import time | |
from urllib.parse import urlencode | |
import http.cookiejar | |
def _isVideo(submission): | |
'''Returns video author name if this is a video''' | |
if 'media' in submission: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python3 | |
import json | |
import urllib.request | |
import time | |
import re | |
import signal | |
import sys | |
from urllib.parse import urlencode | |
import http.cookiejar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Adapted from http://www.creativetux.com/2012/11/streaming-to-twitchtv-with-linux.html | |
# | |
# Make sure to put your twitch.tv key in a file called "key" in the current directory. | |
# | |
# Before running, make sure PulseAudio is set up with the correct loopback modules | |
# and a null sink named "mix". You can use something ilke the following commands: | |
# | |
# pactl load-module module-null-sink sink_name=mix |
OlderNewer