Skip to content

Instantly share code, notes, and snippets.

@fbchow
fbchow / .zshrc
Created October 6, 2019 16:43
.zshrc file config
function powerline_precmd() {
PS1="$(powerline-shell --shell zsh $?)"
}
function install_powerline_precmd() {
for s in "${precmd_functions[@]}"; do
if [ "$s" = "powerline_precmd" ]; then
return
fi
done
@fbchow
fbchow / brew-upkeep.sh
Last active August 17, 2019 01:39
keep brew utils up to date
# run `bash brew-upkeep.sh` or `sh brew-upkeep.sh` in your terminal (if you have permissions to run shell scripts)
# maintain brew packages
brew update
brew upgrade
brew doctor
brew cleanup
# update apps/fonts downloaded from cask
brew cask upgrade
@fbchow
fbchow / conda_cheatsheet.txt
Last active November 20, 2019 16:13
List Conda Environments on Computer
# https://conda.io/docs/user-guide/tasks/manage-environments.html
conda create --name myenv
# how install a sepcific version of package
# https://github.com/lopatovsky/HMMs/issues/4
conda install cython=0.25.2
conda env list
@fbchow
fbchow / change_shell.sh
Created September 1, 2018 17:20
How to Change Shell on Mac
cd /etc/shells
You will need to add:
/usr/local/bin/fish
to /etc/shells.
Then run:
chsh -s /usr/local/bin/fish
to make fish your default shell.
@fbchow
fbchow / Downloading Tensorflow on Mac for Conda Users
Last active April 4, 2018 21:58
Downloading Tensorflow on Mac for Conda Users
Terminal:
$conda create --name tensorflow
$source activate tensorflow
$pip install tensorflow
Check :
$python
import tensorflow as tf
how to get the size of everything in your file
du -sh *
how to see the first N lines of a file
cat -N file.txt
how to see the last N lines of a file
head -N file.txt
Collecting the bits & bytes from https://rstudio-pubs-static.s3.amazonaws.com/18858_0c289c260a574ea08c0f10b944abc883.html
stats notation:
“We fit a linear model with terms for age, sex” versus \( Y_i = \alpha + \beta_a A_i + \beta_s S_i + \epsilon_i \)
concise:
“We estimated the intercept to be 3.3” versus \( \hat{\alpha}=3.3 \).
#How to write math on a separate line
@fbchow
fbchow / gist:5815dac910b725dfa2b0af0e0ad6dd2a
Last active April 28, 2019 08:55
Copying & Moving Files
I always forget the exacty syntax for copying & moving files, especially when dealing with a remote Linux server. And I had wrote some documentation years ago but lost it (so much for persistent storage!). So here's some notes:
Change into the directory you want to download the files
cd /home/dir_to_dump_file_in
Log onto server using Safe File Transfer Protocol--just like how you would "ssh" into the Linux server
sftp homersimpson@sprinfielduniversity.edu
password: ilovemarge
Obtain the files from the Linux server on to your local server

Job title – Data Scientist

Basic Qualifications

  1. Bachelor’s Degree in Mathematics, Technical Science, Computer Science (or equivalent) or Engineering
  2. Minimum 1 year programming experience in at least one item from each:
  • R, SAS,Mathematica, MATLAB, Sagemath
  • Python, Ruby, Perl, Java, Scala
  • Linux
  • Bash scripting including sed, awk, cut, uniq, sort, tr
@fbchow
fbchow / ngram.py
Last active August 29, 2015 14:10 — forked from pebreo/ngram.py
from collections import Counter
from random import choice
import re
class Cup:
""" A class defining a cup that will hold the words that we will pull out """
def __init__(self):
self.next_word = Counter() # will keep track of how many times a word appears in a cup