Skip to content

Instantly share code, notes, and snippets.

@xhlwill
xhlwill / .vimrc
Created March 26, 2017 08:37
vim configuration
execute pathogen#infect()
syntax enable
set background=dark
colorscheme solarized
filetype plugin on
filetype indent on
set nu
@xhlwill
xhlwill / gfwlist.txt
Created April 18, 2017 16:22
in case
W0F1dG9Qcm94eSAwLjIuOV0KISBDaGVja3N1bTogY3o2d2w4bVZyRGNYNkZUNW0w
TVdNdwohIEV4cGlyZXM6IDZoCiEgVGl0bGU6IEdGV0xpc3Q0TEwKISBHRldMaXN0
IHdpdGggRVZFUllUSElORyBpbmNsdWRlZAohIExhc3QgTW9kaWZpZWQ6IFRodSwg
MTMgQXByIDIwMTcgMjM6NDk6MzYgLTA0MDAKIQohIEhvbWVQYWdlOiBodHRwczov
L2dpdGh1Yi5jb20vZ2Z3bGlzdC9nZndsaXN0CiEgTGljZW5zZTogaHR0cHM6Ly9y
YXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL2dmd2xpc3QvZ2Z3bGlzdC9tYXN0ZXIv
Q09QWUlORy50eHQKIQohIEdGV0xpc3QgaXMgdW5saWtlbHkgdG8gZnVsbHkgY29t
cHJpc2UgdGhlIHJlYWwKISBydWxlcyBiZWluZyBkZXBsb3llZCBpbnNpZGUgR0ZX
IHN5c3RlbS4gV2UgdHJ5CiEgb3VyIGJlc3QgdG8ga2VlcCB0aGUgbGlzdCB1cCB0
byBkYXRlLiBQbGVhc2UKISBjb250YWN0IHVzIHJlZ2FyZGluZyBVUkwgc3VibWlz
@xhlwill
xhlwill / ppi.js
Last active April 28, 2017 07:49
calculate the PPI of screen
const ppi = function(height, width, inch) {
return Math.round(Math.sqrt(height*height + width*width) / inch);
}
@xhlwill
xhlwill / count-git-commits.sh
Last active April 28, 2017 07:52
count total commits on current branch - 统计当前分支的提交数
git log | grep -e 'commit [a-zA-Z0-9]*' | wc -l
# 不准确,如果提交信息里有commit ...字样也会计算进去
# UPDATE:
git log --oneline | wc -l
# UPDATE 2:
# get the commit count for a revision (HEAD, master, a commit hash)
git rev-list --count <revision>
# get the commit count across all branches
@xhlwill
xhlwill / Preferences.sublime-settings
Last active May 1, 2017 04:49
sublime text settings
{
"always_show_minimap_viewport": true,
// Goto Anything or Find in Files
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
@xhlwill
xhlwill / user-rules.txt
Last active May 12, 2017 05:49
user rules for pac mode
! Put user rules line by line in this file.
! See https://adblockplus.org/en/filter-cheatsheet
||gist.github.com^
||github.io^
||githubusercontent.com^
||s3.amazonaws.com^
||postmates.com^
||imgur.com^
||quora.com^
||quoracdn.net^
@xhlwill
xhlwill / test-error.log
Created May 19, 2017 04:31
[Vue warn]: Cannot find element: #app
> @ test /Users/will/work/gitlab.-inc.com/new-live/pages/live
> npm run unit
> @ unit /Users/will/work/gitlab.-inc.com/new-live/pages/live
> ../../node_modules/.bin/cross-env BABEL_ENV=test ../../node_modules/.bin/karma start test/unit/karma.conf.js --single-run
19 05 2017 12:16:32.319:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
19 05 2017 12:16:32.323:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
19 05 2017 12:16:32.336:INFO [launcher]: Starting browser PhantomJS
@xhlwill
xhlwill / .npmrc
Last active June 5, 2017 12:34
install node-sass and phantomjs using taobao mirror
sass_binary_site = https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl = https://npm.taobao.org/mirrors/phantomjs/
electron_mirror = https://npm.taobao.org/mirrors/electron/
registry = https://registry.npm.taobao.org
@xhlwill
xhlwill / port.sh
Last active June 6, 2017 04:35
find processes that uses my tcp port
# You can try netstat
netstat -vanp tcp | grep 3000
# For OSX El Capitan and newer (or if your netstat doesn't support -p), use lsof
lsof -i tcp:3000
@xhlwill
xhlwill / show-all-files-in-finder.sh
Last active June 15, 2017 07:16
Display files with names that starts with a dot (.) in Finder
defaults write com.apple.finder AppleShowAllFiles -bool true
killall Finder
# then restart finder