This file contains 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
(funcall | |
(lambda (fn n) | |
(funcall fn n fn)) | |
(lambda (n this) | |
(cond ((> n 0) | |
(* n (funcall this (- n 1) this))) | |
(t 1))) | |
10) |
This file contains 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
dpkg --add-architecture i386 | |
apt-get update | |
apt-get install libstdc++6:i386 |
This file contains 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 | |
[email protected] | |
GITPATH=gitroot | |
cd ~/${GITPATH}_backup | |
ls -F . | grep / > /tmp/.gitmissing1 | |
eval ssh -n $GITHOST ls -F ${GITPATH}/. | grep / > /tmp/.gitmissing2 | |
diff /tmp/.gitmissing1 /tmp/.gitmissing2 | egrep '^>' | | |
while read x f; do | |
git clone --bare --mirror ${GITHOST}:${GITPATH}/$f $f |
This file contains 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
PGHOST=root@remotehost | |
eval "ssh ${PGHOST} pg_dump -Fc webdb" > webdb-`date +%F.%H%M`.dump |
This file contains 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
object jgitenv { | |
def setup() { | |
val jschConfigSessionFactory = new JschConfigSessionFactory() { | |
override def createDefaultJSch(fs:FS) = { | |
val jsch = new JSch(); | |
try { | |
jsch.addIdentity("..\\id_rsa"); //_.pub must exist | |
jsch.setKnownHosts("..\\known_hosts"); | |
} catch { |
This file contains 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
private[this] def peakNested(fid:Int, pbs:CodedInputStream):Option[CodedInputStream] = { | |
val (_, res) = Iterator.continually(pbs.readTag()).span{tag => | |
(tag != 0) && (WireFormat.getTagFieldNumber(tag) != fid) && pbs.skipField(tag) | |
} | |
val lastid = WireFormat.getTagFieldNumber(res.next) | |
if (lastid == fid) Some(pbs) | |
else None | |
} | |
def recursivePeek[T](ids:Seq[Int], extract: (CodedInputStream=>T), pbs:CodedInputStream):Option[T] = { | |
ids match { |
This file contains 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
val arg1 = Iterator(2, 3, 4, 8, 9, 12, 14, 17) | |
val arg2 = Iterator(1, 2, 3, 4, 6, 8, 9, 10, 11, 12, 13, 14, 17) | |
//??(arg1, arg2)=> Iterator((2, 4), (8, 9), (12, 12),(14, 17)) | |
case class CeRange(start:Int, end:Option[Int]) { | |
def passed(br: Int) = { | |
end.map(br < _).getOrElse(true) | |
} | |
} |
This file contains 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 timeit[T](f:()=>T)(count:Int=1) = { | |
val st = System.nanoTime() | |
var ti = 0 | |
var accu = collection.mutable.ListBuffer.empty[T] | |
while (ti < count) { | |
f() +=: accu | |
ti=ti+1 | |
} | |
val ed = System.nanoTime() | |
println(s"${(ed-st)/1000000} ms") |
This file contains 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
-- run by | |
-- "C:\Program Files\Wireshark\tshark" -Q -r ftp.pcapng -X lua_script:tcpflow.lua | |
local server = "1.1.1.1" | |
local tap = Listener.new("tcp", "ip.addr == "..server) | |
function gen_acc(seq) | |
local datas = {} | |
local sum = 0 | |
local last_sum = 0 |
This file contains 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 | |
# | |
#command to monitor a rippled stared by `./rippled --fg --net` with "full ledger_history" config | |
# | |
while [ 1 ]; | |
do ./rippled -q server_info|grep "complete_ledger"|egrep -o '[[:digit:]]*'|head -n1|xargs -I{} ./rippled -q ledger {} |grep close_time_human; | |
sleep 5; | |
done |
OlderNewer