Skip to content

Instantly share code, notes, and snippets.

View ncb000gt's full-sized avatar
💭
Slapping keyboard...

Nick Campbell ncb000gt

💭
Slapping keyboard...
View GitHub Profile
@ncb000gt
ncb000gt / work-hard.js
Created April 25, 2011 14:00
I swear I'm working...hard.
/*
* Goto -> http://duiker101.tk/hackertyper/
* Open a console
* Copy and paste the following
* Fullscreen your window
* ?
* Profit
*/
var eventEl = document.getElementById('console');
@ncb000gt
ncb000gt / gist:982282
Created May 20, 2011 03:15
riak-js error.
/usr/local/lib/node_modules/riak-js/lib/utils.js:84
target[k] = d.value;
^
RangeError: Maximum call stack size exceeded
@ncb000gt
ncb000gt / remove-all-riak.js
Created May 21, 2011 15:33
Remove all items from a bucket in riak with riak-js.
var db = require('riak-js').getClient({port: 8091});
console.log(process.argv);
db.keys(process.argv[2], function(err, keys) {
if (err) console.log(err);
keys.forEach(function(key) {
db.remove(process.argv[2], key, function(err) {
if (err) console.log(err);
console.log("Removed: " + key);
@ncb000gt
ncb000gt / package.json
Created August 19, 2011 14:25
NPM package.json Files
{
"name": "packagename",
"description": "A description of your project...even though you wont necessarily be putting it in NPM.",
"version": "0.0.1",
"author": "Your Name Here (http://github.com/user)",
"engines": { "node": ">= 0.4.11" },
"repository": {
"type": "git",
"url": "http://github.com/user/project.git"
},
@ncb000gt
ncb000gt / test-bcrypt.js
Created September 2, 2011 02:22
bcrypt test to find segfault?
var bcrypt = require('./bcrypt');
while (true) {
bcrypt.gen_salt(10, function(err, salt) {
console.log('salt: ' + salt);
console.log('salt cb end: ' + (Date.now() - start) + 'ms');
})
}
db.get(key, function(err, doc) {
cb(err, doc);
});
@ncb000gt
ncb000gt / valgrind.out.20111125
Created November 25, 2011 21:43
Output of running valgrind on node.bcrypt.js async code.
==4958== Memcheck, a memory error detector
==4958== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==4958== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info
==4958== Command: node examples/async_compare.js
==4958== Parent PID: 2625
==4958==
==4958== Warning: set address range perms: large range [0x29ae5ecc6000, 0x29ae7ecc6000) (noaccess)
==4958==
==4958== HEAP SUMMARY:
==4958== in use at exit: 221,773 bytes in 131 blocks
@ncb000gt
ncb000gt / rm-vim.sh
Created January 31, 2012 16:58
Remove VIM files in SVN directories.
svn status | grep -e "sw[a-z]" | tr -d "\t? " | xargs rm -f
@ncb000gt
ncb000gt / node_format.js
Created May 10, 2012 14:10
Check for string format.
var libxml = require('libxml');
module.exports.to_string = function(assert) {
var doc1_string = [
'<?xml version="1.0" encoding="UTF-8"?>',
'<root><child to="wongfoo"/></root>',
].join("\n");
var expected_string = "<child/>";
@ncb000gt
ncb000gt / binding.gyp
Created May 13, 2012 17:01
bcrypt gyp integration
{
'variables': {
'ARCH': 'x64'
},
'targets': [
{
'target_name': 'bcrypt_lib',
'include_dirs': [
'<(node_root_dir)/deps/uv/include',
'<(node_root_dir)/deps/v8/include',