start new:
tmux
start new with session name:
tmux new -s myname
| #!/bin/bash | |
| # Sync Homebrew installations between Macs via Dropbox | |
| # | |
| BREW="/usr/local/bin/brew" | |
| # first get local settings | |
| echo "Reading local settings ..." | |
| rm -f /tmp/brew-sync.* |
| 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 |
| function mycd() | |
| { | |
| #if this directory is writable then write to directory-based history file | |
| #otherwise write history in the usual home-based history file | |
| tmpDir=$PWD | |
| echo "#"`date '+%s'` >> $HISTFILE | |
| echo $USER' has exited '$PWD' for '$@ >> $HISTFILE | |
| builtin cd "$@" # do actual cd | |
| if [ -w $PWD ]; then export HISTFILE="$PWD/.dir_bash_history"; touch $HISTFILE; chmod --silent 777 $HISTFILE; | |
| else export HISTFILE="$HOME/.bash_history"; |
| @Grab(group = 'net.sf.opencsv', module = 'opencsv', version = '2.3') | |
| import au.com.bytecode.opencsv.CSVReader | |
| import au.com.bytecode.opencsv.CSVParser | |
| import au.com.bytecode.opencsv.CSVWriter | |
| def TEST_FILE_NAME = 'test.csv' | |
| def TEST_OUTPUT_FILE_NAME = 'testOut.csv' | |
| List<String[]> rows = new CSVReader(new FileReader(new File(TEST_FILE_NAME)), CSVParser.DEFAULT_SEPARATOR, CSVParser.DEFAULT_ESCAPE_CHARACTER, CSVParser.DEFAULT_QUOTE_CHARACTER, 1).readAll() | |
| def rowsOver100 = rows.findAll {it[1].toInteger() > 100} |
| # DATA FRAME OPERATIONS IN R | |
| # Create data frame | |
| # A dataset is ~ table (list of vectors) | |
| id <- c(1,2,3) | |
| name <- c("John", "Kirk", "AJ") | |
| age <- c(21,27,18) | |
| employees <- data.frame(ID=id, Name=name, Age=age) | |
| employees |
| #!/bin/bash | |
| ### ABOUT | |
| ### Runs rsync, retrying on errors up to a maximum number of tries. | |
| ### Simply edit the rsync line in the script to whatever parameters you need. | |
| # Trap interrupts and exit instead of continuing the loop | |
| trap "echo Exited!; exit;" SIGINT SIGTERM | |
| MAX_RETRIES=50 |