Skip to content

Instantly share code, notes, and snippets.

@Pita
Pita / .jshintrc
Last active December 10, 2015 23:38 — forked from polotek/.jshintrc
{
// turn on to ENABLE warnings
"bitwise": false
, "curly": true
, "eqeqeq": false
, "forin": false
, "immed": true
, "latedef": false
, "newcap": true
, "noarg": true
@Pita
Pita / bot.js
Created April 17, 2012 10:34
Gumtreebot
var request = require("request");
var parser = require("xml2json");
var db = require("dirty")("db.db");
var nodemailer = require("nodemailer");
var transport = nodemailer.createTransport("Sendmail");
db.on('load', function() {
request('http://www.gumtree.com/rssfeed/single-room-flatshare/shoreditch', function (err, response, body) {
if(err){
throw err;
@Pita
Pita / youtube.js
Created March 3, 2012 16:50
Daily bandwith limited youtube proxy
var net = require("net");
require("log4js");
var trafficLeft = 0;
var monthlyTraffic = 13 * 1024 * 1024 * 1024; //13GB
var targetHost = "www.youtube.com";
var connectionCounter = 0;
function forwardOnPort(port){
var server = net.createServer(function(inCon){
//File uploads
app.post('/upload', function(req, res)
{
new formidable.IncomingForm().parse(req, function(err, fields, files)
{
//handle errors
if(err){
res.send("Error");
fileLogger.error(err);
return;
@Pita
Pita / v8hash.c
Created January 4, 2012 12:04
v8 hash collision brute force
#include <stdio.h>
#include <string.h>
int v8hash(char *str, int length){
int hash = 0, i=0;
for(;i<length;i++){
hash += str[i];
hash += (hash << 10);
hash ^= (hash >> 6);
wget -c -r -np -e robots=off -A mp4,sha1 http://mirror.fem-net.de/CCC/28C3/mp4-h264-HQ/ && sha1sum -c mirror.fem-net.de/CCC/28C3/mp4-h264-HQ*.sha1
@Pita
Pita / errortest.js
Created December 3, 2011 22:29
Async Stacktrace
/*
$ node errortest.js
/home/pita/Desktop/errortest.js:46
throw err;
^
Async Stacktrace:
at /home/pita/Desktop/errortest.js:56:9
at /home/pita/Desktop/errortest.js:66:8
at /home/pita/Desktop/errortest.js:77:8
@Pita
Pita / gist:1090736
Created July 18, 2011 21:42
minify without gzip
/**
* This Module manages all /minified/* requests. It controls the
* minification && compression of Javascript and CSS.
*/
/*
* 2011 Peter 'Pita' Martischka
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@Pita
Pita / mysql_bug.js
Created May 1, 2011 23:39
Reproduce the MySQL Driver Bug
var mysql = require("mysql");
var async = require("async");
var db;
async.waterfall([
//connect
function(callback)
{
db = new mysql.Client();