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 | |
| # | |
| LOG_DIR=/var/sankuai/logs/myfe-canary | |
| # | |
| DATE=$(date +%F) | |
| PID="$LOG_DIR/myfe-canary-0.pid" | |
| # | |
| LOG_STDOUT="$LOG_DIR/stdout.log" |
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
| git log '@{1 weeks ago}..HEAD' --shortstat --pretty=format:%an | awk '/.+/ { | |
| if($2 != "file" && $3 != "changed,") { | |
| curr = $1 | |
| } else { | |
| files[curr]+=$1 | |
| inserts[curr]+=$4 | |
| deletes[curr]+=$6 | |
| } | |
| } | |
| 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
| # Your init script | |
| # | |
| # Atom will evaluate this file each time a new window is opened. It is run | |
| # after packages are loaded/activated and after the previous editor state | |
| # has been restored. | |
| # | |
| # An example hack to log to the console when each text editor is saved. | |
| # | |
| atom.workspace.observeTextEditors (editor) -> | |
| editor.onDidSave -> |
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
| URL.prototype.__defineGetter__('query', function() { | |
| var params = {}; | |
| this.search.substr(1).split('&').map(function(param){ | |
| var pair = param.split('='); | |
| params[ pair[0] ] = pair[1]; | |
| }); | |
| return params; | |
| }); |
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
| //jweixin-1.0.0.js | |
| ! function(g, initFunc) { | |
| 'function' == typeof define && (define.amd || define.cmd) ? define(function() { | |
| return initFunc(g) | |
| }) : initFunc(g, true) | |
| }(this, | |
| function(glob, setGlobal) { | |
| function invokeCmd(cmd, param, callbackObj) { | |
| glob.WeixinJSBridge ? WeixinJSBridge.invoke(cmd, normParameter(param), function(res) { | |
| completeBridgeInteraction(cmd, res, callbackObj); |
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 | |
| # put your hosts file into /etc/hosts.d/ | |
| # | |
| # usage: | |
| # chhost $your-host-name | |
| # restore: | |
| # chhost | |
| HOSTD=/etc/hosts.d |
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
| var tmpl = function(str, data){ | |
| return str.replace(/#{([\s\S]*?)}/g, function(matchs, key){ | |
| return data[key.trim()] || ''; | |
| }); | |
| }; | |
| tmpl("My name is #{name} .", { name: 'lsong' }); |
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 | |
| # curl -so /usr/local/bin/fire https://gist.githubusercontent.com/song940/0af7aeadbea766bd8a63/raw/fire.sh && chmod +x /usr/local/bin/fire && echo "> DONE" | |
| # | |
| # usage: fire [PORT] | |
| # | |
| REMOTE_HOST=www.lsong.org | |
| REMOTE_PORT=$RANDOM | |
| REMOTE_USER="lsong" |
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
| var arr = [ | |
| {id:1, pid:0, name:"SYSTEM"}, | |
| {id:2, pid:1, name:"aa"}, | |
| {id:3, pid:2, name:"aaa"}, | |
| {id:4, pid:2, name:"b"}, | |
| {id:5, pid:0, name:"c"}, | |
| {id:6, pid:5, name:"cc"} | |
| ]; | |
| function generateTree(arr) { |
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 | |
| PATH_DIR=/etc/path.d | |
| for file in $(ls $PATH_DIR); do | |
| for line in $(cat "$PATH_DIR/$file"); do | |
| PATH=$PATH:$line | |
| done | |
| done |