Skip to content

Instantly share code, notes, and snippets.

@aperson
aperson / twitch.py
Created April 8, 2014 19:01
Script to stream to twitch.tv. I got this from @brownan, but I can't find it anywhere at the moment online
#!/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
@aperson
aperson / change_subreddit_mode.py
Created September 20, 2013 19:05
This script will change the mode of a subreddit. First you either need to make a file named 'credentials' that is in the same directory as the script that has your login info and subreddit or you can just replace the info in the script directly. Just invoke the script with the subreddit mode as an argument (eg: `python3 change_subreddit_mode.py …
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import praw
try:
from credentials import * #NOQA
except:
USERNAME = 'username'
@aperson
aperson / mass_ban.py
Created May 27, 2013 03:42
Quick script to ban a user from every public subreddit you moderate
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import praw
import requests
import sys
try:
from credentials import * # NOQA
except ImportError:
#!/usr/bin/env python3
from urllib.request import urlopen
import xml.etree.ElementTree as etree
import re
import json
def get_snapshot():
NS = '{http://s3.amazonaws.com/doc/2006-03-01/}'
@aperson
aperson / ban_all.py
Created October 8, 2012 20:28
Quick script to ban a user from every subreddit you moderate (use wisely!)
#!/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
@aperson
aperson / remove-ham.py
Created September 24, 2012 01:47
Quick script to remove ham from the modqueue en-mass
#/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
@aperson
aperson / sidebar_updater.py
Created September 12, 2012 23:53
Quick script made up of parts of moderator-bot that can update a subreddit's sidebar text with the status of Mojang's servers
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import re
import urllib.request
import time
from collections import defaultdict
def _isVideo(submission):
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:
@aperson
aperson / reddit_submit.py
Created July 14, 2012 23:44
Quick script to submit a url to subreddits
#!/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
@aperson
aperson / prune_bans.py
Created July 14, 2012 18:58
Script to purge bans in a subreddit
#!/usr/bin env python3
import json
import urllib.request
import time
import sys
import signal
from urllib.parse import urlencode
import http.cookiejar