Skip to content

Instantly share code, notes, and snippets.

View edwardtoday's full-sized avatar

Pei Qing 卿培 edwardtoday

View GitHub Profile
@edwardtoday
edwardtoday / install-btsync.sh
Last active January 2, 2016 13:29
install btsync on ubuntu
sudo add-apt-repository ppa:tuxpoldo/btsync
sudo apt-get update
sudo apt-get install btsync-user
# visit 127.0.0.1:9999 to access the gui
╭─qingpei@skyeye-server ~/workspace/SkyEye-Server ‹master*›
╰─$ ldd build/bin/skyeye_server
linux-vdso.so.1 => (0x00007fff6ff7e000)
libmysqlclient.so.18 => /usr/lib64/mysql/libmysqlclient.so.18 (0x00000035e7600000)
libboost_system-mt.so.1.53.0 => /lib64/libboost_system-mt.so.1.53.0 (0x0000003611e00000)
libboost_thread-mt.so.1.53.0 => /lib64/libboost_thread-mt.so.1.53.0 (0x0000003612e00000)
libglog.so.0 => /usr/local/lib/libglog.so.0 (0x00007fcd82919000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00000035fc000000)
libm.so.6 => /lib64/libm.so.6 (0x00000035f3c00000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000035f4c00000)
@edwardtoday
edwardtoday / hosts
Last active December 31, 2015 05:29
hosts file
######## Localhost ########
127.0.0.1 localhost
::1 localhost
127.0.0.1 ubt
#Windows
127.0.0.1 localhost.localdomain localhost
#Linux
127.0.0.1 #Replace Your Device Name Here!
@edwardtoday
edwardtoday / git-recursive-pull.sh
Created December 12, 2013 08:51
find all .git directories and exec "git pull" on the parent.
# find all .git directories and exec "git pull" on the parent.
find . -type d -name .git -exec sh -c "cd \"{}\"/../ && pwd && git pull" \;
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
#
# retrieved from: http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
#
@edwardtoday
edwardtoday / txt2mobi.sh
Last active December 30, 2015 00:19
script to convert file from txt in gb18030 encoding to mobi
#!/bin/sh
echo "convert to utf8"
iconv -c -f GB18030 -t UTF8 $1 > $1.tmp
echo "txt cleanup"
sed 's/.$//' $1.tmp > $1.tmp.tmp && mv $1.tmp.tmp $1.tmp # dos2unix
sed '/^$/d;G' $1.tmp > $1.tmp.tmp && mv $1.tmp.tmp $1.tmp # double spacing
sed 's/^[ \t]*//;s/[ \t]*$//' $1.tmp > $1.tmp.tmp && mv $1.tmp.tmp $1.tmp # delete leading and trailing spaces
sed 's/#//' $1.tmp > $1.tmp.tmp && mv $1.tmp.tmp $1.tmp # delete # char
@edwardtoday
edwardtoday / lang-zh-CN.conf
Created November 28, 2013 00:45
AsciiDoc Simplified Chinese language configuration file.
#
# AsciiDoc Simplified Chinese language configuration file.
# Originally written by Pei Qing
#
[attributes]
# Captions, used by (X)HTML backends.
# Captions on RHS are displayed in outputs.
ifdef::basebackend-html[]
@edwardtoday
edwardtoday / gist:6658353
Last active December 23, 2015 15:49
Install Homebrew packages I need.
brew tap homebrew/dupes
brew install apple-gcc42
brew reinstall poppler --with-glib
brew install aacgain aspell astyle brew-gem brew-pip curl curl-ca-bundle ditaa emacs faac gist go grc git-flow git-extras graphviz imagemagick jpegoptim mercurial macvim mp3gain node ntfs-3g osxutils pdf2htmlex opencc openssl pdf2svg osxfuse gnuplot pypy python python3 qpdf r ruby scala ssh-copy-id subversion svg2pdf svg2png tree webkit2png wget wireshark youtube-dl yuicompressor zsh zsh-completions zsh-lovers zsh-syntax-highlighting xz coreutils
# oh-my-zsh
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
# install ffmpeg
brew install automake autojump celt faac fdk-aac git lame libass libtool libvorbis libvpx libvo-aacenc opencore-amr openjpeg opus sdl schroedinger shtool speex texi2html theora wget x264 xvid yasm
@edwardtoday
edwardtoday / encode.sh
Last active May 19, 2025 03:00
ffmpeg encoding command with x264 and fdk_aac
#!/usr/bin/env sh
ffmpeg -i $1 -c:v libx264 -crf 18 -preset veryslow -tune film -c:a libfdk_aac -vbr 5 $2
@edwardtoday
edwardtoday / dropbox
Created March 16, 2013 07:36
/etc/init.d/dropbox
#!/bin/sh
# dropbox service
# Replace with linux users you want to run Dropbox clients for
DROPBOX_USERS="ubuntu"
DAEMON=.dropbox-dist/dropbox
start() {
echo "Starting dropbox..."
for dbuser in $DROPBOX_USERS; do
HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
if [ -x $HOMEDIR/$DAEMON ]; then