start new:
tmux
start new with session name:
tmux new -s myname
| # http://unfoldthat.com/2012/06/02/quick-deploy-chef-solo-fabric.html | |
| from fabric.api import settings, run, sudo, reboot, put, cd, env | |
| AWS_ACCESS_KEY = '...' | |
| AWS_SECRET_KEY = '...' | |
| AWS_KEYPAIR_NAME = '...' | |
| AWS_SECURITY_GROUPS = ['default'] |
| # MySQL. Versions 4.1 and 5.0 are recommended. | |
| # | |
| # Install the MySQL driver: | |
| # gem install mysql2 | |
| # | |
| # And be sure to use new-style password hashing: | |
| # http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
| development: | |
| adapter: mysql2 | |
| encoding: utf8 |
| # unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
| rails_env = ENV['RAILS_ENV'] || 'production' | |
| # 16 workers and 1 master | |
| worker_processes (rails_env == 'production' ? 16 : 4) | |
| # Load rails+github.git into the master before forking workers | |
| # for super-fast worker spawn times | |
| preload_app true |
| namespace :grape do | |
| desc 'Print compiled grape routes' | |
| task :routes => :environment do | |
| API.routes.each do |route| | |
| puts route | |
| end | |
| end | |
| end |
| var collectionNames = db.getCollectionNames(); | |
| collectionNames.forEach(function(n) { print(n + ": " + db[n].count()); }); |
| LOADING=false | |
| usage() | |
| { | |
| cat << EOF | |
| usage: $0 [options] <DBNAME> | |
| OPTIONS: | |
| -h Show this help. | |
| -l Load instead of export |
| -module(date_util). | |
| -compile(export_all). | |
| epoch() -> | |
| now_to_seconds(now()) | |
| . | |
| epoch_hires() -> | |
| now_to_seconds_hires(now()) | |
| . |
| sysctl -w fs.file-max=12000500 | |
| sysctl -w fs.nr_open=20000500 | |
| ulimit -n 4000000 | |
| sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000' | |
| sysctl -w net.ipv4.tcp_rmem='1024 4096 16384' | |
| sysctl -w net.ipv4.tcp_wmem='1024 4096 16384' | |
| sysctl -w net.core.rmem_max=16384 | |
| sysctl -w net.core.wmem_max=16384 | |
| wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb | |
| sudo dpkg -i erlang-solutions_1.0_all.deb |
With Node you can write very fast JavaScript programs serverside. It's pretty easy to install Node, code your program, and run it. But > how do you make it run nicely in the background like a true server?
/etc/init/$ sudo vim yourapp.conf$ sudo start yourapp$ sudo stop yourapp