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
| # Python/Twisted/Redis backed DNS server - resolves from NAME to IP addrs | |
| # fallback to google or any other DNS server to resolv domains not present on Redis | |
| # to set a new domain on redis, just issue a SET domain.tld ip_addr | |
| # run with twistd -ny txredns.tac | |
| # gleicon 2011 | |
| from twisted.names import dns, server, client, cache | |
| from twisted.application import service, internet | |
| from twisted.internet import defer | |
| from twisted.python import log |
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 mongoose = require('mongoose'); | |
| var db = mongoose.connect("mongodb://localhost/testdb"); | |
| var reconnTimer = null; | |
| function tryReconnect() { | |
| reconnTimer = null; | |
| console.log("try to connect: %d", mongoose.connection.readyState); | |
| db = mongoose.connect("mongodb://localhost/testdb"); | |
| } |
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
| // Two ways to serve transparent GIF | |
| var buf = new Buffer([ | |
| 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, | |
| 0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x2c, | |
| 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, | |
| 0x02, 0x44, 0x01, 0x00, 0x3b]); | |
| res.send(buf, { 'Content-Type': 'image/gif' }, 200); |
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
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
NewerOlder