A ZSH theme optimized for people who use:
- Solarized
- Git
- Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
For Mac users, I highly recommend iTerm 2 + Solarized Dark
from multiprocessing import Pool | |
from functools import partial | |
def _pickle_method(method): | |
func_name = method.im_func.__name__ | |
obj = method.im_self | |
cls = method.im_class | |
if func_name.startswith('__') and not func_name.endswith('__'): #deal with mangled names | |
cls_name = cls.__name__.lstrip('_') | |
func_name = '_' + cls_name + func_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 |
object TestExplicitRecordType { | |
import shapeless._, record._, syntax.singleton._ | |
object testF extends Poly1 { | |
implicit def atFieldType[F, V](implicit wk: shapeless.Witness.Aux[F]) = at[FieldType[F, V]] { | |
f => wk.value.toString | |
} | |
} | |
// Is there more straighforward way to give an explicit type for a record? |
yonedaLemma = Iso (flip fmap) ($ id) |
#!/usr/bin/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
scala> import shapeless._, record._ | |
import shapeless._ | |
import record._ | |
scala> case class Person(name: String, address: String, age: Int) | |
defined class Person | |
scala> val joe = Person("Joe", "Brighton", 33) | |
joe: Person = Person(Joe,Brighton,33) |
try: | |
from urllib.parse import quote # Py 3 | |
except ImportError: | |
from urllib2 import quote # Py 2 | |
import os | |
import sys | |
BLOG_DIR = os.environ['BLOG_DIR'] | |
# BLOG_DIR = '/Users/cscorley/git/cscorley.github.io/' |
I’ll assume you are on Linux or Mac OSX. For Windows, replace ~/.vim/
with $HOME\vimfiles\
and forward slashes with backward slashes.
Vim plugins can be single scripts or collections of specialized scripts that you are supposed to put in “standard” locations under your ~/.vim/
directory. Syntax scripts go into ~/.vim/syntax/
, plugin scripts go into ~/.vim/plugin
, documentation goes into ~/.vim/doc/
and so on. That design can lead to a messy config where it quickly becomes hard to manage your plugins.
This is not the place to explain the technicalities behind Pathogen but the basic concept is quite straightforward: each plugin lives in its own directory under ~/.vim/bundle/
, where each directory simulates the standard structure of your ~/.vim/
directory.
# Category Theory proofs in Idris | |
Idris is a language with dependent types, and is similar to Agda. | |
What distinguishes Idris is that it is intended to be a general-purpose language first, | |
and a theorem prover second. | |
To that end it supports optional totality checking | |
and features to support writing DSLs: | |
type classes, | |
do notation, | |
monad comprehensions (i.e., a more general form of list comprehension), |