This file contains hidden or 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 urllib2 import urlopen | |
import simplejson as json | |
class Reddit: | |
def __init__(self): | |
self.url = 'http://www.reddit.com/user/%s/about.json' | |
def karma(self, phrase): | |
user = sys.argv[1] | |
raw = urlopen(self.url % phrase).read() | |
data = json.loads(raw)['data'] |
This file contains hidden or 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
# Total of aliases known # | |
num_aliases = 0 | |
# If True, Pyborg don't saves the dictionary and configuration on disk # | |
no_save = 'False' | |
# Total word contexts # | |
num_contexts = 22 | |
# Words that can be ignored for the answer # | |
ignore_list = ['!.', '?.', "'", ',', ';'] | |
# max limits in the number of words known # | |
max_words = 6000 |
This file contains hidden or 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 time | |
daynum=int(time.strftime('%j')) | |
year=int(time.strftime('%y')) | |
composite=(year*365)+daynum | |
def ordinal(n): | |
if 10 <= n % 100 < 20: | |
return str(n) + 'th' | |
else: | |
return str(n) + {1 : 'st', 2 : 'nd', 3 : 'rd'}.get(n % 10, "th") | |
#thanks http://stackoverflow.com/questions/739241/python-date-ordinal-output/739301#739301 |
This file contains hidden or 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 time | |
daynum=int(time.strftime('%j')) | |
year=int(time.strftime('%y')) | |
composite=(year*365)+daynum | |
# def ordinal(num): | |
# ldig = num % 10 | |
# l2dig = ldig % 10 | |
# if l2dig == 1: | |
# suffix = 'th' | |
# elif ldig == 1: |
This file contains hidden or 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
if e.eventtype() == "pubmsg": | |
for x in self.channels[target].users(): | |
body = body.replace(x, "#nick") | |
print body |
This file contains hidden or 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 pygooglechart import Chart | |
from pygooglechart import SimpleLineChart | |
from pygooglechart import Axis | |
from subprocess import * | |
import platform | |
max_y = 2000 | |
# Chart size of 200x125 pixels and specifying the range for the Y axis | |
chart = SimpleLineChart(200, 125, y_range=[0, max_y]) | |
# grep khash ~/.bitcoin/debug.log |
This file contains hidden or 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 | |
# -*- coding: utf-8 -*- | |
from pygooglechart import Chart | |
from pygooglechart import SimpleLineChart | |
from pygooglechart import Axis | |
from subprocess import * | |
import platform | |
import os | |
max_y = 2000 |
This file contains hidden or 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 BeautifulSoup import BeautifulSoup | |
import re | |
import urllib2 | |
import urllib | |
import cookielib | |
def grab(user, passwd): | |
values = {'user' : user, 'passwd' : passwd} | |
url = 'http://www.reddit.com/login?dest=/prefs/friends/' | |
data = urllib.urlencode(values) | |
req = urllib2.Request(url, data) |
This file contains hidden or 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 BeautifulSoup import BeautifulSoup | |
import re | |
import urllib2 | |
import urllib | |
import cookielib | |
def grab(user, passwd): | |
values = {'user' : user, 'passwd' : passwd, 'dest' : "/prefs/friends/"} | |
url = 'http://www.reddit.com/post/login' | |
data = urllib.urlencode(values) | |
req = urllib2.Request(url, data) |
This file contains hidden or 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
#!/bin/bash | |
# | |
# azilink for OS X | |
# based on http://pastie.org/405289 but works with Tunnelblick only | |
# (no need to install a separate copy of OpenVPN2 from macports | |
# or building from source by hand, thankfully) | |
# Requires: | |
# - azilink running on android phone (http://code.google.com/p/azilink/) | |
# (run the app and check the box to start the service). | |
# - adb on system path (comes with the Android SDK; |