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
// a signal of 0 can be used to test for the existence of a process. | |
var exec = require('child_process').exec | |
var tryKill | |
function isRunning(pid, cb) { | |
var err = null, | |
result = null; | |
if (typeof pid !== 'number') { | |
err = "pid must be number" | |
} else { |
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 | |
########################################################### | |
# how to use | |
# curl -f -L https://gist.githubusercontent.com/piaoger/b6da9366ef28a065f152/raw/c06e66e7b4ff22fbb7295fd8a30899cd7d11936c/bootstrap.sh -O | |
# sh bootstrap.sh | |
########################################################### | |
echo off |
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
def deleteFile(dfile : File) : Unit = { | |
if(dfile.isDirectory){ | |
val files = dfile.listFiles | |
if(files != null) | |
files.foreach{ f => deleteFile(f) } | |
} | |
dfile.delete | |
} |
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
this_script=$(cd ${0%/*} && echo $PWD/${0##*/}) | |
this_dir=$(cd ${0%/*} && echo $PWD) |
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
// borrowed from http://www.cnblogs.com/duanhuajian/p/4485106.html | |
// change: use utc time instead | |
function formatDate (date, fmt) { | |
var o = { | |
"M+" : date.getUTCMonth()+1, | |
"d+" : date.getUTCDate(), | |
"h+" : date.getUTCHours()%12 == 0 ? 12 : date.getUTCHours()%12, | |
"H+" : date.getUTCHours(), | |
"m+" : date.getUTCMinutes(), | |
"s+" : date.getUTCSeconds(), |
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
package main | |
import ( | |
"log" | |
"net/http" | |
"net/http/httputil" | |
"net/url" | |
) | |
type handle struct { |
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 | |
# https://www.blackmoreops.com/2014/10/28/delete-clean-cache-to-free-up-memory-on-your-slow-linux-server-vps/ | |
sync | |
sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches" |
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
# for compress time and size, | |
# it seems that we can get the balance with "-1", i.e compress faster | |
ZIP_FOLDER="Utils./Users/piaoger/Box/*" | |
ZIP_OUTPUT=output.zip | |
FROM_TIME1=$(date) | |
zip -r output.zip Utils./Users/piaoger/Box/* |
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
# list *.js files in directory | |
for file in ./*.js | |
do | |
if [[ -f $file ]]; then | |
echo $file | |
fi | |
done | |
# list child dirs except hidden ones |
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
#md5 generation | |
# linux: md5sum file >md5file | |
# mac: md5 -r file >md5file | |
#Md5 comparison | |
# linux: md5sum -c md5file | |
# mac: manual check ? | |
function find_md5sum() { |