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
#!/bin/bash -x
set -euo pipefail
bucket=${1:-}
srcAccount=${2:-}
dstAccount=${3:-}
die() {
echo $* 1>&2
#!/bin/bash
toggle-go() {
local version="${1-}"
if [[ ! -z "$version" ]]; then
toggle-go-install "$version"
else
version=$(toggle-go-next "$(toggle-go-current)")
fi
#!/bin/bash
delete-vpc() {
local teamName=${1:-myteam}
local region=${2:-us-east-1}
aws ec2 describe-vpcs --region ${region} | jq -r ".Vpcs[] | select(.Tags[].Value | contains(\"${teamName}\")) | .VpcId" 2>/dev/null |
while read vpcID; do
echo "# deleting vpc (${vpcID}) ..."
package main
import (
"bytes"
"encoding/base64"
"fmt"
"io/ioutil"
"os"
)
package main
import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
#!/bin/bash
toggle-go() {
local version="${1-}"
if [[ ! -z "$version" ]]; then
toggle-go-install "$version"
else
version=$(toggle-go-next "$(toggle-go-current)")
fi
package main
import (
"errors"
"flag"
"fmt"
"log"
"log/syslog"
"os"
"os/exec"
@rjeczalik
rjeczalik / qwatch.go
Last active January 13, 2019 00:46
queued watch
package main
import (
"log"
"os"
"sync"
"github.com/rjeczalik/notify"
)
@rjeczalik
rjeczalik / boolmap.go
Last active September 27, 2015 21:17
BoolMap
package boolmap
// BoolMap is a data structure for storing binary
// states of elements indexed by non-negative
// integer key.
type BoolMap []byte
// New gives new bool map capable of storing state for
// n elements without growing.
func New(n int) BoolMap {
@rjeczalik
rjeczalik / gcr-tags.go
Last active October 4, 2018 11:37
Reads a tag list for Google Container Registry for the given image.
package main
import (
"encoding/json"
"flag"
"fmt"
"net/url"
"os"
"os/user"
"path/filepath"