Skip to content

Instantly share code, notes, and snippets.

View mark-rushakoff's full-sized avatar
🙈
I'm not watching GitHub notifications. Contact me directly to get my attention.

Mark Rushakoff mark-rushakoff

🙈
I'm not watching GitHub notifications. Contact me directly to get my attention.
View GitHub Profile
{
"builders": [
{
"type": "qemu",
"iso_url": "http://cloud-images.ubuntu.com/releases/bionic/release/ubuntu-18.04-server-cloudimg-amd64.img",
"iso_checksum_url": "http://cloud-images.ubuntu.com/releases/bionic/release/SHA256SUMS",
"iso_checksum_type": "sha256",
"disk_image": true,
"disk_size": 5120,
"disk_interface": "virtio-scsi",
@mark-rushakoff
mark-rushakoff / old_tendermint_links.md
Last active August 5, 2022 13:35
Outdated links in tendermint
@mark-rushakoff
mark-rushakoff / backup_restore.bash
Last active November 16, 2020 14:53
Backup and restore influxdb inside Docker
#!/bin/bash
set -e
# Default working directory to current directory, but allow override via WORKDIR environment variable.
WORKDIR=${WORKDIR:-$PWD}
NOW="$(date +%s)"
INFLUXDIR="$WORKDIR/influxdb-$NOW"
BACKUPDIR="$WORKDIR/backup-$NOW"
@mark-rushakoff
mark-rushakoff / mark-rushakoff_work.json
Last active November 16, 2020 13:34
My Planck Keymap
{
"version": 1,
"notes": "Planck Work Map v1",
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n",
"keyboard": "planck/rev6",
"keymap": "mark-rushakoff_work",
"layout": "LAYOUT_ortho_4x12",
"layers": [
[
"KC_ESC",
@mark-rushakoff
mark-rushakoff / gist:d84957d47ebbdfabaafbfdf9e476bef7
Last active September 16, 2020 20:06
List all imports of your project, by count
go list -json ./... | jq -r '.Imports | map(select(contains("."))) | join("\n")' | sort | uniq -c | sort -n
@mark-rushakoff
mark-rushakoff / gist:65d587799de9f3f353055333ed907807
Created September 15, 2020 15:36
Find packages that are declared in your project but not referenced anywhere
go list -test ./... | sort -u > /tmp/full_list_with_tests
go list -test -json ./... | jq -r '.Deps | map(select(startswith("github.com/YOUR/PROJECT/"))) | join("\n")' | sort -u > /tmp/is_depended_with_tests
comm -23 /tmp/full_list_with_tests /tmp/is_depended_with_tests | grep -v '.test$'
@mark-rushakoff
mark-rushakoff / trimpkg.go
Created September 19, 2019 17:25
Print out all the files required to build a single Go package.
package main
import (
"fmt"
"os"
"golang.org/x/tools/go/packages"
)
func main() {
@mark-rushakoff
mark-rushakoff / fields.go
Created September 1, 2016 16:28
Result parsing for InfluxDB
package resultparser
import (
"encoding/json"
"fmt"
)
// Field is implemented by TimeField, IntField, FloatField, and StringField
type Field interface {
columnIndex([]string) (int, error)
@mark-rushakoff
mark-rushakoff / Dockerfile_client
Created August 18, 2016 04:31
Simple micro-load generator for InfluxDB using docker-compose
FROM alpine:latest
RUN apk add --no-cache \
bash \
curl
COPY ./client.sh /client.sh
CMD ["/client.sh"]
@mark-rushakoff
mark-rushakoff / results.txt
Last active April 1, 2016 15:55
Which is faster: `a := make([]int, size); a[i] = val`, or `a := make([]int, 0, size); a = append(a, val)`?
→ go test -bench=. -benchmem -benchtime=5s
PASS
BenchmarkMakeLen_Index8-4 100000000 70.7 ns/op 64 B/op 1 allocs/op
BenchmarkMakeLen_Index16-4 100000000 90.7 ns/op 128 B/op 1 allocs/op
BenchmarkMakeLen_Index32-4 50000000 132 ns/op 256 B/op 1 allocs/op
BenchmarkMakeLen_Index64-4 30000000 212 ns/op 512 B/op 1 allocs/op
BenchmarkMakeLen_Index128-4 20000000 362 ns/op 1024 B/op 1 allocs/op
BenchmarkMakeLen_Index256-4 10000000 675 ns/op 2048 B/op 1 allocs/op
BenchmarkMakeLen_Index512-4 5000000 1371 ns/op 4096 B/op 1 allocs/op
BenchmarkMakeLen_Index1024-4 3000000 2573 ns/op 8192 B/op 1 allocs/op