Skip to content

Instantly share code, notes, and snippets.

View alessioalex's full-sized avatar

Alexandru Vlăduţu alessioalex

View GitHub Profile
// http://www.ietf.org/rfc/rfc1928.txt
// Tested with: curl http://www.google.se/ --socks5 1080 --proxy-user foo:bar
var States = {
CONNECTED:0,
VERIFYING:1,
READY:2,
PROXY: 3
};
@alessioalex
alessioalex / x.md
Created January 20, 2013 07:08 — forked from Raynos/x.md

DOM Libraries, the easy way

  • [by. Select elements][1]
  • [fragment. Turn HTML into DOMFragments][2]
  • [class-list. Cross browser HTML5 classList implementation][3]
  • [dom-walk. Traverse the DOM in tree order][4]
  • [xhr. Minimal cross browser, cross domain XHR][5]
  • [insert. Cross browser DOM4 insertion methods][6]
  • [to-array. Convert nodelists into arrays][7]
  • [hidden. Cross browser HTML5 hidden property][8]
@alessioalex
alessioalex / hipchat_bot.js
Created November 10, 2012 13:27 — forked from powdahound/hipchat_bot.js
Basic XMPP bot example for HipChat using node.js
// Basic XMPP bot example for HipChat using node.js
// To use:
// 1. Set config variables
// 2. Run `node hipchat_bot.js`
// 3. Send a message like "!weather 94085" in the room with the bot
var request = require('request'); // github.com/mikeal/request
var sys = require('sys');
var util = require('util');
@alessioalex
alessioalex / client.js
Created August 15, 2012 09:41
viewDidResize
function ZmgcClient() {
var personPath = "m 1.4194515,-160.64247 c 33.5874165,0 60.8159465,-25.97005 60.8159465,-58.00952 0,-32.0404 -27.22755,-58.0114 -60.8159465,-58.0114 -33.5883965,0 -60.8159415,25.971 -60.8159415,58.0114 0,32.0404 27.228527,58.00952 60.8159415,58.00952 z m 81.9575765,26.25762 C 70.531608,-146.64352 55.269688,-153.983 0.08110256,-153.983 c -55.19742156,0 -70.08915856,7.96609 -82.28062656,19.59815 -12.197359,11.62926 -8.081167,135.7024419 -8.081167,135.7024419 L -63.292733,-59.848397 -46.325227,122.37766 2.6291765,29.116913 48.308878,122.37766 64.467298,-59.848397 91.457218,1.3175919 c 0,-8e-4 4.76917,-123.4484419 -8.08019,-135.7024419 z";
if (! (this instanceof arguments.callee)) {
return new arguments.callee(arguments);
}
var self = this;
this.init = function() {
self.setupBayeuxHandlers();
if ($('#viz').length > 0) {
@alessioalex
alessioalex / gist:3306787
Created August 9, 2012 18:24 — forked from fxsjy/gist:3291755
Memcached in JavaScript based on Node.JS
//author: Sun, Junyi (weibo.com/treapdb)
//usage: node --nouse-idle-notification --expose-gc --max-old-space-size=8192 memcached.js
var config ={
port: 11211,
max_memory: 100 // default 100M bytes
}
var net = require('net');
var LRU = function (max) { // this LRU implementaion is based on https://github.com/chriso/lru
@alessioalex
alessioalex / .gitignore
Created April 7, 2012 15:58 — forked from bergie/.gitignore
Node.js email handling examples
config.json
reading-image.png
@alessioalex
alessioalex / sendfile.js
Created March 13, 2012 17:49 — forked from pgriess/sendfile.js
Using sendfile(2) with NodeJS
var assert = require('assert');
var net = require('net');
var open = process.binding('fs').open;
var sendfile = process.binding('fs').sendfile;
if (process.argv.length < 4) {
console.error('usage: sendfile <port> <path>');
process.exit(1);
}
@alessioalex
alessioalex / stackoverflow_monitor.py
Created January 18, 2012 16:50 — forked from qiao/stackoverflow_monitor.py
Monitor for new questions on StackOverflow
#!/usr/bin/env python
# Monitor for new questions on StackOverflow
# Author: Xueqiao Xu <[email protected]>
import time
import json
import gzip
import pprint
import urllib
import urllib2
@alessioalex
alessioalex / command.sh
Created October 29, 2011 19:42 — forked from felixge/command.sh
Bash stuff for fighting a weak DOS attack
# Here a few bash one-liners that helped me analyze / fight a weak DOS attack against debuggable.com. Mostly for future reference.
# The attacker was opening lots of tcp connections without sending data, I believe it's called a SYN flood, see: http://tools.ietf.org/html/rfc4987#section-3.2
# Step 0: Check what is going on at port 80
$ netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c
# Step 1: Increase the number of available fds
$ ulimit -n 32000
# Step 2: Restart your webserver, for me:
@alessioalex
alessioalex / routes.js
Created October 15, 2011 15:01 — forked from tj/routes.js
Express routes
var app = require('../app');
console.log();
app.routes.all().forEach(function(route){
console.log(' \033[90m%s \033[36m%s\033[0m', route.method.toUpperCase(), route.path);
});
console.log();
process.exit();