I hereby claim:
- I am xiaohk on github.
- I am xiaohk (https://keybase.io/xiaohk) on keybase.
- I have a public key ASAaaTf0leOMgJkNe95qixaiDCkgSEHryJ5dPNmbp1UC5Qo
To claim this, I am signing this object:
| """ | |
| If you want to download the data of 4th edition, change all the '5' in the string | |
| below to '4' (i.e. '/data5' -> '/data4'). Although two editions almost have the same | |
| data sets, the data format for 4th edition is kinda sloppy. Thus 5th edition is recommended. | |
| """ | |
| import urllib.request | |
| import requests | |
| import regex as re |
| zh = 'U+5EB8' | |
| print(zh) # U+5EB8 | |
| zh = '\u5EB8' | |
| print(zh) # 庸 | |
| zh = '\\u5EB8' | |
| print(zh) # \\u5EB8 | |
| print(zh.decode('unicode-escape')) # AttributeError: 'str' object has no attribute 'decode' | |
| print(zh.encode('ascii').decode('unicode-escape')) # 庸 |
| "The default color theme of vim" :colo obsidian2 | |
| :colo obsidian2 | |
| "set background=dark | |
| "colo solarized | |
| "Execute the python scrip by clicking control + B" | |
| :nnoremap <C-B> :w<CR>:!python3 %<CR> | |
| "Change the current working directory to dropbox" | |
| ":cd ~/Dropbox/Vim_programming |
| # Automatically activate virtualenv when using 'cd' (rewrite builtin cd function) | |
| # Assuming current working directory is in a sub-directory of virtualenv directory | |
| function cd { | |
| builtin cd "$@" | |
| # Check upper 4 directories | |
| if [-d "../bin" -a -d "../lib" -a -d "../include" -a -e "../.Python" \ | |
| -a -e "../pip-selfcheck.json" ] ; then | |
| source ../bin/activate | |
| elif [ -d "../../bin" -a -d "../../lib" -a -d "../../include" -a -e \ | |
| "../../.Python" -a -e "../../pip-selfcheck.json" ] ; then |
| library('ggplot2') | |
| library('maps') | |
| # Plot the United State map with AQL data | |
| head(state_aql) | |
| # name AQL state | |
| # 1 Alabama 34.83090 alabama | |
| # 2 Alaska 21.12207 alaska | |
| # 3 Arizona 28.49161 arizona |
| # We want to create clean data file and description file for GUIDE | |
| prepare_for_guide = function(df, y_name, output_name, desc_name){ | |
| # Find the index of response variable y | |
| y_index = which(colnames(df)==y_name) | |
| # Data file | |
| write.table(df, output_name, row.names=FALSE, col.names=FALSE, quote=FALSE) | |
| # Description file | |
| desc_file = file(desc_name) |
I hereby claim:
To claim this, I am signing this object: