Skip to content

Instantly share code, notes, and snippets.

View seancheung's full-sized avatar
😅

Sean seancheung

😅
  • Hangzhou, Zhejiang/China
View GitHub Profile
@seancheung
seancheung / burn.sh
Created June 1, 2017 14:04
Create iso images from folders or files on OSX
#!/bin/bash
burn() {
local output="$2"
if [ ! "$output" ];then
output="${1%/}.iso"
fi
hdiutil makehybrid -iso -joliet -o "$output" "$1"
}
@seancheung
seancheung / install_pkgs.sh
Created March 2, 2017 13:21
Install .pkg files in current directory on OSX
#!/bin/bash
for file in *.pkg; do
installer -pkg "$file" -target /
done
@seancheung
seancheung / del_repos.sh
Created March 2, 2017 13:19
Delete GitHub repositories
#!/bin/bash
# declare an array called array and define 3 vales
array=( )
for i in "${array[@]}"
do
echo "deleting $i..."
curl -H 'Authorization: token {$TOKEN}' -X DELETE https://api.github.com/repos/{$USER}/$i
done
@seancheung
seancheung / setup-redis.sh
Last active December 13, 2016 10:00
redis server setup
#!/bin/bash
# pre-requirements
sudo apt-get install software-properties-common python-software-properties
# add repository
sudo add-apt-repository ppa:chris-lea/redis-server
# update source
sudo apt-get update
@seancheung
seancheung / bfg.bat
Last active September 18, 2018 13:08
misc
@ECHO OFF
java -jar "%~dp0bfg-1.13.0.jar" %*
@seancheung
seancheung / post-receive
Created December 13, 2016 09:43
git post receive hook
#!/bin/bash
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ "master" == "$branch" ]; then
GIT_WORK_TREE=/path/to/website git checkout master -f
echo "password" | sudo -S chown -R git:www /path/to/website && sudo chmod -R 775 /path/to/website
cd /path/to/website/cache/folder
for DIR in `find . -mindepth 1 -maxdepth 1 -type d`
do
@seancheung
seancheung / sssetup.sh
Last active December 25, 2018 14:56
Install and config shadowsocks server on Ubuntu Machine
#!/bin/sh
#install pip and shadowsocks
sudo apt-get install -y python-pip
sudo pip install shadowsocks
#create shadowsocks scripts
echo "sudo ssserver -p 8388 -k [PASSWORD] -m aes-256-cfb --user nobody -d start" > ssstart.sh
echo "sudo ssserver -d stop" > ssstop.sh
@seancheung
seancheung / git_alias.sh
Last active May 12, 2017 13:06
Useful aliases
#!/bin/bash
alias gs="git status $*"
alias go="git checkout $*"
alias gob="git checkout -b $*"
alias gof="git checkout -f $*"
alias ga="git add $*"
alias gaa="git add . $*"
alias gc="git commit $*"
alias gcm="git commit -m $*"
@seancheung
seancheung / cloudSettings
Last active April 21, 2018 06:54
VSCode Settings Sync
{"lastUpload":"2018-04-21T06:54:23.694Z","extensionVersion":"v2.9.0"}
@seancheung
seancheung / openwrt_init.sh
Last active October 1, 2016 08:51
openwrt initializing
#!/bin/bash
#first of all, to resolve the https issue, run these
opkg update
opkg install wget ca-certificates
#remove legacy shadowsocks lib and config
rm /etc/config/shadowsocks
#install shadowsocks-libdev