diff --git a/scratchpad/chunker/.gitignore b/scratchpad/chunker/.gitignore deleted file mode 100644 index e633497..0000000 --- a/scratchpad/chunker/.gitignore +++ /dev/null @@ -1 +0,0 @@ -chunker diff --git a/scratchpad/chunker/main.go b/scratchpad/chunker/main.go deleted file mode 100644 index 635c5ee..0000000 --- a/scratchpad/chunker/main.go +++ /dev/null @@ -1,84 +0,0 @@ -package main - -import ( - "flag" - "github.com/zrepl/zrepl/sshbytestream" - . "github.com/zrepl/zrepl/util" - // "bytes" - _ "bufio" - // "strings" - "io" - "log" - "os" - _ "time" -) - -func main() { - - mode := flag.String("mode", "", "incoming|outgoing") - incomingFile := flag.String("incoming.file", "", "file to deliver to callers") - outgoingHost := flag.String("outgoing.sshHost", "", "ssh host") - outgoingUser := flag.String("outgoing.sshUser", "", "ssh user") - outgoingIdentity := flag.String("outgoing.sshIdentity", "", "ssh private key") - outgoingPort := flag.Uint("outgoing.sshPort", 22, "ssh port") - outgoingFile := flag.String("outgoing.File", "", "") - flag.Parse() - - switch { - case (*mode == "incoming"): - - conn, err := sshbytestream.Incoming() - if err != nil { - panic(err) - } - - file, err := os.Open(*incomingFile) - if err != nil { - panic(err) - } - - chunker := NewChunker(file) - - _, err = io.Copy(conn, &chunker) - if err != nil && err != io.EOF { - panic(err) - } - - log.Printf("Chunk Count: %d\n", chunker.ChunkCount) - - case *mode == "outgoing": - - conn, err := sshbytestream.Outgoing(sshbytestream.SSHTransport{ - Host: *outgoingHost, - User: *outgoingUser, - IdentityFile: *outgoingIdentity, - Port: uint16(*outgoingPort), - }) - if err != nil { - panic(err) - } - - f, err := os.OpenFile(*outgoingFile, os.O_CREATE|os.O_WRONLY, 0600) - if err != nil { - panic(err) - } - - unchunker := NewUnchunker(conn) - - _, err = io.Copy(f, unchunker) - if err != nil { - panic(err) - } - - conn.Close() - - log.Printf("Chunk Count: %d\n", unchunker.ChunkCount) - - os.Exit(0) - - default: - panic("unsupported mode!") - - } - -} diff --git a/scratchpad/repeat/main.go b/scratchpad/repeat/main.go deleted file mode 100644 index 7fe769c..0000000 --- a/scratchpad/repeat/main.go +++ /dev/null @@ -1,46 +0,0 @@ -package main - -import ( - "log" - "os" - "os/exec" - "time" -) - -var config struct { - duration time.Duration -} - -func usage() { - log.Printf("usage: repeat repeatInterval command [args...]") -} - -func main() { - - args := os.Args - - if len(args) < 3 { - usage() - os.Exit(1) - } - repeatInterval, err := time.ParseDuration(args[1]) - if err != nil { - log.Printf("cannot parse interval: %s", err) - usage() - os.Exit(1) - } - - var lastStart time.Time - - for { - cmd := exec.Command(args[2], args[3:]...) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - lastStart = time.Now() - if err := cmd.Run(); err != nil { - panic(err) - } - time.Sleep(lastStart.Add(repeatInterval).Sub(time.Now())) - } - -} diff --git a/scratchpad/repeat/sleepx.sh b/scratchpad/repeat/sleepx.sh deleted file mode 100755 index e6856dc..0000000 --- a/scratchpad/repeat/sleepx.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -echo -n ' start ' -date -sleep $1 -echo -n 'done ' -date