Skip to content

Instantly share code, notes, and snippets.

@atiw003
atiw003 / gist:2999089
Created June 26, 2012 21:14 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@atiw003
atiw003 / gist:2999087
Created June 26, 2012 21:14 — forked from msluyter/gist:1925069
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@atiw003
atiw003 / gunicorn vs bjoern
Created June 24, 2012 12:51 — forked from yashh/gunicorn vs bjoern
Benchmark a flask hello world app
apt-get install python-setuptools python-pip
pip install Flask gunicorn
ab -n 5000 -c 50 http://ec2-50-16-28-212.compute-1.amazonaws.com/
worker = 1
Concurrency Level: 50
Time taken for tests: 53.365 seconds
@atiw003
atiw003 / fabfile.py
Created June 9, 2012 13:21 — forked from cyberdelia/fabfile.py
Fabric deploy script with : south migrations, rollback and maintenance page.
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }
@atiw003
atiw003 / postfix-config-aws-ses.txt
Created June 9, 2012 11:53 — forked from zapnap/postfix-config-aws-ses.txt
postfix config for AWS-SES
# /etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
@atiw003
atiw003 / yaml_ordered_dict.py
Created June 9, 2012 09:46 — forked from enaeseth/yaml_ordered_dict.py
Load YAML mappings as ordered dictionaries
import yaml
import yaml.constructor
try:
# included in standard lib from Python 2.7
from collections import OrderedDict
except ImportError:
# try importing the backported drop-in replacement
# it's available on PyPI
from ordereddict import OrderedDict
@atiw003
atiw003 / latency.txt
Created June 1, 2012 08:18 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 1 MB sequentially from memory 250,000 ns 0.25 ms
Round trip within same datacenter 500,000 ns 0.5 ms
Read 1 MB sequentially from SSD 1,000,000 ns 1 ms 4X memory
@atiw003
atiw003 / postfix-config-aws-ses.txt
Created May 29, 2012 10:48 — forked from zapnap/postfix-config-aws-ses.txt
postfix config for AWS-SES
# /etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
@atiw003
atiw003 / ses_test.py
Created May 24, 2012 09:48 — forked from batok/ses_test.py
A test of ses "AWS" service from python using boot
"""
do ...
pip install boto, turbomail
echo "just a test" > README.txt
... first
"""
import sys
from boto import connect_ses
FROM = "foo@acme.com"
TO = "bar@acme.com"
@atiw003
atiw003 / deps.pp
Created May 20, 2012 13:39 — forked from rcrowley/deps.pp
Deploying Django with Puppet
stage { "pre": before => Stage["main"] }
class python {
package {
"build-essential": ensure => latest;
"python": ensure => "2.6.6-2ubuntu1";
"python-dev": ensure => "2.6.6-2ubuntu1";
"python-setuptools": ensure => "latest";
}
exec { "easy_install pip":
path => "/usr/local/bin:/usr/bin:/bin",