This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > require('mongodb') | |
| { BinaryParser: | |
| { [Function: BinaryParser] | |
| warn: [Function: warn], | |
| decodeFloat: [Function: decodeFloat], | |
| decodeInt: [Function: decodeInt], | |
| encodeFloat: [Function: encodeFloat], | |
| encodeInt: [Function: encodeInt], | |
| toSmall: [Function], | |
| fromSmall: [Function], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var someRegexes = { | |
| email: /^([^0-9\.\+])([\w.\+])+\@(([\w\-])+\.)+[a-zA-Z0-9]{2,}/, | |
| domain: /^(http:\/\/)([\w]+\.){1,}[A-Z]{2,}\b/gi, | |
| creditcard: /^[0-9]{16}$/gi, | |
| ccspecial: /^[0-9]{12}$/gi, | |
| cvv: /^[0-9]{3,4}$/gi, | |
| phone: /^[0-9]{10}$/gi, | |
| postcode: /^[0-9]{4}$/gi, | |
| numeric: /^[0-9]+$/gi, | |
| alphanumeric: /^[0-9a-f\-\s]+$/gi, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express'); | |
| var app = module.exports = express.createServer(); | |
| app.configure(function(){ | |
| app.use(app.router); | |
| }).listen(83000); | |
| var ganes = { "piedra":"tijera", "papel":"piedra", "tijera": "papel"}, | |
| keys = []; | |
| for (var prop in ganes) { | |
| if (ganes.hasOwnProperty(prop)) { | |
| keys.push(prop); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| process.on('uncaughtException', function(excp) { | |
| console.log(excp.message); | |
| console.info(excp.stack); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| › node server.js | |
| The "sys" module is now called "util". It should have a similar interface. | |
| node.js:201 | |
| throw e; // process.nextTick error, or 'error' event on first tick | |
| ^ | |
| TypeError: object is not a function | |
| at EventEmitter.CALL_NON_FUNCTION (native) | |
| at Object.<anonymous> (/home/rex/Projects/foilr/lib/server.js:10:3) | |
| at Object.<anonymous> (/home/rex/Projects/foilr/lib/server.js:11:4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var util = require("util"); | |
| var inherits = function (inherits, fn) { | |
| util.inherits(fn, inherits); | |
| return fn; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| lib-cov | |
| *.seed | |
| *.log | |
| *.csv | |
| *.dat | |
| *.out | |
| *.pid | |
| *.gz | |
| pids |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!--[if lt IE 7 ]> | |
| <script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script> | |
| <script>CFInstall.check();</script> | |
| <![endif]--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| echo "deb http://toolbelt.herokuapp.com/ubuntu ./" > /etc/apt/sources.list.d/heroku.list | |
| apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 | |
| wget -q -O - http://toolbelt.herokuapp.com/apt/release.key | apt-key add - | |
| apt-get update | |
| # install stuff to build node | |
| apt-get install git-core build-essential libssl-dev python libssl-dev curl heroku-toolbelt |