Skip to content

Instantly share code, notes, and snippets.

<message from='[email protected]'
to='[email protected]'
xml:lang='en'>
<body>Art thou not Romeo, and a Montague?</body>
</message>
@alexstrat
alexstrat / IterativeFindV2
Created January 4, 2012 20:11
Iterative find process for Kademlia (v2)
# in this algorithm, all notions of *sorting*, *close* or *distance*
# are relative to the XOR distance with the target ID
# as defined in the Kademlia spec
- iterative find (target ID) ->
# initializations
HeardOf <- XOR Sorted Array of peers
initialized with the 50 (or less) closest peers we know from the our routing table
Reached <- XOR Sorted Array of peers
Queried <- Array of peers
/* gcc -o bruteforce1 bruteforce1.c */
#include <stdlib.h>
#define BUFFER_LEN 301
#define OVERFLOW 8
int main()
{
/*
char shellcode[] = "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07"
<body xmlns="http://jabber.org/protocol/httpbind">
<iq from="[email protected]/9107" id="gV" to="[email protected]/kadoh" type="result" xmlns="jabber:client">
<query xmlns="jabber:iq:rpc">
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>nodes</name>
/*
* Classic example grammar, which recognizes simple arithmetic expressions like
* "2*(3+4)". The parser generated from this grammar then computes their value.
*/
start
= additive
additive
= left:multiplicative tail:(additive_op multiplicative)* { return tail.reduce(function(n,t){return t[0](n,t[1])},left); }
@alexstrat
alexstrat / index.js
Created April 26, 2012 13:31
proxy-server
httpProxy = require('http-proxy');
httpProxy.createServer({
router: {
//UI
'kadoh.fr.nf' : '127.0.0.1:8080',
//bosh
'bosh.kadoh.fr.nf' : '127.0.0.1:5280',
@alexstrat
alexstrat / iterative-mapreduce.js
Created May 15, 2012 13:59
Iterative map/reduce
var Deferred = require('./deferred');
var IterativeMapReduce = module.exports = Deferred.extend({
initialize: function() {
this.supr();
this._mapOnFly;
//default finish function
this.finish_function = function(end_value, reducer_result) {
this.resolve(reducer_result);
@alexstrat
alexstrat / gist:2731224
Created May 19, 2012 15:26
Wiki example
Deferred = require('./util/deferred');
var linked_list = function(key) {
return {
value : key*key,
nextKey : (key <10) ? (key)+1 : false
};
};
var GetNext = Deferred.extend({
var StateEventEmitter = require('./util/state-eventemitter'),
Deferred = require('./util/deferred'),
Crypto = require('./util/crypto'),
PeerArray = require('./util/peerarray'),
XORSortedPeerArray = require('./util/xorsorted-peerarray'),
IterativeDeferred = require('./util/iterative-deferred'),
globals = require('./globals.js'),
RoutingTable = require('./dht/routing-table'),
var util = require('util');
var events = require('events');
var io = require('socket.io-client');
function Socket(type, listener, host, io_options) {
events.EventEmitter.call(this);
if (typeof listener === 'function')
this.on('message', listener);