Skip to content

Instantly share code, notes, and snippets.

View skerit's full-sized avatar

Jelle De Loecker skerit

View GitHub Profile
@skerit
skerit / gist:5216766
Created March 21, 2013 21:09
"Inject" something into a function's scope (NOT context) This is just a proof-of-concept. Because it uses eval() on every execution you get a 99% performance hit.
Function.prototype.compel = function(scope, args, scope_args) {
var code = '';
// Every scope_args entry will be added to this code
for (var name in scope_args) {
code += 'var ' + name + ' = scope_args["' + name + '"];';
}
// eval the code, so these variables are available in this scope
@skerit
skerit / binary-plist.js
Created November 1, 2015 10:13 — forked from clee/binary-plist.js
initial binary plist implementation in nodejs
#!/usr/bin/env node
var fs = require('fs');
var sys = require('sys');
var bin = require('binary');
function bytesize(n) {
// JavaScript can't handle 64-bit ints natively.
// TODO: hack it up anyway.
// (n & 0xFFFFFFFF00000000) ? 8 : ...
@skerit
skerit / send_syn.js
Created March 15, 2018 20:18 — forked from zachary822/send_syn.js
Send TCP SYN with node.js and raw-socket package
/**
* Sending a TCP SYN packet properly using the raw-socket package.
*/
var raw = require('raw-socket');
var crypto = require('crypto');
// create a raw socket using TCP
var s = raw.createSocket({
protocol: raw.Protocol.TCP
});
@skerit
skerit / json_patch.js
Created March 23, 2023 12:24
JSONPatch.js implementation for AlchemyMVC
const PatchApplyError = Error,
InvalidPatch = Error;
/**
* The JSONPatch class:
* Used to generate a JSON patch between two objects
*
* @constructor
*
* @author Jelle De Loecker <[email protected]>