Skip to content

Instantly share code, notes, and snippets.

View TooTallNate's full-sized avatar

Nathan Rajlich TooTallNate

View GitHub Profile
@TooTallNate
TooTallNate / gist:752646
Created December 23, 2010 06:14
"Target architecture arm is only supported on arm and ia32 host"?
[51/72] libv8.a: deps/v8/SConstruct -> build/default/libv8.a
/usr/bin/python "/Users/nrajlich/node/tools/scons/scons.py" -j 1 -C "/Users/nrajlich/node/build/default/" -Y "/Users/nrajlich/node/deps/v8" visibility=default mode=release arch=arm library=static snapshot=on
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o obj/release/accessors.o -c -Wall -W -Wno-unused-parameter -Wnon-virtual-dtor -pedantic -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -mmacosx-version-min=10.4 -fno-rtti -fno-exceptions -Wall -W -Wno-unused-parameter -Wnon-virtual-dtor -pedantic -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -mmacosx-version-min=10.4 -DV8_TARGET_ARCH_ARM -DENABLE_VMSTATE_TRACKING -DENABLE_LOGGING_AND_PROFILING -DENABLE_DEBUGGER_SUPPORT -I/Users/nrajlich/node/deps/v8/src /Users/nrajlich/node/deps/v8/src/accessors.cc
In file included from /Users/nrajlich/node/deps/v8/src/v8globals.h:31,
from /Users/
@TooTallNate
TooTallNate / example.js
Created February 10, 2011 06:30
'connect's "vhost" middleware, modified to accept a generic handler function. Works well with "stack".
var vhost = require('vhost');
var stack = require('stack');
var foo = function(req, res) {
// Do something...
}
var bar = function(req, res) {
// Do something else...
}
var http = require('http');
var Stack = require('stack');
var stack1 = Stack(
// Layers...
);
stack1.errorHandler = function(req, res, err) {
res.writeHead(404);
res.end('Not Found Custom');
}
@TooTallNate
TooTallNate / starttls.js
Created March 1, 2011 01:40
Upgrade a regular `net.Stream` connection to a secure `tls` connection.
// Target API:
//
// var s = require('net').createStream(25, 'smtp.example.com');
// s.on('connect', function() {
// require('starttls')(s, options, function() {
// if (!s.authorized) {
// s.destroy();
// return;
// }
//
@TooTallNate
TooTallNate / gist:865250
Created March 11, 2011 00:27
Cannot extend global prototypes in the REPL...
nrajlich@nathan-HP-Mini-311:~$ cat repl-fail.js
global.Object.prototype.test = true;
nrajlich@nathan-HP-Mini-311:~$ cat repl-test.js
require('./repl-fail');
console.log(typeof {}.test);
nrajlich@nathan-HP-Mini-311:~$ node repl-test.js
boolean
@TooTallNate
TooTallNate / gist:906665
Created April 6, 2011 22:19
Output of "sysctl -a hw" on my iPhone 4.
hw.ncpu: 1
hw.byteorder: 1234
hw.memsize: 527433728
hw.activecpu: 1
hw.physicalcpu: 1
hw.physicalcpu_max: 1
hw.logicalcpu: 1
hw.logicalcpu_max: 1
hw.cputype: 12
hw.cpusubtype: 9
@TooTallNate
TooTallNate / iOS-Vibrate.c
Created April 7, 2011 03:29
A "Hello World" to doing a vibration in pure C, on iOS.
// To compile:
// gcc -framework AudioToolbox iOS-Vibrate.c -o iOS-Vibrate
#include <AudioToolbox/AudioServices.h>
int main() {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
return 0;
}
@TooTallNate
TooTallNate / gist:913195
Created April 11, 2011 07:35
Trying to make a 'wscript' file that compiles a c file with one set of cxxflags, and a cpp with a different set of cxxflags...
def set_options(opt):
opt.tool_options("compiler_cxx")
def configure(conf):
conf.check_tool("compiler_cxx")
conf.check_tool("node_addon")
def build(bld):
obj = bld.new_task_gen("cxx")
@TooTallNate
TooTallNate / crc.js
Created April 28, 2011 16:53
Modbus Serial RTU CRC Algorithm
var data;
process.stdin.on('data', function(chunk) {
data = chunk
});
process.stdin.on('end', function() {
console.log(data);
var givenCrc = data.slice(data.length-2);
givenCrc = (data[1] << 7 | data[0]);
console.log(givenCrc);
From 89b1d1dbada903a97602a2c64ca9bfde1e0534af Mon Sep 17 00:00:00 2001
From: Nathan Rajlich <[email protected]>
Date: Tue, 3 May 2011 08:51:53 -0700
Subject: [PATCH] Make sure 'ARCH' get's defined with the CMake build system.
---
cmake/configure.cmake | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/cmake/configure.cmake b/cmake/configure.cmake