As configured in my dotfiles.
start new:
tmux
start new with session name:
require 'selenium-webdriver' | |
# | |
# Read more about LoadableComponent here: | |
# | |
# http://code.google.com/p/selenium/wiki/LoadableComponent | |
# | |
class LoadableComponent | |
attr_reader :driver |
#!/usr/bin/env ruby | |
# 1. Install hunspell | |
# $ brew install hunspell | |
# 2. Download a dictionary and install it in a path listed by `hunspell -D` | |
# $ open http://wiki.services.openoffice.org/wiki/Dictionaries | |
# 3. Move this file into your repository | |
# $ mv commit-msg /path/to/repo/.git/hooks |
As configured in my dotfiles.
start new:
tmux
start new with session name:
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
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 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
""" | |
Two things are wrong with Django's default `SECRET_KEY` system: | |
1. It is not random but pseudo-random | |
2. It saves and displays the SECRET_KEY in `settings.py` | |
This snippet | |
1. uses `SystemRandom()` instead to generate a random key | |
2. saves a local `secret.txt` |
import base64 | |
import os | |
import mimetypes | |
from django.core.files.uploadedfile import SimpleUploadedFile | |
from tastypie import fields | |
class Base64FileField(fields.FileField): | |
""" | |
A django-tastypie field for handling file-uploads through raw post data. |
rpm -Uvh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm | |
yum install postgresql93 postgresql93-server postgresql93-contrib postgresql93-devel postgis2_93 postgis2_93-utils | |
#Configure PostgreSQL | |
chkconfig postgresql-9.3 on | |
service postgresql-9.3 initdb | |
service postgresql-9.3 start | |
# Create PostGIS template |
import base64 | |
import os | |
import mimetypes | |
from django.core.files.uploadedfile import SimpleUploadedFile | |
from tastypie import fields | |
class Base64FileField(fields.FileField): | |
""" | |
A django-tastypie field for handling file-uploads through raw post data. |
Windows Registry Editor Version 5.00 | |
; Registry file that maps the solarized palette to the 16 avaliable colors | |
; in a Windows command prompt. Note, hex values in the table are RGB but byte | |
; ordering of a DWORD is BGR, e.g. "ColorTable<##>"=dword:00<B><G><R> | |
; | |
; Solarized color table from http://ethanschoonover.com/solarized. | |
; | |
; NR cmd.exe PowerShell SOLARIZED HEX DWORD | |
; -- ------- ----------- --------- ------- -------- |
''' | |
Created on Feb 24, 2015 | |
''' | |
import sys | |
# Recursive method to create the mathematical series | |
def pascal(col,row): | |
if(col == 0) or (col == row): | |
return 1 | |
else: |