Skip to content

Instantly share code, notes, and snippets.


Nathan Rajlich TooTallNate

View GitHub Profile
TooTallNate / sync.js
Last active Aug 29, 2015
`npm owner` syncing tool. Invoke like: gnode sync.js tootallnate rauchg coreh
View sync.js
var exec = require('child_process').exec;
var suspend = require('suspend');
var resume = suspend.resume;*(){
// first determine the list of npm usernames to sync up to
var npmUsers = process.argv.slice(2);
TooTallNate / windows-path.js
Created Mar 13, 2014
Get Window's `path` node core module implementation, even on Unix
View windows-path.js
var vm = require('vm');
var pathCode = process.binding('natives').path;
var sandbox = {
process: {
env: process.env,
cwd: process.cwd,
platform: 'win32'
require: require,
TooTallNate / example.html
Last active Aug 29, 2015
wpcom.js example
View example.html
<script src="wpcom.js"></script>
// create a client WPCOM instance
var wpcom = WPCOM();
// retrieve a listing of the most recent
// 5 posts on ""
.postsList({ number: 5 }, function(err, data) {
TooTallNate / test.c
Last active Aug 29, 2015
dlfcn load printf from the current process
View test.c
/* Compile:
* Unix/OSX: gcc -o test test.c -ldl
* Windows via dlfcn-win32: cl.exe /I dlfcn-win32 dlfcn-win32\dlfcn.c test.c /Fetest.exe
#include <dlfcn.h>
#include <stdio.h>
int main () {
void *handle, *symbol;
View learn.js
var utility = ffi.Library('utility', {
'tesJson': ['void', ['string']]
var obj = {'1': 'one', '2': 'two'};
TooTallNate / tsc-single-file.js
Created Jul 16, 2014
TypeScript single-file compiler
View tsc-single-file.js
* TypeScript single-file compiler:
* $ node tsc-single-file.js < input.ts > output.js
* Avoids TypeScript attempting to compile an entire "project",
* so that a proper `make` target can be written.
TooTallNate / index.js
Last active Aug 29, 2015
requirebin sketch
View index.js
var domPaste = require('dom-paste');
var input = document.createElement('div');
input.contentEditable = 'true';'300px';'100px';'solid 1px black';
View wcwidth.js
wcwidth.js: JavaScript Portng of Markus Kuhn's wcwidth() Implementation
Copyright (C) 2012 by Jun Woong.
This package is a JavaScript porting of `wcwidth()` implementation
[by Markus Kuhn](
Permission is hereby granted, free of charge, to any person obtaining a copy of
View hello.cgi
#!/usr/bin/perl -w
my $file = "logo.png";
my $length = -s $file;
print "Content-type: image/png\n";
print "Content-length: $length \n\n";
binmode STDOUT;
open (FH,'<', $file) || die "Could not open $file: $!";
my $buffer = "";
while (read(FH, $buffer, 10240)) {
print $buffer;
TooTallNate / mpi.js
Created Jun 11, 2015
MPI and node-ffi
View mpi.js
var ref = require('ref');
var Struct = require('ref-struct');
var ffi = require('ffi');
// typedefs
var MPI_Datatype = 'int';
var MPI_Comm = 'int';
var MPI_Status = Struct({
count: 'int',
MPI_SOURCE: 'int',