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 random | |
number_to_guess=0 | |
number_of_guesses=0 | |
def new_game(): | |
global number_to_guess, number_of_guesses | |
user_response=raw_input("Start a new game? Y/N > ") | |
if user_response.lower() in ["no","n"]: | |
print "Bye!" |
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
# -*- coding: utf-8 -*- | |
import praw | |
flair_dict = {"male_old_css_class": {"class": "male_new_css_class", | |
"text": u"♂"}, | |
"female_old_css_class": {"class": "female_new_css_class", | |
"text": u"♀"}, } | |
flair_mapping = [] |
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 hashlib | |
valid_types=[ 'md5', 'sha1', 'ripemd160', 'sha224', 'sha256', 'sha384', 'sha512'] | |
hash_type=None | |
while hash_type!="exit": | |
hash_type=raw_input("Enter hash type -- valid are: {}\n>>>".format( | |
', '.join(valid_types))).lower() | |
if hash_type in valid_types: | |
hashed=hashlib.new(hash_type) |
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 urllib2 | |
from random import randint | |
req = urllib2.Request("http://www.reddit.com/comments/1oa44z.json",None, {'User-Agent': "wub_wub's script",}) | |
json_response=json.loads(urllib2.urlopen(req).read()) | |
all_comments=json_response[1]["data"]["children"] | |
valid_comments={} | |
winners=0 | |
given_games=[] | |
for comment in all_comments: |
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 sqlite3 | |
import time | |
import json | |
import urllib2 | |
def get_submissions(): | |
url="http://www.reddit.com/r/all/new/.json" #URL of the page that we want to fetch | |
headers = { 'User-Agent' : 'fetching new submissions script' } # our script "identifier" | |
req = urllib2.Request(url, None, headers) # We create new request here to open the url with above set headers | |
data = urllib2.urlopen(req).read() # Open url and make data variable equal whatever we get |
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
removed_counter=0 | |
for x in range(0,len(to_update),100): | |
items=to_update[x:x+100] | |
items_url=api_by_id.format(",".join(items)) | |
request_time=time() | |
print "[FILTERING] Starting request...",request_time | |
# print "Request url", items_url | |
try: | |
r=requests.get(items_url, headers=headers, timeout=20) | |
except: |
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
from time import time, sleep | |
import requests | |
import logging | |
import json | |
# submission dict layout initial idea | |
# {"id": { | |
# time:{ #unix timestamp, str |
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 sys | |
import sqlite3 | |
import datetime | |
#TO-DO: | |
#Fix a few user options...I think like 1-3 or something. | |
# | |
conn = sqlite3.connect('moviedb.db') | |
c = conn.cursor() | |
class Movie(object): |
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 python | |
import sys | |
import json | |
import time | |
import urllib | |
import httplib2 | |
from urllib import urlencode | |
from urlparse import urlparse, urlunparse, parse_qs |
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
from plugin import CommandPlugin | |
class test(CommandPlugin): | |
self.add_commands({"test":self.test()}) | |
def test(self, user, channel, parameters): | |
print "executing test command" | |
self.bot.msg(channel, "Test") |