This is the reference point. All the other options are based off this.
|-- app
| |-- controllers
| | |-- admin
| 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 |
| // 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); |
| 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"); | |
| } |
| # 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 is a short collection of tools that are useful for managing your | |
| # known_hosts file. In this case, I'm using the '-f' flag to specify the | |
| # global known_hosts file because I'll be adding many deploy users on this | |
| # system. Simply omit the -f flag to operate on ~/.ssh/known_hosts | |
| # Add entry for host | |
| ssh-keyscan -H github.com >> /etc/ssh/ssh_known_hosts | |
| # Scan known hosts | |
| ssh-keygen -f /etc/ssh/ssh_known_hosts -F github.com |
| sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev | |
| git clone https://github.com/joyent/node.git | |
| cd node | |
| # 'git tag' shows all available versions: select the latest stable. | |
| git checkout enter-a-version | |
| # Configure seems not to find libssl by default so we give it an explicit pointer. | |
| # Optionally: you can isolate node by adding --prefix=/opt/node |
| #!/bin/bash | |
| mkdir /tmp/curl-ca-bundle | |
| cd /tmp/curl-ca-bundle | |
| wget http://curl.haxx.se/download/curl-7.22.0.tar.bz2 | |
| tar xzf curl-7.22.0.tar.bz2 | |
| cd curl-7.22.0/lib/ | |
| ./mk-ca-bundle.pl | |
| if [ ! -d /usr/share/curl/ ]; then | |
| sudo mkdir -p /usr/share/curl/ | |
| else |
| int pins[] = {3, 5, 6, 9, 10, 11}; | |
| int cpins = 6; | |
| int val; | |
| void setup() { | |
| Serial.begin(9600); | |
| } | |
| void loop() { | |
| if (Serial.available() >= cpins) { |
| EMAIL_HOST = 'smtp.yandex.ru' | |
| EMAIL_HOST_USER = '[email protected]' | |
| EMAIL_HOST_PASSWORD = 'password' | |
| EMAIL_PORT = 587 | |
| EMAIL_USE_TLS = True |