Skip to content

Instantly share code, notes, and snippets.

View MHajoha's full-sized avatar

Maximilian Haye MHajoha

  • Technical University of Berlin
  • Germany
View GitHub Profile
@MHajoha
MHajoha / bcryptpw.sh
Last active September 9, 2019 15:35
Script to quickly generate bcrypt hashes.
#!/bin/bash
set -o errexit -o nounset
PROG="$0"
USAGE="$(cat <<EOF
$PROG encode [-c] [-p]
OPTIONS
-c Copy result after hashing using xclip instead of printing.
-p Paste password using xclip instead of reading from stdin.
@MHajoha
MHajoha / prop2json.sh
Last active September 9, 2019 16:24
Turns Java a properties file into JSON. For use in SPRING_APPLICATION_JSON environment variable.
#!/bin/bash
set -o errexit -o nounset -o errtrace
shopt -s extglob
USAGE="$(cat <<EOF
$0 [-f filename]
OPTIONS
-f Instead of reading from stdin, read from this file.
-c Produce compact instead of pretty-printed JSON.
@MHajoha
MHajoha / prop2env.sh
Last active September 5, 2019 22:59
Converts a Java properties file to a list of environment variable assignments.
#!/bin/bash
set -o errexit -o nounset -o errtrace
shopt -s extglob
USAGE="$(cat <<EOF
$0 [-x] [-e]
OPTIONS
-x Add "export" before each key=value pair.
-e Escape the character $ in values to prevent parameter expansion when run by a shell.
#!/bin/bash
set -o errexit -o nounset
VIM_SRC="${VIM_SRC:-/tmp/vim-sources}"
error() {
local message="${1:-}"
if [[ -n "$message" ]]; then
echo "$message" >&2
fi