Skip to content

Instantly share code, notes, and snippets.

*** simplechat_orig.js 2009-12-10 17:20:47.000000000 -0500
--- chatevents.js 2009-12-10 17:20:26.000000000 -0500
***************
*** 1,6 ****
--- 1,8 ----
var tcp = require("tcp");
var sys = require("sys");
+ var chatEmitter = new process.EventEmitter();
+
var tcp = require("tcp");
var sys = require("sys");
var chatEmitter = new process.EventEmitter();
Array.prototype.remove = function(e) {
for(var i = 0; i < this.length; i++)
if(e == this[i]) this.splice(i, 1);
}
diff --git a/http-state.js b/http-state.js
index 476cc4a..71755d6 100644
--- a/http-state.js
+++ b/http-state.js
@@ -20,7 +20,7 @@ var idgen = require('./idgen');
res.set_cookie("session_id", session_id);
}
sessions[session_id] = (sessions[session_id] || {
- session: {},
+ session: {session_id:session_id},
#bash function to retrieve the last 5 tweets from a user
#based on the Chirp hackathon project by @jf and @jazzychad
#hattip @gypak
last5tweets ()
{
dig +short TXT `dig +short TXT $1.timeline.twitter.viadns.org | tr -d \"` | tr -d \"
}
#usage:
curl -vvv -ujazzychad -d"status=testing%20annotations%20again&annotations=[{\"typefoo\":{\"keyfoo\":\"valfoo\"}}]" http://api.twitter.com/1/statuses/update.xml
@jazzychad
jazzychad / gist:1727711
Created February 3, 2012 04:11
ELO implementation for PicAFight
# ELO implementation for PicAFight
# using ELO formula from http://en.wikipedia.org/wiki/Elo_rating_system#Mathematical_details and a K value of 32
# all contestants start with ELO rating of 1500
ra = pic1.elo
rb = pic2.elo
qa = 10**((ra + 0.0)/400.0) + 0.0
qb = 10**((rb + 0.0)/400.0) + 0.0
[\[\e[0;33m\]\!\[\e[0m\]] `if [ \$? = 0 ]; then echo \[\e[0m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi` [\[\e[0;34\]m\u\[\e[0m\]@\[\e[0;36m\]\h\[\e[0m\]:\[\e[0;37m\]\W\[\e[0m\]]$(git branch &>/dev/null; if [ $? -eq 0 ]; then echo "\[\e[01;33m\]($(git branch | grep ^*|sed s/\*\ //))\[\e[00m\]"; fi)\[\e[0;31m\]\\$\[\e[0m\]
@jazzychad
jazzychad / gist:3281354
Created August 7, 2012 03:55
App.net/Twitter crosspost hack

Many are wondering how I am crossposting from Twitter to app.net. It is a dirty hack. Or more correctly, a dirty crack.

I found a session cookie security hole on app.net, and I am exploiting it to post to my app.net timeline from outside the website. This is also how I ran datebot.

Out of respect for dalton and crew, I am not making this exploit public (they say it will be plugged soon anyway).

If you are ambitious, you can find it as well. It took about 10 minutes for me to find.

Here's a hint, start by inspecting the Networking calls in a webkit inspector when you make a post.

@jazzychad
jazzychad / gist:3605389
Created September 2, 2012 22:53
TunesPost for app.net

Introducing TunesPost by @jazzychad

Post your currently playing songs to app.net!

As a weekend hack project, I have created a little app for Mac OS 10.6+ that runs up in the status bar and listens to your music along with you. If you use iTunes, Spotify, or Rdio on your Mac, TunesPost will know what is currently playing.

tpost1

tpost2

@jazzychad
jazzychad / gist:3625870
Created September 4, 2012 20:10
SpotCast for Spotify

Introducing SpotCast by @jazzychad

"It's like Turntable.fm for Spotify!"

DJ your Spotify or listen to other users' stations!

As a weekend hack project, I have created a little app for Mac OS 10.6+ that runs up in the status bar and listens to other users' songs and what they are playing. You can "Listen With..." another person and your Spotify will automatically play what they are playing. It's like listening to a radio station DJ'd by your friend!

1