Skip to content

Instantly share code, notes, and snippets.

View nickcheng's full-sized avatar
🛴
Vibing

nickcheng nickcheng

🛴
Vibing
View GitHub Profile
@nickcheng
nickcheng / script.sh
Last active August 30, 2018 01:03
[git-radar prompt setting in .zshrc] #zsh #on-my-zsh #git
# git-radar
# Installation: brew install michaeldfallen/formula/git-radar
# Source: https://github.com/michaeldfallen/git-radar
export PROMPT='
%{$fg_bold[white]%}%T%{$reset_color%}\
%{$fg[cyan]%} %n%{$reset_color%}\
%{$fg_bold[green]%} %d%{$reset_color%}\
$(git-radar --zsh --fetch) \
%{$fg[white]%}[%*] $exit_code
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}'
@nickcheng
nickcheng / script.sh
Last active August 23, 2018 02:11
[Remove merged branches locally] except current branch, master branch and develop branch #git
# In CLI
git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | grep -v "staging" | xargs -n 1 git branch -d
# As a shell alias
alias gbpurge='git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | grep -v "staging" | xargs -n 1 git branch -d'
@nickcheng
nickcheng / script.sh
Created July 16, 2018 09:49
[ffmpeg command for converting SONY RX100ii video to MP4 format] #rx100 #video #ffmpeg
ffmpeg -i input.MTS -c:v copy -c:a aac -strict experimental -b:a 256k output.mp4
@nickcheng
nickcheng / snippet.py
Created July 9, 2018 14:14
#Python: How do I get key/value pairs from the BaseHTTPRequestHandler HTTP POST handler?
from sys import version as python_version
from cgi import parse_header, parse_multipart
if python_version.startswith('3'):
from urllib.parse import parse_qs
from http.server import BaseHTTPRequestHandler
else:
from urlparse import parse_qs
from BaseHTTPServer import BaseHTTPRequestHandler
name download_total
AFNetworking 61983241
Fabric 50998892
Crashlytics 49667729
SDWebImage 45471101
Alamofire 42097177
CocoaLumberjack 36071914
Bolts 35294870
FirebaseInstanceID 30277793
FirebaseAnalytics 30254593

Keybase proof

I hereby claim:

  • I am nickcheng on github.
  • I am yanan (https://keybase.io/yanan) on keybase.
  • I have a public key ASAaRskpSRDHrhi1WSs1QJPzmQAF9Ghed8FeAsEJM26cRQo

To claim this, I am signing this object:

@nickcheng
nickcheng / script.sh
Last active March 6, 2018 02:36
Replicate gems to newly upgrade ruby version via Rbenv.
rbenv shell 2.4.2
gem list | cut -d" " -f1 > my-gems
rbenv shell 2.5.0
gem in $(cat my-gems)
@nickcheng
nickcheng / script.sh
Created March 2, 2018 12:53
Install latest pipsi.
# Script comes from https://github.com/mitsuhiko/pipsi/issues/125#issuecomment-360321441
# Download the pipsi installer script from github
$ curl -O https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py
# Read about the --src option in the help menu
$ python get-pipsi.py --help
# Run the installer script to get the master branch from github
$ python get-pipsi.py --src=git+https://github.com/mitsuhiko/pipsi.git#egg=pipsi
@nickcheng
nickcheng / gitaliases.md
Created January 26, 2018 01:16
git aliases for ignoring files locally.
git config --global alias.ignore 'update-index --skip-worktree'
git config --global alias.unignore 'update-index --no-skip-worktree'
git config --global alias.ignored '!git ls-files -v | grep "^S"'

Ref: https://stackoverflow.com/posts/39086325/revisions