Skip to content

Instantly share code, notes, and snippets.

View rjeczalik's full-sized avatar
💭
defer sleep()

Rafal Jeczalik rjeczalik

💭
defer sleep()
View GitHub Profile
@rjeczalik
rjeczalik / dataserver.go
Last active September 20, 2015 10:58
drop-in file server for go-bindata
package main
import (
"bytes"
"net/http"
"os"
)
type file struct {
name string
@rjeczalik
rjeczalik / migrate-dies
Last active September 27, 2015 13:21
Migrate your app from DEIS to Build.io
#!/bin/bash
# Copyright (c) 2015 Build.io. All rights reserved.
set -euo pipefail
APP_NAME=
REPO=
BRANCH=
DEIS_NAME=
@rjeczalik
rjeczalik / jq.go
Last active September 11, 2015 12:17
package main
import (
"encoding/json"
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
@rjeczalik
rjeczalik / rand.go
Last active August 29, 2015 14:25
rand helper
package main
import (
"crypto/sha256"
"encoding/hex"
"flag"
"fmt"
"math"
"math/rand"
"os"
@rjeczalik
rjeczalik / pandagate.go
Created June 5, 2015 13:39
Panda Gate - signing proxy for Panda API
// +build ignore
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"flag"
"fmt"
@rjeczalik
rjeczalik / hist.go
Created February 4, 2015 09:52
hist - ASCII histograms in terminal, with unicorns
package main
import (
"bufio"
"fmt"
"io"
"os"
"sort"
"strconv"
"strings"
@rjeczalik
rjeczalik / dln.go
Created February 4, 2015 08:36
dln - prints derivative of line-separated integer series (for use with histograms)
package main
import (
"bufio"
"fmt"
"io"
"os"
"strconv"
)
package main
import (
"errors"
"fmt"
"log"
"reflect"
"strconv"
"strings"
)
@rjeczalik
rjeczalik / main.go
Created November 18, 2014 09:29
go-exec: debugging os/exec with interactive scripts
package main
import (
"fmt"
"os"
"os/exec"
)
func die(v interface{}) {
fmt.Fprintln(os.Stderr, v)
@rjeczalik
rjeczalik / gh-gopath
Last active August 29, 2015 14:08
Imports all Go projects from your GitHub account into a GOPATH workspace
#!/bin/bash
# Rafal Jeczalik <[email protected]>
# https://gist.github.com/rjeczalik/db886c79049d83f318e2
type curl 1>/dev/null || exit
type jq 1>/dev/null || exit
die_usage() {
if [ ! -z "${*}" ]; then