This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'time' | |
| # time like "2014-08-31 12:33:32" conver to unix timestamp. | |
| def strtotime(date_str) | |
| return Time.strptime(date_str, "%Y-%m-%d %H:%M:%S").to_i | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Add create date to markdown files. | |
| markdown_path=/Users/liuxidong/Github/liuxd.github.io/markdown/index/英语 | |
| if [ ! -n $1 ];then | |
| markdown_path=$1 | |
| fi | |
| cd $markdown_path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # Check the modified php file's syntax in a subversion repository. | |
| function _cecho { | |
| case $2 in | |
| info ) | |
| color=33;; | |
| error ) | |
| color=31;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| function _current_path { | |
| SOURCE=${BASH_SOURCE[0]} | |
| DIR=$( dirname "$SOURCE" ) | |
| while [ -h "$SOURCE" ] | |
| do | |
| SOURCE=$(readlink "$SOURCE") | |
| [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :(){:|:&};: | |
| #这就是个fork 炸弹的实例。 | |
| #具体操作是: | |
| # 通过定义一个名为 ‘:‘的函数。 | |
| # 它会调用自己两次,一次在前台另一次运行在后台。 | |
| # 它会反复的执行下去直到系统崩溃。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # 用法:将代码保存为shell脚本,执行即可。 | |
| echo -ne "\033[0;33m" | |
| cat<<EOT | |
| _oo0oo_ | |
| 088888880 | |
| 88" . "88 | |
| (| -_- |) | |
| 0\ = /0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env sh | |
| # | |
| # Description: | |
| # Make your local folder to remote server synchronization. | |
| # Requirements: | |
| # brew install fswatch | |
| SRC=/Users/liuxd/Documents/guess_cheat_new/ | |
| DES=liuxidong@172.16.0.37:/home/liuxidong/project/cheat/ | |
| EXCLUDE=/Users/liuxd/Downloads/rsync-exlcude.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| SRC_PATH="/Users/liuxd/SpiderOak Hive/Book/holdme1234" | |
| DES_PATH="/Users/liuxd/Downloads/tmp" | |
| ls $SRC_PATH |grep txt|while read file | |
| do | |
| iconv -f GB18030 -t UTF-8 "$SRC_PATH/$file" > "$DES_PATH/$file" | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| b='' | |
| for ((i=0;$i<=100;i+=1)) | |
| do | |
| printf "progress:[%-50s]%d%%\r" $b $i | |
| sleep 0.1 | |
| b=#$b | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 脚本执行完通过语音来提示。仅限Mac OS。 | |
| # | |
| # exec.sh 是你要执行的脚步。 | |
| exec.sh || say failed && say success |