Skip to content

Instantly share code, notes, and snippets.

View 13steinj's full-sized avatar
⚒️
Compiling!

13steinj

⚒️
Compiling!
View GitHub Profile
import os, datetime
import praw, Oauth2Util
import sqlite3
USERNAME = ""
SUBREDDIT = ""
try:
import botconfig
@13steinj
13steinj / RedditRemoveAll.py
Last active August 29, 2015 14:27
Reddit bot for mods who want to remove all comments in removed threads
import praw
import OAuth2Util
# Your username. Not the username of the bot
USERNAME = ""
SUBREDDIT = ""
# Post limit chooses how far to look back in /about/spam
# Comment limit chooses the max amount of MoreComments to
# load if they aren't originally loaded in the post
@13steinj
13steinj / WTSESPB.py
Last active September 6, 2015 23:50
WowThisSubExists Self Promo Bot
import praw
import OAuth2Util
from bs4 import BeautifulSoup
import requests
import sqlite3
import time
USERAGENT = 'WowThisSubExists Self Promotion Removal by /u/13steinj in use by /u/KarmaNeutrino'
SUBREDDIT = 'WowThisSubExists'
BAD_WORDS = ['shit', 'piss', 'fuck']
def run(workbookname, usernamecolletter=None, subreddit=None, badwords=[], notifyme=False, runbackgroundcheck=True, useragent=None, username=None, password=None):
"""
Main instance
The user that is OAuthed or LoginAuthed must be an approved contributor to the sub to post apps
and must be an approved submitter to the sub. Just making it a mod won't work.
:param usernamecolletter: the letter of the column that denotes the applicant's username.
def main(username, password, limit=None):
"""redditsaver
Usage: in a cmd/terminal, type python3 or py -3 depending on your OS
in the folder that you want stuff to be saved into, and place this file there too.
you must install praw beforehand (pip3 install praw)
then type "import redditsaver" without qoutes.
then type "redditsaver.main('your username', 'yourpass')" without the double qoutes
then wait, and you are done.
"""
@13steinj
13steinj / updateredditheaders.py
Created January 27, 2016 16:34
Update's reddit's headers to the current year
import os
from datetime import datetime
skipped_endings = ['.so', '.pyc', '.ico', '.png', '.jpg', '.jpeg', '.gif', '.o']
skipped_files = [
'r2/r2/public/static/inbound-email-policy.html' # when this file gets run through, something happens to it's endings, I don't know legal validity stuff.
]
current_year_digits = int(str(datetime.now().year)[2:])
file_list = []
for walker in os.walk('reddit'):
if walker[2]:
import OAuth2Util
import praw
import re
import sqlite3
from time import sleep
DBFILE = 'xkcdlinker.db'
NUMBERS_RE = re.compile('\d+')
SUBREDDIT = 'xkcd'
RUN_LIMIT = 10
@13steinj
13steinj / The Big List of Reddit PRs.md
Last active February 7, 2016 02:31
A big list of prs I've made to reddit

This list will be updated as time goes on, as there are pull requests to still be made, to still be finished, and to still be thought of and done.

Request PR Status Summary
Personal #1398 Accepted Removes the obsolete brick from /submit
Personal #1403 Accepted Fixes issue with displaying the automod config on the sidebox
Bug Report #1408 Accepted Corrects a markdown bug in gold messages
Personal #1411 Accepted Doesn't allow mods to block their own subreddits
[Mods](https://redd
@13steinj
13steinj / switch.py
Created March 12, 2016 20:43
Python switches - because im tired of plainly using dictionaries and typing all this out manually.
# if supporting Py3.0 or 3.1
# from six import callable
class switch_non_break_return_code(object):
def __init__(self, val):
self.val = val
class switch(object):
def __init__(self, default=None, **cases):
self.cases = cases
@13steinj
13steinj / commentscraper.py
Last active March 19, 2016 20:22
the thing for the guy that ppmeed me
import praw
from praw.helpers import flatten_tree
import six
if six.PY2:
input = raw_input
r = praw.Reddit("Submission comments scraper")
r.login(disable_warning=True)
lim = 1500 if r.user.is_gold else 500