Add this function screen
in ~/.bashrc
to avoid error as below:
Cannot open your terminal '/dev/pts/0' - please check.
function screen() {
/usr/bin/script -q -c "/usr/bin/screen ${*}" /dev/null
}
#!/bin/bash | |
### Backup git working status | |
# Backup modified and untracked files without ignored ones in any git working directory. The destination is required and will be created automatically if not exists. | |
# | |
# Usage: | |
# ./git-backup [destination path] | |
# Ex: | |
# ./git-backup ~/backup20130101 | |
# | |
# Note: Mac users have to install GNU Coreutils to support `--parents` of cp command |
alias qlook="qlmanage -p 2>/dev/null" |
#!/bin/bash | |
# git push to gerrit for current branch | |
branch_name=$(git symbolic-ref -q HEAD) | |
branch_name=${branch_name##refs/heads/} | |
branch_name=${branch_name:-HEAD} | |
git push origin HEAD:refs/for/$branch_name |
Add this function screen
in ~/.bashrc
to avoid error as below:
Cannot open your terminal '/dev/pts/0' - please check.
function screen() {
/usr/bin/script -q -c "/usr/bin/screen ${*}" /dev/null
}
if [ -L $0 ] ; then | |
BASEDIR=$(cd "$(dirname "$(readlink $0)")"; pwd -P) # for symbolic link | |
else | |
BASEDIR=$(cd "$(dirname "$0")"; pwd -P) # for normal file | |
fi |
# this script is only for Mac OS X | |
# ex: eject.sh /Volumes/MyDisk | |
diskutil unmount $1 |
# put this snippet in your shell config(ex: ~/.bashrc, ~/.zshrc, ...) | |
# make sure `.nvmrc` exsits in your project folder | |
function init-node { | |
# switch node version by nvm after changing folder without AVN | |
if [[ -f ".nvmrc" ]]; then | |
# initialize nvm if necessary | |
if [[ -z $(nvm 2>/dev/null) ]]; then | |
# nvm is not initailized | |
echo 'initialize nvm ...' | |
source ~/.nvm/nvm.sh |
git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD |
#!/bin/bash | |
# | |
# copy local ip address to clipboard | |
# this script is only for OS X | |
echo -n `ifconfig en0 | awk '$1 == "inet" {print $2}'` | pbcopy |
<?php | |
function isBig5Char ($char) { | |
if (strlen($char) < 2) | |
return false; | |
$byte1hex = dechex(ord($char[0])); | |
$byte2hex = dechex(ord($char[1])); | |
$number = hexdec($byte1hex . $byte2hex); | |
return ( | |
0x8140 <= $number && |