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 urllib | |
from google.appengine.api import urlfetch | |
# Set this to the specific Google Analytics Tracking Id for your application. | |
GA_TRACKING_ID = "UA-XXXX-Y" | |
GA_CLIENT_ID = "555" | |
def track_event_to_ga(category, action, label=None, value=None): | |
""" Posts an Event Tracking message to Google Analytics. """ | |
form_fields = { |
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
/* | |
NxN Tic Tac Toe win tracker | |
Assumptions | |
- User inputted moves are legal | |
- player X and player O don't both enter the same row/col as their move | |
- player X doesn't enter the same row/col twice | |
*/ | |
package main |
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
''' | |
webscrape.py - Python module to allow scraping data off of a website. | |
About: put the about here! | |
@author: Jason Dsouza | |
''' | |
__author__ = ('jasonrdsouza (Jason Dsouza)') |
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
def getchar(): | |
#Returns a single character from standard input | |
import tty, termios, sys | |
fd = sys.stdin.fileno() | |
old_settings = termios.tcgetattr(fd) | |
try: | |
tty.setraw(sys.stdin.fileno()) | |
ch = sys.stdin.read(1) | |
finally: | |
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) |
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 email, getpass, imaplib, os | |
detach_dir = '.' # directory where to save attachments (default: current) | |
user = raw_input("Enter your GMail username:") | |
pwd = getpass.getpass("Enter your password: ") | |
# connecting to the gmail imap server | |
m = imaplib.IMAP4_SSL("imap.gmail.com") | |
m.login(user,pwd) | |
m.select("cs2043") # here you a can choose a mail box like INBOX instead |
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
r"""Simple module for quick document manipulation from the gedit Python console | |
Example: | |
import doc | |
d = doc.Doc(window) | |
d.set_lines( ['one', 'two', 'three'] ) | |
d.append('\n') | |
d.append('four') | |
lines = d.get_lines() | |
lines.reverse() |
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/python | |
class tokenizerState: | |
START = 0 #start and outside of token state | |
BRACE = 1 #inside brace token state | |
BRACE_END = 2 | |
QUOTE = 3 #inside of quote token state | |
QUOTE_END = 4 | |
CHAR = 5 #inside of char token state |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using MongoDB.Bson; | |
using MongoDB.Bson.IO; | |
using MongoDB.Driver; | |
using MongoDB.Driver.Builders; | |
namespace Tester |
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
function printShardingInfo(configDB, verbose) { | |
if (configDB === undefined) { | |
configDB = db.getSisterDB("config"); | |
} | |
var version = configDB.getCollection("version").findOne(); | |
if (version == null) { | |
print("not a shard db!"); | |
return; | |
} | |
var raw = ""; |
NewerOlder