start new:
tmux
start new with session name:
tmux new -s myname
| #!/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 |
| # 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 |
| @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} |
| 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"; |
| 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 | |
| # 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.* |
| id,name,amount | |
| 109,"building",1456894 | |
| 164,"house",1383613 | |
| 7,"Shopping and services",839415 | |
| 17,"store / shop",831628 | |
| 203,"school",676869 | |
| 4,"dining and leisure",671035 | |
| 74,"restaurant",385073 | |
| 194,"park",283545 | |
| 163,"sport venue",274433 |
CSW (Catalogue Service for the Web) is an `OGC (Open Geospatial Consortium)`_ specification that defines common interfaces to discover, browse, and query metadata about data, services, and other potential resources.
| # You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
| # This is how I upload my new Sol Trader builds (http://soltrader.net) | |
| # Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
| S3KEY="my aws key" | |
| S3SECRET="my aws secret" # pass these in | |
| function putS3 | |
| { | |
| path=$1 |