Skip to content

Instantly share code, notes, and snippets.

@rjeczalik
rjeczalik / ccl
Created April 15, 2014 09:25
A wrapper for Code Collabolator command line client, creating reviews for every local commit.
#!/bin/bash
die_usage() {
if [ ! -z "${*}" ]; then
echo "ccl: error: ${*}" 1>&2
echo
fi
echo "usage: ccl <review id> <commit>" 1>&2
echo " ccl <commit range>" 1>&2
exit 1
@rjeczalik
rjeczalik / bash-trick-01-why-u-no-archive-dir.md
Created May 10, 2014 09:33
bash-trick-01: WHY U NO ARCHIVE DIR?

unzip-all-the-things

~/Downloads $ wget https://mega.co.nz/sdk.zip &>/dev/null
~/Downloads $ unzip sdk.zip 
Archive:  sdk.zip
  inflating: readme.txt              
  inflating: megabdb.cpp             
  inflating: megacli.cpp             
  inflating: megaclient.cpp          
@rjeczalik
rjeczalik / golang-debug-utils.go
Last active August 29, 2015 14:01
Battle proven debugging utilities
package dbgutil
import (
"os"
"runtime"
"strings"
)
func stacktrace(max int) []string {
pc, stack := make([]uintptr, max), make([]string, 0, max)
@rjeczalik
rjeczalik / jobs-batch-remove.go
Created May 20, 2014 19:01
jobs-batch-remove.go
package main
import (
"fmt"
"sort"
)
type T string
func rm(t []T, idx []int) []T {
@rjeczalik
rjeczalik / gocompress.go
Created May 22, 2014 13:37
Command line interface to compress/* packages.
package main
import (
"compress/flate"
"compress/gzip"
"compress/lzw"
"compress/zlib"
"fmt"
"io"
"os"
@rjeczalik
rjeczalik / main.go
Last active August 29, 2015 14:03
fixture: licstat/scheduler/queue_test.go
package main
import (
"fmt"
"math/rand"
"os"
"strconv"
"time"
)
@rjeczalik
rjeczalik / main.go
Last active August 29, 2015 14:03
fixture: licstat/scheduler/all_test.go
package main
import (
"fmt"
"io"
"math/rand"
"os"
"strconv"
"text/template"
"time"
=== RUN TestScheduler-8
0: *scheduler.BarEvent=*scheduler.BarEvent: {Level=1, Priority=4}
1: *scheduler.BarEvent=*scheduler.BarEvent: {Level=4, Priority=6}
2: *scheduler.BarEvent=*scheduler.BarEvent: {Level=4, Priority=0}
0: *scheduler.FooEvent=*scheduler.FooEvent: {Level=4, Priority=4}
3: *scheduler.BarEvent=*scheduler.BarEvent: {Level=2, Priority=7}
1: *scheduler.FooEvent=*scheduler.FooEvent: {Level=4, Priority=3}
4: *scheduler.BarEvent=*scheduler.BarEvent: {Level=1, Priority=6}
2: *scheduler.FooEvent=*scheduler.FooEvent: {Level=0, Priority=1}
5: *scheduler.BarEvent=*scheduler.BarEvent: {Level=3, Priority=6}
@rjeczalik
rjeczalik / .plantuml.cfg
Created July 9, 2014 20:25
PlantUML exec script + skin configuration
skinparam {
monochrome true
defaultFontName Consolas
defaultFontSize 12
noteBackgroundColor #C0C0C0
noteFontName Courier
sequenceBoxBackgroundColor #EEEEEE
sequenceLifeLineBackgroundColor #DDDDDD
}
@rjeczalik
rjeczalik / gorelease
Created July 12, 2014 20:54
For building release archives + Markdown output.
#!/usr/bin/env bash
#
# Usage:
#
# ~ $ gorelease linux:windows 386:amd64 github.com/rjeczalik/bin/cmd/gobin
# ~/src/github.com/rjeczalik/bin/cmd/gobin $ gorelease linux:windows 386:amd64
die() {
if [ ! -z "${*}" ]; then
echo "gocross: ${*}" 1>&2