Skip to content

Instantly share code, notes, and snippets.

@amirbehzad
amirbehzad / scrum.md
Last active January 6, 2021 16:22
Scrum Master Level I Study Guide
df1 <- createDataFrame(data.frame(a=c(1,2,3)))
df2 <- createDataFrame(data.frame(b=c(2,3,4)))
df1 = withColumn(df1, "index", monotonically_increasing_id())
df2 = withColumn(df2, "index", monotonically_increasing_id())
df_new = drop(
merge(df1, df2, by="index"),
c("index_x", "index_y"))
@amirbehzad
amirbehzad / ga_limits.md
Last active January 16, 2017 06:21
Limitations and Shortcomings of Google Analytics, Nov. 2016

Google Analytics (GA) has two tiers:

  • Standard (Freemium), free of charge
  • 360 Suite (Premium), flat annual fee $150,000

Both have limitations, which I'd categorize under Data Quality and Technology:

  • Data Quality
  • Data Sampling

GA uses sampling in generating many of its reports. This sacrifies accuracy in favor of query performance.

apt-get install -y libpq-dev python-dev pkg-config libcgraph5 libfreetype6-dev libpng-dev g++ curl libxft-dev graphviz libgraphviz-dev
python2 -m pip install numpy scipy pandas matplotlib pytidylib simplejson requests openpyxl psycopg2 BeautifulSoup networkx ipywidgets pygraphviz
python2 -m pip install seaborn pydot dill nltk rarfile facebook-sdk requests_oauthlib pytidylib requests_futures xlrd sklearn us
rules = { 2**x: ['{0:03b}'.format(x).translate(string.maketrans("10","x.")), (x > 0) and (x & 3 == x or x & 3 == 3) * 1] for x in range(8) }
@amirbehzad
amirbehzad / csfacts.md
Created May 29, 2016 17:08
Computer Science Fun Facts

Merge Sort

First, split the array in half. Then sort both sides.

Infinite Set

A set is said to be infinite if it is not finite

@amirbehzad
amirbehzad / Jekyll-OSX.md
Created April 18, 2016 15:42
How to Install Jekyll on OSX
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

echo "gem: --no-document" >> ~/.gemrc
curl -L https://get.rvm.io | bash -s stable --auto-dotfiles --autolibs=enable

rvm install ruby --latest
rvm requirements

brew update
@amirbehzad
amirbehzad / future-jobs.md
Created April 18, 2016 07:22
Future-proof Jobs

Future-proof Jobs

  • Engineer
  • Clergy
  • HR Manager
  • Media Producer
  • Game Warden
  • Labor Leader
  • Artist
  • Futurist
@amirbehzad
amirbehzad / C.sublime-build
Last active April 12, 2016 06:38
Build-system for Sublime-Text 2 to compile and run simple C programs
{
// Tools -> Build Systems -> New Build Systems
"cmd" : ["gcc -std=c99 $file_name -o ${file_base_name} && ./${file_base_name} -lm -Wall"],
"selector" : "source.c",
"shell": true,
"working_dir" : "$file_path"
}
@amirbehzad
amirbehzad / latency.markdown
Created February 2, 2016 10:30 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs