Skip to content

Instantly share code, notes, and snippets.

View adammw's full-sized avatar
👨‍💻
Hacking on Kubernetes Platform @ Zendesk

Adam Malcontenti-Wilson adammw

👨‍💻
Hacking on Kubernetes Platform @ Zendesk
View GitHub Profile
var dgram = require('dgram');
var config = {
1194: 'openvpn.example.com:1194',
1195: 'anothervpn.example.com:1194'
};
var listenSockets = {};
var natTable = {};
Object.keys(config).forEach(function(port) {
var forwardHost = config[port].split(':')[0];

Spotify "Hacks"

For the web player, https://play.spotify.com

The following information was obtained by reverse engineering the web player, it's not an offical API so things could change or break at any time.


Accessing the private Spotify.Core instance:

var fs = require('fs');
var crypto = require('crypto');
var stream = require('stream');
var util = require('util');
var encryptedDataStream = fs.createReadStream('encrypted.smil');
function HexDecoder() {
if(!(this instanceof HexDecoder))
return new HexDecoder;
Testing if input device is a keyboard "/dev/input/event0"
Keyboard found: "/dev/input/event0"
Board revision is 16
Executing "/usr/sbin/parted --script /dev/mmcblk0 resize 1 8192s 123M"
parted done, output: "WARNING: you are attempting to use /usr/sbin/parted to operate on (resize) a file system.
/usr/sbin/parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs. We recommend
you use /usr/sbin/parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release.
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
@adammw
adammw / facebook-anonymiser.js
Last active August 29, 2015 14:06
Remove names from Facebook posts and comments allow them to be screenshotted and posted to internet forums without exposing user identities.
(function() {
var hash = {};
var anonymise = function() {
// Handle links to user profiles, e.g. those shown when someone likes a post
Array.prototype.forEach.call(document.querySelectorAll('[data-hovercard*="user.php"], [data-hovercard*="hovercard.php"]'), function(hovercardLink) {
if (!hovercardLink.dataset.hovercard) return;
var id = /id=(\d+)/.exec(hovercardLink.dataset.hovercard)[1];
var hue = hash[id] = hash[id] || (Math.random() * 360);
hovercardLink.style.background = 'hsl(' + hue + ',55%,60%)';
.ghx-issue {
padding-left: 22px !important;
padding-bottom: 0 !important;
}
.ghx-band-2 .ghx-issue-fields {
margin-top: -2px !important;
}
.ghx-issue-fields .ghx-type {
left: 5px !important;
top: 4px;