start new:
tmux
start new with session name:
tmux new -s myname
import pymongo | |
import json | |
from pymongo import Connection | |
def connect_to_mongo(host, port, database, collection): | |
connection = Connection(host, port) | |
db = connection[database] | |
collection = db[collection] | |
return collection |
class Int | |
attr_reader :value | |
def initialize(value) | |
@value = value | |
end | |
def accept(visitor, *data) | |
visitor.visit_int(self, *data) | |
end | |
def fold(rules) | |
rules[Int].call(value) |
# 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 |
#!/usr/bin/env python2 | |
# Creates a new inhibitor | |
# While this is running the specified events will be inhibited | |
from optparse import OptionParser | |
import signal | |
import dbus | |
import sys | |
import os |
function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s } | |
function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s } | |
function trim(s) { return rtrim(ltrim(s)); } | |
BEGIN { | |
# whatever | |
} | |
{ | |
# whatever | |
} | |
END { |
import org.eclipse.jetty.server.Server; | |
import org.eclipse.jetty.servlet.ServletHandler; | |
import org.eclipse.jetty.servlets.ProxyServlet; | |
import javax.servlet.ServletConfig; | |
import javax.servlet.ServletException; | |
import javax.servlet.ServletRequest; | |
import javax.servlet.ServletResponse; | |
import java.io.IOException; |
""" | |
Tools for creating a CA cert and signed server certs. | |
Divined from http://svn.osafoundation.org/m2crypto/trunk/tests/test_x509.py | |
The mk_temporary_xxx calls return a NamedTemporaryFile with certs. | |
Usage ; | |
# Create a temporary CA cert and it's private key | |
cacert, cakey = mk_temporary_cacert() |
# Nginx can serve FLV/MP4 files by pseudo-streaming way without any specific media-server software. | |
# To do the custom build we use 2 modules: --with-http_secure_link_module --with-http_flv_module | |
# This module "secure-link" helps you to protect links from stealing away. | |
# | |
# NOTE: see more details at coderwall: http://coderwall.com/p/3hksyg | |
$ cd /usr/src | |
$ wget http://nginx.org/download/nginx-1.2.2.tar.gz | |
$ tar xzvf ./nginx-1.2.2.tar.gz && rm -f ./nginx-1.2.2.tar.gz |
Model.new.foo |