Skip to content

Instantly share code, notes, and snippets.

View gobengo's full-sized avatar

Benjamin Goering gobengo

View GitHub Profile
@gobengo
gobengo / index.html
Created December 12, 2011 19:03 — forked from ninowalker/server.py
A simple web server in two (three) steps
<html>
<head></head>
<body>
<p>Hello, world!</p>
</body>
</html>
@gobengo
gobengo / node-gchat.js
Created January 22, 2011 06:17
node.js-driven Google Chat bot
var xmpp = require('node-xmpp'),
secret = require('./secret'),
util = require('util');
var creds = {
jid: 'bengoering@gmail.com',
password: secret.pw, //string
};
var GChat = function(creds) {
@gobengo
gobengo / GraphMatrix
Created January 21, 2011 06:20
Check it out
Imagine graph G with vertexes A, B, C (sketch this if that's your thing). G has the following directed edges:
A->B
B->C
C->A
Basically this is a triangle with a loop. Now, let's say we model this with a binary matrix. Edge A->B means that G[A][B]=1. Similarly: G[B][C], G[C][A] = 1, 1. Think about this 2D array as a matrix G1:
ABC
A010
B001
C100
>>> class X:
... pass
...
>>> @classmethod
... def mysum(cls, x, y):
... return x + y
...
>>> X.setattr('s', mysum)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>