Useful commands:
TODO: rearrange this to bottom = oldest and top = newst (2-27-2020) below dashed line
ln -f -s $(/bin/ls -t tmux_resurrect_*.txt | head -n 1) last
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
/** | |
* Calculate the detour distance between two different rides. Given four | |
* latitude / longitude pairs, where driver one is traveling from point A to | |
* point B and driver two is traveling from point C to point D, write a function | |
* (in your language of choice) to calculate the shorter of the detour distances |
# Git repository-specific solution | |
# Source: http://unix.stackexchange.com/questions/36233/how-to-skip-file-in-sed-if-it-contains-regex/36240#36240 | |
git grep -I --name-only -z -e '' | xargs -0 sed -i -e 's/[ \t]\+\(\r\?\)$/\1/' |
SELECT hstore(array_agg(v), array_agg(c::text)) FROM ( | |
SELECT v, COUNT(*) as c ,1 as agg from unnest(ARRAY['foo','bar','baz','foo']) v GROUP BY v) t | |
GROUP BY agg | |
--> "bar"=>"1", "baz"=>"1", "foo"=>"2" |
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 |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
# enable forward search | |
# http://ruslanspivak.com/2010/11/25/bash-history-incremental-search-forward/ | |
# https://bugs.launchpad.net/ubuntu/+source/bash/+bug/80635/comments/12 | |
stty -ixon |
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
#!/bin/bash | |
for arg; do [[ $arg = /* ]] || arg=$PWD/$arg; absargs+=("$arg"); done; | |
/Applications/P4Merge.app/Contents/Resources/launchp4merge "${absargs[@]}" | |
# First install tmux | |
brew install tmux | |
# For mouse support (for switching panes and windows) | |
# Only needed if you are using Terminal.app (iTerm has mouse support) | |
Install http://www.culater.net/software/SIMBL/SIMBL.php | |
Then install https://bitheap.org/mouseterm/ | |
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/ |