Skip to content

Instantly share code, notes, and snippets.

View jtheo's full-sized avatar

Matteo Marchelli jtheo

View GitHub Profile
@fsmv
fsmv / pass.go
Last active October 9, 2022 21:15
A runnable go script that creates an http basic auth password hash compatible with .htaccess (this is just the password part, you have to add username:<hash>)
/*?sr/bin/env go run "$0" "$@"; exit $? #*/
// This is actually not a shebang, the first line is both valid shell script and valid go code
// Just run: chmod +x pass.go; ./pass.go
package main
import (
"bufio"
"crypto/sha256"
"encoding/base64"
"fmt"
#!/usr/bin/env bash
set -e
type docker >/dev/null 2>&1 || { echo >&2 "docker is not available. Aborting."; exit 1; }
GIT_BRANCH=$(git symbolic-ref HEAD | sed 's/refs\/heads\///')
# Configuration section
IMAGE_NAME=myproject
LIVE_BRANCH=master
@kewang
kewang / git-merge-test.sh
Last active February 23, 2023 10:04
Git merge dry-run
#!/bin/sh
BRANCH=$1
git merge --no-commit --no-ff $1; git status; git merge --abort
# References: https://stackoverflow.com/questions/501407/is-there-a-git-merge-dry-run-option