Skip to content

Instantly share code, notes, and snippets.

@zfz
zfz / reverse_geocoder_example.py
Created April 3, 2015 04:18
A Python library for offline reverse geocoding, https://github.com/thampiman/reverse-geocoder
In [1]: import reverse_geocoder as rg
In [2]: coordinates = (39.99, 116.48),
In [3]: results = rg.search(coordinates)
Loading formatted geocoded file...
In [4]: print results
[{'name': 'Wangjing', 'cc': 'CN', 'lon': '116.47284', 'admin1': 'Beijing', 'admin2': '', 'lat': '39.9933'}]
# Install pip in for an virtualenv, from digital ocean documents
curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python2.7 -
pip install virtualenv
virtualenv venv
@zfz
zfz / install-rails-dev.sh
Last active August 29, 2015 14:17
rails env install script on vagrant ubuntu
sudo apt-get update
sudo apt-get install -y git-core curl zlib1g-dev build-essential \
libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 \
libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common nodejs
# Install rbenv
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
@zfz
zfz / tmux.conf
Last active August 31, 2023 20:31
setw -g mode-keys vi
# Switch panels
bind k selectp -U # switch to panel Up
bind j selectp -D # switch to panel Down
bind h selectp -L # switch to panel Left
bind l selectp -R # switch to panel Right
# History limit
set-option -g history-limit 10000
# Display 256color for Vim
set -g default-terminal "screen-256color"
# Install xcode command line tools
xcode-select --install
# Install home brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install git
brew install git
# Install python
--!connect jdbc:hive2://hadoop015.dx.momo.com:10000 ${hivevar:user} ${hivevar:passwd}
!connect jdbc:hive2://hadoop015.dx.momo.com:10000 dm dm
--beeline hive -f filename --hivevar dbname=online --hivevar partition_date=****
USE ${hivevar:dbname};
--use offline
SET mapreduce.job.queuename=data;
SET mapreduce.job.name="group_reocommend_evaluation_${hivevar:partition_date}";
@zfz
zfz / guess_the_number.py
Last active August 29, 2015 14:15
Mini Projets for An Introduction to Interactive Programming in Python Session 2
# template for "Guess the number" mini-project
# input will come from buttons and an input field
# all output for the game will be printed in the console
# Mini Project 2 for An Introduction to Interactive Programming in Python
# URL http://www.codeskulptor.org/#user39_L4LKshd1tOatpPt_2.py
import random
import simplegui
@zfz
zfz / hot_group.sql
Last active November 15, 2019 16:12
CREATE TABLE IF NOT EXISTS group_hot_coeff_20141217
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' as
SELECT
group_active_member_num.group_id
,group_active_member_num.active_member_num / (group_member_num.member_num + 10)
FROM
(
SELECT
group_id AS group_id
,COUNT(*) AS active_member_num
# For Linux Bash
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Color Scheme
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
@zfz
zfz / profile
Last active March 11, 2019 01:30
export PATH="/usr/local/bin:$PATH"
alias ll='ls -l'
alias grep='grep --color=auto'
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
# From: Candy Colored Terminal
# URL http://stevelosh.com/blog/2009/03/candy-colored-terminal/