Skip to content

Instantly share code, notes, and snippets.

@mitchellh
mitchellh / archive.md
Last active January 17, 2024 11:17
Archive List

Planned Repo Archive

In the new year, I plan on archiving the repositories below. Because I plan on only archiving the repositories, any project that depends on any of these projects will continue to work. However, I will no longer be accepting issues or pull requests and will never tag a new release.

The reality of each of the projects listed below is that I've almost completely ignored issues and pull requests for

[alias]
pr = "!f() { git fetch origin pull/$1/head:sethvargo/pr-$1 && git checkout sethvargo/pr-$1; }; f"
unreleased = "!f() { git fetch --tags && git diff $(git tag | tail -n 1); }; f"
up = "!f() { git fetch --all; git pull origin HEAD; for upstream in $(git remote); do git remote prune "${upstream}"; done }; f"
graph = "!f() { git log --oneline --abbrev-commit --graph --decorate; }; f"
undo = !git reset HEAD~1 --mixed
amend = !git commit --amend --no-edit
top = !git log --format=format:%an | sort | uniq -c | sort -r | head -n 20
x = "!f() { gitx; }; f"
@reegnz
reegnz / README.md
Created June 19, 2020 10:39
CamelCase <--> snake_case conversion in jq

CamelCase <--> snake_case conversion with jq

tl;dr

I provide you with 3 jq lib functions that will help you in converting between snake_case and CamelCase.

The interface

I want to change keys in my json from camelcase to snake_case.

@mrw34
mrw34 / postgres.sh
Last active March 26, 2024 00:24
Enabling SSL for PostgreSQL in Docker
#!/bin/bash
set -euo pipefail
openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req -keyout privkey.pem
openssl rsa -in privkey.pem -passin pass:abcd -out server.key
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod 600 server.key
test $(uname -s) = Linux && chown 70 server.key
docker run -d --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust -v "$(pwd)/server.crt:/var/lib/postgresql/server.crt:ro" -v "$(pwd)/server.key:/var/lib/postgresql/server.key:ro" postgres:12-alpine -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key
@VojtechVitek
VojtechVitek / slice-batch-in-parallel.go
Last active December 25, 2023 09:42
Golang - Loop over slice in batches (run something in parallel on a sub-slice)
package main
import "fmt"
func main() {
slice := make([]int, 159)
// Split the slice into batches of 20 items.
batch := 20
@kwilczynski
kwilczynski / Makefile
Last active March 8, 2024 23:48
Makefile for my Go projects (an example).
SHELL := /bin/bash
REV := $(shell git rev-parse HEAD)
CHANGES := $(shell test -n "$$(git status --porcelain)" && echo '+CHANGES' || true)
TARGET := packer-provisioner-itamae-local
VERSION := $(shell cat VERSION)
OS := darwin freebsd linux openbsd
ARCH := 386 amd64