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
package main | |
import ( | |
"io" | |
"log" | |
"net/http" | |
"os" | |
) | |
func main() { |
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
// this package is mostly copy-pasted from golang's std container/heap | |
// I changed Interface, Pop and Push in order to get rid of type assertions | |
// usage can be found in test file, benchmarks show that we can get about 27% of speedup for 1000 elems, or 10% for 10M elems (tested on go1.4) | |
package gheap | |
type Interface interface { | |
Len() int | |
Less(i, j int) bool | |
Swap(i, j int) | |
} |
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
func drawString(s string, x, y int, fg, bg termbox.Attribute) { | |
// s = strings.Replace(s, "\t", " ", -1) | |
// s = strings.Replace(s, "\r", "^R", -1) | |
w, _ := termbox.Size() | |
for _, ch := range s { | |
if x+runewidth.RuneWidth(ch) >= w { | |
break | |
} | |
termbox.SetCell(x, y, ch, fg, bg) | |
x += runewidth.RuneWidth(ch) |
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
URxvt.keysym.M-C-d: command:\033]11;#000000\007\033]4;0;#000000\007\033]4;1;#ad2323\007\033]4;2;#1d6914\007\033]4;3;#ffee33\007\033]4;4;#2a4bd7\007\033]4;5;#8126c0\007\033]4;6;#814a19\007\033]4;7;#a0a0a0\007\033]4;8;#575757\007\033]4;9;#ffcdf3\007\033]4;10;#81c57a\007\033]4;11;#e9debb\007\033]4;12;#9dafff\007\033]4;13;#29d0d0\007\033]4;14;#ff9233\007\033]4;15;#ffffff\007\033]10;#FFFFFF\007 | |
URxvt.keysym.M-C-l: command:\033]11;#a0a0a0\007\033]10;#000000\007\033]4;7;#000000\007\033]4;1;#ad2323\007\033]4;2;#1d6914\007\033]4;3;#ffee33\007\033]4;4;#0000b2\007\033]4;5;#8126c0\007\033]4;6;#814a19\007\033]4;0;#a0a0a0\007\033]4;8;#575757\007\033]4;9;#ffcdf3\007\033]4;10;#64eb55\007\033]4;11;#ffe9a5\007\033]4;12;#0081ff\007\033]4;13;#00f7fa\007\033]4;14;#ff9233\007\033]4;15;#ffffff\007 | |
! in light mode lightGray and black are swapped; fg: black(#0), bg:lt gray (#0a0a0a) | |
! {d,l} blue, lt green, tan and cyan adjusted to be more readable | |
URxvt*loginShell: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
package main | |
import ( | |
"fmt" | |
"regexp" | |
"strconv" | |
"strings" | |
) | |
type DKVP map[string]string |
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
package main | |
import ( | |
"archive/zip" | |
"errors" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"path/filepath" |
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
:loop | |
if exist remote.done ( | |
timeout 2 | |
goto loop | |
) | |
call remote.recipe.bat | |
goto loop |
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
func TestUpdate(t *testing.T) { | |
os.RemoveAll(TEST_DATA_DIR) | |
defer os.RemoveAll(TEST_DATA_DIR) | |
if err := os.MkdirAll(TEST_DATA_DIR, 0700); err != nil { | |
t.Fatal(err) | |
} | |
if err := ioutil.WriteFile(TEST_DATA_DIR+"/number_of_partitions", []byte("2"), 0600); err != nil { | |
t.Fatal(err) | |
} | |
db, err := OpenDB(TEST_DATA_DIR) |
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
func Test(t *testing.T) { | |
fatalIf := func(err error) { | |
if err != nil { | |
t.Fatal(err) | |
} | |
} | |
err := os.MkdirAll(TEST_DATA_DIR, 0700) | |
fatalIf(err) | |
OlderNewer