Skip to content

Instantly share code, notes, and snippets.

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.responseText != undefined && xhr.responseText != "") {
var xhr2 = new XMLHttpRequest();
xhr2.onreadystatechange = function() {
switch (xhr2.readyState) {
case 0: // uninitialized
case 1: // loading
@kanzure
kanzure / test-zeropad.coffee
Last active December 17, 2015 20:09
zeropad.coffee
exports.run = ->
describe("utils.zeroPad", ->
zeroPad = utils.zeroPad
it("should have zeroPad", ->
should.exist(utils.zeroPad)
should.exist(zeroPad)
)
it("should be a function", ->
@kanzure
kanzure / vagrant-windows-cygwin-ldd.txt
Created July 31, 2013 16:40
vagrant-windows-cygwin-ldd
vagrant@vagrant-2008R2 /bin
$ ldd.exe tar.exe
ntdll.dll => /cygdrive/c/Windows/SysWOW64/ntdll.dll (0x77200000)
kernel32.dll => /cygdrive/c/Windows/syswow64/kernel32.dll (0x76740000)
KERNELBASE.dll => /cygdrive/c/Windows/syswow64/KERNELBASE.dll (0x76aa0000)
cygwin1.dll => /usr/bin/cygwin1.dll (0x61000000)
cygiconv-2.dll => /usr/bin/cygiconv-2.dll (0x6f5d0000)
cygintl-8.dll => /usr/bin/cygintl-8.dll (0x6f580000)
vagrant@vagrant-2008R2 /bin
@kanzure
kanzure / pipes.js
Created August 17, 2013 04:18
i don't know how to node
var through = require("through");
var hyperquest = require("hyperquest");
var trumpet = require("trumpet");
module.exports.download = function download(url, options) {
var output = through();
var trumpeter = trumpet();
var request = hyperquest.get(url);
trumpeter.selectAll("title", function (title) {
@kanzure
kanzure / hyperquest-trumpet-streams.js
Last active December 21, 2015 05:39
is this how you combine streams and do error handling in node?
var hyperquest = require("hyperquest");
var trumpet = require("trumpet");
var through = require("through");
var duplexer = require("duplexer");
var barrage = require("barrage");
function download(url) {
var outstream = through();
var tr = trumpet();
@kanzure
kanzure / pirateshipyard.c
Created August 21, 2013 02:20
samba4.git stuff
/**
Interpret an internet address or name into an IP address in 4 byte form.
**/
_PUBLIC_ uint32_t interpret_addr(const char *str)
{
struct hostent *hp;
uint32_t res;
if (str == NULL || *str == 0 ||
strcmp(str,"0.0.0.0") == 0) {
@kanzure
kanzure / output.txt
Created August 22, 2013 23:04
bad pip behavior
[root@bbishop_dev_121_111 ~]# pip-2.7 install wmi-client-wrapper==0.0.12
Downloading/unpacking wmi-client-wrapper==0.0.12
Running setup.py egg_info for package wmi-client-wrapper
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.gitignore' found anywhere in distribution
warning: no previously-included files matching '.DS_Store' found anywhere in distribution
Requested wmi-client-wrapper==0.0.12, but installing version 0.0.11
Requirement already satisfied (use --upgrade to upgrade): mock in /usr/lib/python2.7/site-packages (from wmi-client-wrapper==0.0.12)
Requirement already satisfied (use --upgrade to upgrade): sh in /usr/lib/python2.7/site-packages (from wmi-client-wrapper==0.0.12)
@kanzure
kanzure / pokecrystal-itemfragment-error.txt
Created August 29, 2013 17:03
pokecrystal error about ItemFragment (branch refactor-preprocessor)
Traceback (most recent call last):
File "prequeue.py", line 16, in <module>
preprocessor.preprocess(preprocessor.macros)
File "/tmp/pokecrystal5/preprocessor.py", line 42, in preprocess
return preprocessor.preprocess(macros)
File "/tmp/pokecrystal5/extras/pokemontools/preprocessor.py", line 616, in preprocess
read_line(l, skippable_macros, macro_table)
File "/tmp/pokecrystal5/extras/pokemontools/preprocessor.py", line 592, in read_line
macro_translator(macro, token, asm, skippable_macros)
File "/tmp/pokecrystal5/extras/pokemontools/preprocessor.py", line 518, in macro_translator
@kanzure
kanzure / constants.diff
Created September 1, 2013 06:38
pokered constants.tx good/bad
diff constants.good.tx constants.bad.tx
6a7
> GLOBAL FuncCoord
13a15
> GLOBAL EVENT_DISP
18a21
> GLOBAL FLYWARP_DATA
25a29
> GLOBAL EMAP
35a40
@kanzure
kanzure / shellcoderunner.py
Created September 12, 2013 15:44
pyinstaller win32 shellcode runner
#!/usr/bin/python
##############################################################
# PyInstaller Win32 shellcode runner - by @mihi42
#
# Needed software:
# * Python 2.7.2 from
# <http://www.python.org/download/releases/>
# * PyWin32 build 217 for Python 2.7 from
# <http://sourceforge.net/projects/pywin32/files/pywin32/>