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 socket | |
sock = socket.socket(socket.AF_INET, socket.TCP_NODELAY) | |
sock.connect(('irc.synirc.net', 6667)) | |
sock.setblocking(0) | |
def irc_connect(): | |
buff = '' | |
while 1: | |
try: |
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 math | |
import random | |
import functools | |
import sys | |
# an inefficient ga for the travelling salesman problem | |
# stuff to think about: | |
# chromosomes can't be repeated, so crossover and mutation have to be changed | |
# mutation: swap two elements | |
# crossover: use ordered crossover |
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 | |
import time | |
import sys | |
import lxml.html | |
from datetime import datetime, timedelta | |
# get viewers | |
j = json.load(urllib2.urlopen('https://api.twitch.tv/kraken/streams/speeddemosarchivesda')) |
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 ctypes, ctypes.wintypes | |
xinputDLL = ctypes.windll.xinput9_1_0 | |
class XINPUT_VIBRATE(ctypes.Structure): | |
_fields_ = [ | |
('left_motor', ctypes.wintypes.WORD), | |
('right_motor', ctypes.wintypes.WORD), | |
] |
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
class IRCStats(object): | |
def __init__(self, path): | |
self.path = path | |
try: | |
self.users = json.loads(open(self.path, 'r').read()) | |
except Exception, e: | |
self.users = {} | |
# JSON makes defaultdict weird, roll yer own | |
def add(self, nick): |
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
JSWEEKLY BINGO | |
+-------------------------------+-------------------------------+-------------------------------+ | |
| An atricle from someone who | | | | |
| just figured out | Baby's first functional | How to do this one very | | |
| prototype-based OO and thinks | programming | specific thing in Node.js | | |
| everyone else needs telling | | | | |
+-------------------------------+-------------------------------+-------------------------------+ | |
| | | | | |
| A new jQuery release | A job in San Francisco | An introduction to an MVC | | |
| | | framework | |
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 webapp2 | |
import jinja2 | |
import os | |
import random | |
import pprint | |
import math | |
from google.appengine.ext import db | |
jinja = jinja2.Environment( |
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
PFont font; | |
int drawn; | |
PVector pos, dir, plane; | |
boolean DEBUG; | |
float moveSpeed = 0.1; | |
float rotSpeed = 0.07; | |
int scale = 4; | |
final int m_WIDTH = 24; | |
final int m_HEIGHT = 24; | |
int m_map[][] = { |
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
<!DOCTYPE HTML> | |
<html lang="en" ng-app="notes"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<link rel="stylesheet" href="static/reset.css" /> | |
<style type="text/css"> | |
html, body, .content { | |
height: 100%; |
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
if(i==1) | |
return 4; | |
if(i==2) | |
return 4; | |
if(i==3) | |
return 4; | |
if(i==4) | |
return 4; | |
if(i==5) | |
return 4; |