Skip to content

Instantly share code, notes, and snippets.

View gwsu2008's full-sized avatar

Guang gwsu2008

View GitHub Profile
@gwsu2008
gwsu2008 / git-clone-bare
Last active May 21, 2018 20:54
git-clone-bare
$ git clone --mirror [email protected]/upstream-repository.git
$ cd upstream-repository.git
# Delete the open pull if necessary
git show-ref | cut -d' ' -f2 | grep 'pull-request' | xargs -L1 git update-ref -d
$ git push --mirror [email protected]/new-location.git
@gwsu2008
gwsu2008 / Linux chmod
Created February 11, 2018 08:02
Linux chmod
rwx = 111 in binary = 7 (read/write/execute)
rw- = 110 in binary = 6 (read/write)
r-x = 101 in binary = 5 (read/execute)
r-- = 100 in binary = 4 (read)
wx- = 011 in binary = 3 (write/execute)
w-- = 010 in binary = 2 (write)
x-- = 001 in binary = 1 (execute)
a = all, o = others, g = group, u = user
r = read, w = write, x = execute,
X = special execute, s = setuid/gid, t = sticky
@gwsu2008
gwsu2008 / rpmbuild 32bit lib packages for x86-64
Created February 11, 2018 08:01
rpmbuild 32bit lib packages for x86-64
CC='gcc -m32' CXX='g++ -m32' linux32 rpmbuild -bb --target=i586 package.spec
{
echo package
echo package-devel
} > baselibs.conf
/usr/lib/build/mkbaselibs -c /usr/lib/build/baselibs_global.conf -c baselibs.conf /PATH_ TO_ RPMS/.../i586/package*.rpm
@gwsu2008
gwsu2008 / bubbleSort
Last active July 14, 2018 16:03
Sorting Algorithm
procedure bubbleSort( A : list of sortable items )
n = length(A)
repeat
swapped = false
for i = 1 to n-1 inclusive do
/* if this pair is out of order */
if A[i-1] > A[i] then
/* swap them and remember something changed */
swap( A[i-1], A[i] )
swapped = true
@gwsu2008
gwsu2008 / test-ssl-java
Created February 11, 2018 07:41
test-ssl-java
java SSLPoke localhost 443
@gwsu2008
gwsu2008 / 10x10-multiplication-table
Created February 11, 2018 07:39
10x10-multiplication-table
for i in `seq 10`; do
for j in `seq 10`; do
result=`expr $i \* $j`
echo -en "\t$result "
done
echo
done
echo
@gwsu2008
gwsu2008 / linux-journal
Last active February 11, 2018 07:37
linux-journal
http://www.linuxjournal.com/content/working-stdin-and-stdout
http://www.linuxjournal.com/content/sigalrm-timers-and-stdin-analysis
http://www.linuxjournal.com/content/wi-fi-mini-honeypot
http://www.linuxjournal.com/content/configuring-one-time-password-authentication-otpw
http://www.linuxjournal.com/content/python-scripts-replacement-bash-utility-scripts
http://www.linuxjournal.com/content/ssh-tunneling-poor-techies-vpn
http://www.linuxjournal.com/content/work-shell-what-day-date-past
http://www.linuxjournal.com/content/advanced-firewall-configurations-ipset
http://www.linuxjournal.com/content/tcpdump-fu
http://www.harding.motd.ca/autossh/
@gwsu2008
gwsu2008 / docker-commands
Created February 11, 2018 07:33
docker-commands
cat /proc/mounts | grep "mapper/docker" | awk '{print $2}' | xargs -r umount
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
docker rm $(docker ps -a -q)
docker inspect --format '{{ .NetworkSettings.IPAddress }}' fd2ee0f9f4f4
curl -L https://github.com/docker/compose/releases/download/1.3.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
@gwsu2008
gwsu2008 / vlc-command-line.sh
Last active February 7, 2018 04:41
vlc-command-line.sh
/Applications/VLC.app/Contents/MacOS/VLC -I rc screen:// --noaudio --sout "#transcode{vcodec=h264,venc=x264, vb=800,acodec=none,scale=1.0}:std{access=file,mux=mp4,dst=my_first_transcoded_movie.mp4}"
/Applications/VLC.app/Contents/MacOS/VLC -I dummy screen:// --screen-fps=25 --quiet --sout "#transcode{vcodec=h264,vb072}:standard{access=file,mux=mp4,dst="Desktop/vlc-output-terminal.mp4"}"
vlc \
screen:// --one-instance \
-I dummy --dummy-quiet \
--extraintf rc \
--rc-host localhost:8082 \
--rc-quiet \
--screen-follow-mouse \
--screen-mouse-image="mouse_pointer.png" \
@gwsu2008
gwsu2008 / setup-appium-mac-os.sh
Last active April 20, 2018 17:30
setup-appium-mac-os
1. Download homebrew http://brew.sh/
pip3 install git+https://github.com/behave/behave
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew analytics off
brew install node
brew install libimobiledevice (version 1.2.0)
brew install ideviceinstaller (latest version)
brew install python3
brew install carthage
brew install ios-deploy