100 Books for 2020

  1. Berkshire Hathaway letters to shareholders 1965 – 2018
  2. Buffet Partnership Letters 1957 – 1970
  3. Marissa Mayer and the Fight to Save Yahoo
  4. Thinking in Systems
  5. Bottle of Lies
  6. Dear Chairman
  7. Who says Elephants Can’t Dance
  8. The Misbehavior of Markets
  9. Quality Investing
  10. What I talk about when I talk about Running
  11. Loonshots
  12. The Investment Checklist
  13. Uninhabitable Earth – didn’t finish

Notes 5/2/2016

def setUp(self):
self.server_log_file = open('.tsdb_server.log.test','w')
self.server_proc = subprocess.Popen(['python', 'go_server.py']
,stdout=self.server_log_file,stderr=subprocess.STDOUT)
time.sleep(1)

def tearDown(self):
self.server_proc.terminate()
self.server_log_file.close()
time.sleep(1)
  • Check if any python jobs are running in the background (of course this doesn’t have to be python)
jobs
ps aux | grep 'python'
#!/bin/bash

if [ $1 == "-h" ]; then
echo "Syntax::sh scriptname output-file classifer-name num-epochs"
exit
fi

# check outputfile
if [ -z $1 ]; then
echo "Output file not specified. Using 'output.all' "
OUTFILE="output.all"
else
OUTFILE=$1
if [ -e $OUTFILE ]; then
echo "Emptying " $OUTFILE
rm $OUTFILE
fi
echo "Output File = " $OUTFILE
fi
  • Get a specific file from a different branch on git
git checkout branch2 file.py
  • Get a specific file from a different branch on git and check changes line by line
git checkout --patch branch2 file.py

1/5/2016 Puzzle

  • agar – Food thickener

  • roust – means exactly the same thing as rouse

  • sabot – Dutch shoe

  • eiger – dangerous Alpine peak

  • inez – Don Juan’s Mother

  • etui – small ornamental case for holding needles, thread etc

  • orange pekoe – grade of black teas

  • cosi fan tutte – Mozart Opera (translates to “Woman are like that”)

Memorable Words

  • orrery – model of the solar system, used to be made out of wood
  • cur – rabid dog
  • sca – genre of music that reggae came out of
  • statal – of or relating to a state (usually a nation state)
  • egad – expressing surprise (like oh god)
  • roos – slang for kangaroos
  • gnu – deer like animal found in Africa
  • tse-tse – bees that spread disease
  • petit four – small french pastries

awk and sed

awk

Found this helpful for going though log files since they are naturally separated into fields. Good general tutorial here.

Useful predefined variables. Good write up here

  1. FILENAME – name of the file you’re in
  2. NR – line number that you’re on (global)
  3. FNR -line number that you’re on relative to current file
  4. NF – number of “fields” or words separated by the given delimiter on the line.
  5. FS – field seperator (space is the default)
  6. OFS – ouput field seperator (space is the default)

Useful Code Snippets

select lines where the third column is equal to 2 and compute the mean sum of squares of the eighth, ninth and tenth columms
awk 'BEGIN {r=0; num=0} {if ($3==2) {r += $8^2 + $9^2 + $10^2; num++}} END {print r/num}' filename

select lines with a 0 and atleast 20 columns and print the first and last column
awk '/0/ {if (NF > 20) print $1,$NF}' log.spparks.4 > hyd_diff_temp_2

select lines from a file where the second column is larger than 20 and print the filename with some additional columns
awk ' {if($2 > 20) print FILENAME,$1*10,$2}' size_time_*_1

sed

Generally used to replace texts but can be used more powerfully. Useful tutorial here.
replace “size_time” with blank
sed 's/size_time_//'

replace “size_time_someNumber_1” with “someNumber”
sed 's/size_time_\([0-9]*\)_1/\1/'