start new:
tmux
start new with session name:
tmux new -s myname
# Input rgb values 1...255 | |
# based on http://forums.devshed.com/c-programming-42/rgb-to-hsv-conversion-rountine-162526.html | |
r = r / 255.0 | |
g = g / 255.0 | |
b = b / 255.0 | |
max = [r, g, b].max | |
min = [r, g, b].min | |
delta = max - min | |
v = max * 100 |
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 |
#!/bin/bash | |
#attach the EBS to /dev/sdf before running it | |
#format EBS | |
mkfs -t ext4 /dev/xvdf | |
#copy original /var to /dev/xvdf | |
mkdir /mnt/new | |
mount /dev/xvdf /mnt/new | |
cd /var |
############################################################################# | |
## | |
## extended_gcd.rb | |
## | |
## given non-negative integers a > b, compute | |
## coefficients s, t such that gcd(a, b) == s*a + t*b | |
## | |
def extended_gcd(a, b) | |
# trivial case first: gcd(a, 0) == 1*a + 0*0 |
#!/bin/bash | |
# | |
# Steam installer for Debian wheezy (32- and 64-bit) | |
# | |
# Place into empty directory and run. | |
# | |
download() { | |
local url="$1" | |
local filename="$(basename "$url")" |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
#!/usr/bin/env ruby | |
# | |
# Syncs Ruby binstubs for ruby-communal-gems. | |
# Run this everytime you install a new Ruby, or when you install a new gem | |
# with a bin/ command. (ie, when you typically do rbenv rehash) | |
# | |
# See: https://github.com/tpope/rbenv-communal-gems/issues/5 | |
# | |
require 'fileutils' |