Skip to content

Instantly share code, notes, and snippets.

View jwerle's full-sized avatar
🔨
Working on @socketsupply/socket

Joseph Werle jwerle

🔨
Working on @socketsupply/socket
View GitHub Profile
var queue = [];
function enqueue (work) {
queue.push(work);
}
function dequeue () {
for (var i = 0; i < queue.length; ++i) void function (work, i) {
work(
function (isDone) {
@jwerle
jwerle / output
Created September 2, 2014 22:34
leaks in setenv - OSX
werle:~/tmp
× cc setenvbug.c -o setenvbug
werle:~/tmp
√ valgrind --leak-check=yes --track-origins=yes --dsymutil=yes setenvbug
==37306== Memcheck, a memory error detector
==37306== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==37306== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==37306== Command: setenvbug
==37306==
werle:~/repos/libuv-http ☀ master
√ make
git clone --depth 1 https://chromium.googlesource.com/external/gyp.git ./deps/gyp
Cloning into './deps/gyp'...
remote: Counting objects: 1631, done
remote: Finding sources: 100% (1631/1631)
remote: Total 1631 (delta 332), reused 980 (delta 332)
Receiving objects: 100% (1631/1631), 813.68 KiB | 0 bytes/s, done.
Resolving deltas: 100% (332/332), done.
Checking connectivity... done.
files.items
.filter(function (file) {
// search parents array looking for atleast once
// parent that has the id you are looking for
return file.parents.some(function (parent) {
return PARENT_ID_YOU_CARE_ABOUT == parent.id
});
})
.forEach(function (file) {
// do stuff with each file after filtering here...
curl -s https://ws.spotify.com/search/1/track.json?q=portugal+the+man | bpkg json -b | grep tracks | grep href | grep spotify:track | awk '{print $2}' | tr -d '"' | tr -d 'spotify:track:'
#!/bin/bash
HOST="$1"
PORT="$2"
umq recv ${PORT} &
while read -r buf; do
nmap "${HOST}" -p "${PORT}" --open 2>/dev/null | \
awk '/scan report for/ {$1=$2=$3=$4=""; print $0}' | \
tr -d ' ' | {
while read -r host; do
import foo from A; // - this just declares the identifier `foo'
console.log(foo); // undefined - (but doesn't throw ?)
console.log(A.foo); // [Function: foo] - (maybe this is available due to the `import' statement)
console.log(B.bar); // [Function: bar] - (I guess not, there is no need for an `import' statement for the `B' module?)
/**
* The following will throw:
*
#define X(n) \
if (isset($opts[ # n ])) { \
self::$ n = $opts[ # n]; \
}
function s (fn, args) {
var code = null;
var f = null;
args = args.map(function (a) {
return 'function' == typeof a ? a.toString() : a;
});
args = JSON.stringify(args);
code = '(' + fn.toString() +').apply(null,'+ args + ')';
f = new Function(code);
function b (fn) {
var str = fn.toString();
var buf = "";
var ch = 0;
var len = str.length;
var i = 0;
var inBody = false;
while (len--) {
ch = str[i++];