Skip to content

Instantly share code, notes, and snippets.

View Fleshgrinder's full-sized avatar
💀

Richard Fussenegger Fleshgrinder

💀
View GitHub Profile
@Fleshgrinder
Fleshgrinder / gpg.sh
Last active May 17, 2021 10:00
Create GPG Key for GitHub Commit Signing
#!/bin/sh
set -eu
#
# Commands for generating a new GPG key for GitHub commit signing.
#
# https://help.github.com/articles/generating-a-new-gpg-key/
#
gpg --full-gen-key
@Fleshgrinder
Fleshgrinder / pull-request-url.sh
Created June 19, 2018 16:56
Show GitHub link for PR creation after pushing to remote. Store this in `.git/hooks/pre-push` and make it executable.
#!/bin/sh
cat << EOF
Create PR at: https://github.com/$(git remote get-url origin | grep -Eo '[^/:]+/[^/.]+')/compare/$(git rev-parse --abbrev-ref HEAD)?expand=1
EOF
@Fleshgrinder
Fleshgrinder / gradle
Last active August 30, 2020 18:33
Global script to resolve to the closest available Gradle Wrapper script.
#!/usr/bin/env bash
set -Eeuo pipefail
if command -v jenv &>/dev/null; then
JAVA_HOME=$(jenv javahome)
export JAVA_HOME
fi
if [[ -x gradlew ]]; then
exec ./gradlew "$@"
@Fleshgrinder
Fleshgrinder / windows-setup.ps1
Last active August 23, 2020 06:56
A few commands I routinely execute after setting up a new Windows machine to speed thing up a little and disable annoying stuff.
function dword {
Param([string] $path, [string] $name, [string] $value)
if (!(Test-Path $path)) {
New-Item -Path (Split-Path $path) -Name (Split-Path $path -leaf) | Out-Null
}
New-ItemProperty -Path $path -Name $name -Value $value -PropertyType DWORD -Force | Out-Null
}
# disables the creation of so called 8dot3names
fsutil 8dot3name set 1 | Out-Null
@Fleshgrinder
Fleshgrinder / git-clean-branches
Last active March 25, 2019 07:50
clean git branches
#!/usr/bin/env bash
set -eu
# http://docopt.org/
usage() {
cat << EOT
Clean local branches except for master.
Usage: git-clean-branches [options...]

Keybase proof

I hereby claim:

  • I am Fleshgrinder on github.
  • I am fleshgrinder (https://keybase.io/fleshgrinder) on keybase.
  • I have a public key whose fingerprint is 07DC 4CF5 EF0B 27D9 A311 9EA5 A5A2 6F7B 85A4 A347

To claim this, I am signing this object:

@Fleshgrinder
Fleshgrinder / mvn
Last active March 18, 2020 11:49
Script to execute Maven wrapper with jEnv and fallback to global Maven installation.
#!/usr/bin/env bash
set -Eeuo pipefail
JAVA_HOME=$(jenv javahome)
export JAVA_HOME
if [[ -f mvnw ]]; then
exec ./mvnw "$@"
else
readonly project_dir=$PWD
@Fleshgrinder
Fleshgrinder / jenv
Last active June 19, 2019 20:22
How to install jEnv on a Mac with Maven and Gradle wrapper support.
#!/usr/bin/env bash
set -Eeuo pipefail
brew install gradle jenv mvn
mkdir -p ~/bin
curl -Lo ~/bin/gradle 'https://gist.githubusercontent.com/Fleshgrinder/b4411e49fb97f000d57b65755d49740c/raw/gradle'
chmod +x ~/bin/gradle
@Fleshgrinder
Fleshgrinder / install-zulu.sh
Created August 28, 2020 16:50
Install Azul Zulu JDKs on Ubuntu
#!/usr/bin/env bash
set -Eeuo pipefail
if ((EUID != 0)); then
echo 'You need superuser privileges (e.g. sudo) to run this script' >&2
exit 1
fi
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
@Fleshgrinder
Fleshgrinder / jenv-autoload.sh
Created August 28, 2020 17:31
Load Zulu JDKs into jEnv
#!/usr/bin/env bash
set -Eeuo pipefail
if ! command -v jenv &>/dev/null; then
echo 'Could not find jenv in your PATH, make sure it is installed correctly and in your PATH.' >&2
exit 1
fi
readonly JENV_HOME=${JENV_HOME:-"$HOME/.jenv"}