Skip to content

Instantly share code, notes, and snippets.

Avatar
🍙

Stephen Wan stephen

🍙
View GitHub Profile
View rtp.js
this.baseServer.on('message', function(msg) {
var meta = msg.slice(0, 12);
var sequenceNumber = meta.slice(2, 4).readUInt16BE(0);
var encryptedAudio = msg.slice(12);
var decryptedAudio = new Buffer(0);
for (var i = 0; i < encryptedAudio.length; i += 16) {
View alac.log
00000000 47 45 54 20 2f 6c 69 73 74 65 6e 20 48 54 54 50 GET /lis ten HTTP
00000010 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 31 37 32 2e /1.1..Ho st: 172.
00000020 31 37 2e 31 30 36 2e 36 34 3a 38 30 30 30 0d 0a 17.106.6 4:8000..
00000030 41 63 63 65 70 74 2d 4c 61 6e 67 75 61 67 65 3a Accept-L anguage:
00000040 20 65 6e 2d 75 73 0d 0a 58 2d 50 6c 61 79 62 61 en-us.. X-Playba
00000050 63 6b 2d 53 65 73 73 69 6f 6e 2d 49 64 3a 20 41 ck-Sessi on-Id: A
00000060 36 33 41 37 36 31 44 2d 37 33 38 45 2d 34 42 38 63A761D- 738E-4B8
00000070 37 2d 41 44 30 33 2d 33 32 42 35 36 44 31 34 43 7-AD03-3 2B56D14C
00000080 45 36 39 0d 0a 69 63 79 2d 6d 65 74 61 64 61 74 E69..icy -metadat
00000090 61 3a 20 31 0d 0a 41 63 63 65 70 74 3a 20 2a 2f a: 1..Ac cept: */
View airsonos.log
GET /listen HTTP/1.1
Host: 172.17.106.64:8000
Accept-Language: en-us
X-Playback-Session-Id: 2E989289-87D5-4609-9DA1-7F7BEDC37D92
icy-metadata: 1
Accept: */*
User-Agent: AppleCoreMedia/1.0.0.14A389 (Macintosh; U; Intel Mac OS X 10_10; en_us)
Referer: http://localhost:8000/listen.m3u
Accept-Encoding: identity
Connection: keep-alive
@stephen
stephen / unwrapUrl.js
Last active Aug 29, 2015
unwraps a url from shorteners. assumes request is available.
View unwrapUrl.js
var unwrapUrl = function(input, callback) {
var options = {};
if (typeof(input) === 'string') {
options.url = input;
} else if (typeof(input) === 'object') {
options = input;
}
options._attempts = options._attempts || 0;
options.maxAttempts = options.maxAttempts || 5;
View gist:26dc09ad95407d9f9ae0
[ '323691386-sjtjekAATMeZAmRyASlFTuXwAYpJZLeWQZoQS1iW',
'TMVfFcX0r1OjQf9i2xrisdn1CH7OeVyvi5x6oodiT1YbH',
{ user_id: '323691386', screen_name: 'stephencwan' } ]
[gulp] [nodemon] clean exit - waiting for changes before restart
View totp.py
import time;
import hmac;
import hashlib;
import os;
import math;
import base64;
import struct;
def get_hotp(secret, counter):
# get and decode shared secret
@stephen
stephen / gist:5def6c44cac8caa82692
Created May 19, 2014
4 letter twitter handles available
View gist:5def6c44cac8caa82692
testing 456976 handles
ZKYL
XETY
WFLW
VEMR
SESL
PEEP
NWZY
ILSB
@stephen
stephen / handles
Last active Aug 29, 2015
Twitter handles available from /usr/share/dict/words
View handles
testing 254164 handles
zythem
zymotoxic
zymotize
zymotically
zymotechnic
zymotechny
zymotechnical
zymosterol
zymosimeter
@stephen
stephen / Dump.xml
Last active Aug 29, 2015
Sonos event output (zone topology)
View Dump.xml
<?xml version="1.0"?>
<e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0">
<e:property>
<ZoneGroupState>&lt;ZoneGroups&gt;&lt;ZoneGroup Coordinator="RINCON_000E581CD93201400" ID="RINCON_000E581CD93201400:0"&gt;&lt;ZoneGroupMember UUID="RINCON_000E581CD93201400" Location="http://192.168.1.119:1400/xml/device_description.xml" ZoneName="BRIDGE" Icon="x-rincon-roomicon:viper" Configuration="1" Invisible="1" IsZoneBridge="1" SoftwareVersion="26.1-76230" MinCompatibleVersion="24.0-00000" LegacyCompatibleVersion="24.0-0000" BootSeq="25"/&gt;&lt;/ZoneGroup&gt;&lt;ZoneGroup Coordinator="RINCON_000E58F3878001400" ID="RINCON_000E58F3878001400:9"&gt;&lt;ZoneGroupMember UUID="RINCON_B8E9375433D201400" Location="http://192.168.1.120:1400/xml/device_description.xml" ZoneName="Portable" Icon="x-rincon-roomicon:living" Configuration="1" SoftwareVersion="26.1-76230" MinCompatibleVersion="24.0-00000" LegacyCompatibleVersion="24.0-0000" BootSeq="36"/&gt;&lt;ZoneGroupMember UUID="RINCON_000E58F3878001400" Location
@stephen
stephen / eventTester.js
Created May 11, 2014
node-sonos eventing framework
View eventTester.js
var Sonos = require('../index').Sonos;
var Listener = require('../lib/events/listener');
var x = new Listener(new Sonos(process.env.SONOS_HOST || '192.168.2.11'));
x.listen('/ZoneGroupTopology/Event', function(err, sid) {
console.log(sid);
});