Skip to content

Instantly share code, notes, and snippets.

@JenZhao
JenZhao / pin.sh
Created March 17, 2017 18:53 — forked from ckunte/pin.sh
Stuff to do after a fresh xubuntu install.
#!/usr/bin/env sh
echo "Stuff I do after a fresh xubuntu install:"
echo ""
echo "Installing f.lux"
sudo add-apt-repository ppa:kilian/f.lux
sudo apt-get update
echo "Installing all my favorite applications"
sudo apt-get -y install fluxgui python-pip git-core gitg gedit gedit-plugins gparted bleachbit gnome-do lightread chromium-browser zsh
echo "Removing unwanted applications"
sudo apt-get -y remove firefox
@JenZhao
JenZhao / git-clearHistory
Created June 1, 2017 18:13 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@JenZhao
JenZhao / remove_all_commits.sh
Created October 19, 2017 18:43
Delete all your commit history and keep the code in its current state
git checkout --orphan latest_branch
git add -A
git commit -am "initial commit"
git branch -D master
git branch -m master
git push -f origin master
@JenZhao
JenZhao / Install_Hexo_Mac.sh
Last active August 21, 2019 08:48
Install Hexo on Mac
# install NodeJS
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
nvm install stable
# install hexo
npm install -g hexo-cli
# initialize
echo "Please enter your github name: "
read github_name
@JenZhao
JenZhao / hexo_problems_fix.sh
Created October 20, 2017 03:05
hexo problems fix
echo "Please enter your github name: "
read github_name
git_link="https://github.com/$github_name/$github_name.github.io.git"
git clone $git_link .deploy/$github_name.github.io
cd .deploy/$github_name.github.io
git pull
cd ../../
@JenZhao
JenZhao / hexo_deployment.sh
Created October 20, 2017 03:10
Hexo Deployment
hexo clean
hexo generate
cp -R public/* .deploy/your_githubname.github.io
cd .deploy/your_githubname.github.io
git add .
git commit -m "update"
git push -f origin master
cd ../../
@JenZhao
JenZhao / Spark+ipython_on_MacOS.md
Created October 24, 2017 02:11 — forked from ololobus/Spark+ipython_on_MacOS.md
Apache Spark installation + ipython/jupyter notebook integration guide for macOS

Apache Spark installation + ipython/jupyter notebook integration guide for macOS

Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112

For older versions of Spark and ipython, please, see also previous version of text.

Install Java Development Kit

@JenZhao
JenZhao / Makefile
Last active October 24, 2017 18:08
Install Package Cloud on Ubuntu and Push Package to Package Cloud
make_wheel:
python setup.py bdist_wheel --universal
package_cloud push vevo/common/python ./dist/`ls dist`
container_make_wheel:
docker build --build-arg pc_config='${PC_CONFIG}' \
-t vevo/vevoml-build .
docker run -it --entrypoint make vevo/vevoml-build make_wheel
import boto3
def get_s3_object(key, bucket_name,
object_component='Body',
region_name='us-east-1',
encoding='utf-8'):
"""
Method to read s3 file directly in meomory
:param key: key of the file on s3 bucket
:param bucket_name: the s3 bucket name
@JenZhao
JenZhao / leetcode_sql.md
Created February 22, 2018 19:08
leetcode_sql

Here are my solutions to all SQL problems on leetcode.

Rank

-- how to do rank with out window function
select t1.category, count(distinct t2.id) as dense_rank
from table t1, table t2
where t1.id = t2.id and t1.value <= t2.value 
group by t1.category