This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/switch_json.c b/src/switch_json.c | |
index 3819cda..3b7a603 100644 | |
--- a/src/switch_json.c | |
+++ b/src/switch_json.c | |
@@ -220,7 +220,7 @@ static char *print_string_ptr(const char *str) | |
const char *ptr;char *ptr2,*out;int len=0;unsigned char token; | |
if (!str) return cJSON_strdup(""); | |
- ptr=str;while ((token=*ptr) && ++len) {if (strchr("\"\\\b\f\n\r\t",token)) len++; else if (token<32) len+=5;ptr++;} | |
+ ptr=str;while ((token=*ptr) && ++len) {if (strchr("\"\\\b\f\n\r\t%",token)) len++; else if (token<32) len+=5;ptr++;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
count@narbuckle:~$ bash --version | |
GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu) | |
Copyright (C) 2005 Free Software Foundation, Inc. | |
count@narbuckle:~$ foo=(1 2 3 4 5); unset foo[4]; echo ${foo[@]}; unset foo[3]; echo ${foo[@]}; unset foo[2]; echo ${foo[@]}; | |
1 2 3 4 | |
1 2 3 | |
1 2 | |
dolszewski@blackheat:~$ bash --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $1 != "-f" ]]; then | |
echo "### Dry-run mode, specify -f to actually perform deletes."; | |
fi; | |
for branch in $(git branch -r --merged origin/master | grep '\<origin/' | grep -v '\<origin/master\>'); | |
do | |
if [[ -z $(git rev-list $branch --since '1 month') ]]; then | |
name=$(echo $branch | sed 's/^origin\///'); | |
if [[ $1 = "-f" ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
opts=$(git rev-parse --no-revs "$@" 2>/dev/null) | |
rev=$(git rev-parse --revs-only "$@" 2>/dev/null) | |
branch=$(git name-rev --name-only ${rev:-HEAD}) | |
upstream=$(git name-rev --name-only --refs 'refs/remotes/*' --no-always $branch@{u} 2>/dev/null) | |
git log $(git rev-parse --not --remotes --branches | grep -v $(git rev-parse $branch) | grep -v ${upstream:-XXX}) $branch $opts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -wle ' | |
use JSON::XS; | |
use Data::Dumper; | |
my $json = JSON::XS->new(); | |
$json->utf8(1); | |
print Dumper(wtf(q(["abc"]))); | |
print Dumper(wtf(undef)); | |
sub wtf { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs.readFile('/proc/meminfo', 'utf8', function (err, str) { | |
var fields = {}; | |
str.split('\n').forEach(function (line) { | |
var parts = line.split(':'); | |
if (parts.length === 2) { | |
fields[parts[0]] = parts[1].trim().split(' ', 1)[0]; | |
} | |
}); | |
cb(fields['MemTotal'] + fields['Buffers'] + fields['Cached']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// == test code == | |
var redis = require('redis'); | |
var domain = require('domain'); | |
var c = redis.createClient(); | |
for (var n = 0; n < 10; n++) { | |
var d = domain.create(); | |
d.on('error', function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
function one(cb) { | |
console.log("one"); | |
cb(); | |
} | |
function two(cb) { | |
function three(callback){ | |
var a = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/switch.c b/src/switch.c | |
index f86b080..71abcd8 100644 | |
--- a/src/switch.c | |
+++ b/src/switch.c | |
@@ -415,7 +415,7 @@ int main(int argc, char *argv[]) | |
char *local_argv[1024] = { 0 }; | |
int local_argc = argc; | |
char *arg_argv[128] = { 0 }; | |
- int alt_dirs = 0, log_set = 0, run_set = 0, do_kill = 0; | |
+ int alt_dirs = 0, alt_base = 0, log_set = 0, run_set = 0, do_kill = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/repl.js b/lib/repl.js | |
index ba334cf..1191e9f 100644 | |
--- a/lib/repl.js | |
+++ b/lib/repl.js | |
@@ -113,7 +113,12 @@ function REPLServer(prompt, stream, eval_, useGlobal, ignoreUndefined) { | |
} catch (e) { | |
err = e; | |
} | |
- cb(err, result); | |
+ if (err && process.domain) { |