As configured in my dotfiles.
start new:
tmux
start new with session name:
| # MAC manipulators | |
| alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`' | |
| alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE' |
| class Person (db.Document): | |
| name = db.StringField(required=True) | |
| created_date = db.ComplexDateTimeField(default=datetime.datetime.utcnow(), required=True) | |
| def to_dict(self): | |
| return helper.mongo_to_dict(self,[]) | |
| #helper.py | |
| def mongo_to_dict(obj, exclude_fields): |
| #!/bin/sh | |
| # $Id: xvfb-run 2027 2004-11-16 14:54:16Z branden $ | |
| # This script starts an instance of Xvfb, the "fake" X server, runs a command | |
| # with that server available, and kills the X server when done. The return | |
| # value of the command becomes the return value of this script, except in cases | |
| # where this script encounters an error. | |
| # | |
| # If anyone is using this to build a Debian package, make sure the package |
| # Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed. | |
| # We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies. | |
| # Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module | |
| # | |
| # Deployment structure | |
| # | |
| # SERVER: | |
| # /etc/init.d/nginx (1. nginx) | |
| # /home/app/public_html/app_production/current (Capistrano directory) | |
| # |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| # 0 is too far from ` ;) | |
| set -g base-index 1 | |
| # Automatically set window title | |
| set-window-option -g automatic-rename on | |
| set-option -g set-titles on | |
| #set -g default-terminal screen-256color | |
| set -g status-keys vi | |
| set -g history-limit 10000 |
| // relevant dropbox threads: | |
| // - http://forums.dropbox.com/topic.php?id=28728&replies=12#post- | |
| // - http://forums.dropbox.com/topic.php?id=31832 | |
| // code depends on spazcore.titanium.js (found in Tweetanium) | |
| // SIMPLE WORKING EXAMPLE | |
| var oa = new SpazOAuth("https://api.dropbox.com/", {"consumerKey": DROPBOX_KEY, "consumerSecret": DROPBOX_SECRET}); | |
| oa.setAccessToken(ACCESS_TOKEN, ACCESS_SECRET); |
| module RedisHelper | |
| # decode Redis value back to Ruby object | |
| def self.decode(json) | |
| self.new(ActiveSupport::JSON.decode(json)["#{self.name.downcase}"]) | |
| end | |
| # encode Ruby object for Redis | |
| def encoded | |
| self.updated_at = nil | |
| self.to_json |
| [unix_http_server] | |
| file=/tmp/supervisor.sock ; path to your socket file | |
| [supervisord] | |
| logfile=/var/log/supervisord/supervisord.log ; supervisord log file | |
| logfile_maxbytes=50MB ; maximum size of logfile before rotation | |
| logfile_backups=10 ; number of backed up logfiles | |
| loglevel=error ; info, debug, warn, trace | |
| pidfile=/var/run/supervisord.pid ; pidfile location | |
| nodaemon=false ; run supervisord as a daemon |
| # note - you may need to split into a before-deploy (stop) and after-deploy (start) depending on your setup | |
| desc "Hot-reload God configuration for the Resque worker" | |
| deploy.task :reload_god_config do | |
| sudo "god stop resque" | |
| sudo "god load #{File.join deploy_to, 'current', 'config', 'resque.god'}" | |
| sudo "god start resque" | |
| end | |
| after 'deploy:update_code', 'deploy:update_shared_symlinks' |