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
@adammw
adammw / mingw32-node-configure
Created July 3, 2011 15:18 — forked from TooTallNate/iphone4.2-node-configure
Runs "configure"/"make" for Node.js, with the intent of cross-compiling Node for Windows 32 using mingw32
#! /bin/bash
#
# Program : mingw32-node-configure
# Authors : Nathan Rajlich (nathan@tootallnate.net)
# Michael Aaron Safyan (michaelsafyan@gmail.com)
# Adam Malcontenti-Wilson (adman.com@gmail.com)
# Synopsis : This program runs the "configure" script for Node.js.
# An install prefix of "/usr/i586-mingw32msvc" is assumed.
@adammw
adammw / Readme.md
Created July 3, 2011 19:23
Compile Node.js v0.4 for Windows (32-bit) using Ubuntu 11.04 (x86_64)

HOWTO: Compile Node.js v0.4 for Windows (32-bit) using Ubuntu 11.04 (x86_64)

  1. Install mingw32 compilation tools

    sudo apt-get install mingw32

  2. Download and extract latest pthreads-win32 (pthreads-w32-2---release.tar.gz)

wget -o - ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz | tar xfz

@adammw
adammw / omegle_chat.js
Created August 4, 2011 16:56
Omegle Command Prompt Chat Client written in Node.JS
/*
* Omegle Command Prompt Chat Client
* =================================
* Version 1.0 by adammw111
* Requires Node.JS
*/
var net = require('net');
var OMEGLE_HOST = 'cardassia.omegle.com';
var OMEGLE_PORT = 1365;
@adammw
adammw / redirtest.js
Created August 11, 2011 07:54
IE9 302 Redirect Caching Test
#!/usr/bin/env node
var http = require('http');
var state = 1;
http.createServer(function(req, res) {
if (req.url == '/redirme') res.writeHead(302, {'Location':'/redir' + state});
if (req.url == '/cacheme') res.writeHead(302, {'Location':'/redir' + state, 'Cache-Control': 'max-age=120'});
if (req.url == '/changestate') state++;
@adammw
adammw / gist:1153658
Created August 18, 2011 08:31
pretty cool macros to work out how much space we need (in chars) for a binary number using sizeof
#define BASE2DIGITS_TO_BASE10DIGITS(a) (unsigned)((a * 2.40823997) + 1)
#define NUMDIGITS(type) BASE2DIGITS_TO_BASE10DIGITS(sizeof(type))
#define UINTBUFFERSIZE (NUMDIGITS(unsigned int) + 2)
#!/usr/bin/env python
import xml.dom.minidom
import feedparser
import re
import subprocess
import sys
import os
import urllib2
PLAYLIST_ID = sys.argv[1]
var http = require('http'),
net = require('net'),
url = require('url'),
util = require('util');
var server = http.createServer();
server.listen(8080);
server.on('request', function(request, response) {
console.log(request);
try {
@adammw
adammw / cursesclock.py
Created October 4, 2011 12:10
Command-Line Clock
import curses
import time
ch = ord("#")
symbols = {
'0': [(0,0),(0,1),(0,2),(0,3),(1,0),(2,0),(3,0),(4,0),(4,1),(4,2),(4,3),(3,3),(2,3),(1,3)],
'1': [(1,1),(0,2),(1,2),(2,2),(3,2),(4,2),(4,1),(4,3)],
'2': [(1,0),(0,1),(0,2),(1,3),(2,2),(3,1),(4,0),(4,1),(4,2),(4,3)],
'3': [(0,0),(0,1),(0,2),(1,3),(2,1),(2,2),(2,3),(3,3),(4,0),(4,1),(4,2)],
'4': [(0,0),(1,0),(2,0),(2,1),(2,2),(2,3),(0,3),(1,3),(3,3),(4,3)],
'5': [(0,3),(0,2),(0,1),(0,0),(1,0),(2,0),(2,1),(2,2),(3,3),(4,2),(4,1),(4,0)],
#!/usr/bin/env node
var net = require('net'),
spawn = require('child_process').spawn;
var server = net.createServer(function(socket) {
socket.write("Connected to <insert program here> Server\r\n");
var proc = spawn("<insert program here>");
socket.pipe(proc.stdin);
proc.stdout.pipe(socket);
proc.on('end', function() {
socket.end();
@adammw
adammw / download.js
Created November 27, 2011 14:29
SoundCloud CLI Downloader
/*
* CLI Tool to download streamable songs from SoundCloud API
* Requires Node.js, Flow-JS and cli libraries
*/
var cli = require('cli').enable('status'),
fs = require('fs'),
flow = require('flow'),
path = require('path'),
SC = require('./node-soundcloud.js');