Skip to content

Instantly share code, notes, and snippets.

View davidjeddy's full-sized avatar
🏎️
Rockin' in the new world.

David J Eddy davidjeddy

🏎️
Rockin' in the new world.
View GitHub Profile
@davidjeddy
davidjeddy / prepare-commit-msg
Created December 23, 2015 13:43
Automatically adds branch name to the start of every commit message.
#!/bin/bash
#
# Automatically adds branch name to the start of every commit message.
#
BRANCHNAME=$(git branch | grep '*' | sed 's/* //')
echo -e [$BRANCHNAME] $(cat "$1") > "$1"
@davidjeddy
davidjeddy / Remove all your local git branches but keep master
Last active July 16, 2016 21:06
Remove all your local git branches but keep master
$ git branch | grep -v "master" | xargs git branch -D
---or as a bash alias---
alias gitcb="git branch | grep -v "master" | xargs git branch -D"
@davidjeddy
davidjeddy / git-branches-by-commit-date.sh
Created September 15, 2017 15:55 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r

Keybase proof

I hereby claim:

  • I am davidjeddy on github.
  • I am davidjeddy (https://keybase.io/davidjeddy) on keybase.
  • I have a public key whose fingerprint is 7218 3F15 84B8 E3B1 1325 6AC8 29C9 16FF 8E32 5E23

To claim this, I am signing this object:

#!/bin/bash -e
# Tested on
# Ubuntu 18.x, 20.x, 22.x, YMMV
# Need testers for
# Test on RHEL/CentOS/
# usage install.sh PLATFORM ARCH
# example install.sh
# example install.sh linux arm32
terraform {
# https://runterrascan.io/ # style linting for TF files
before_hook "terraform fmt" {
commands = ["apply", "init", "plan"]
execute = ["terraform", "fmt", "-recursive", "."]
}
# https://terragrunt.gruntwork.io/docs/reference/cli-options/#hclfmt # style linting for HCL files
before_hook "terragrunt fmt" {
commands = ["apply", "init", "plan"]
@davidjeddy
davidjeddy / gist:bd243ccb66479fe4a48980cd9b548e7f
Last active February 1, 2023 13:14
Bash / Shell named arguments parsing
#!/bin/bash -e
## Default var values
declare arg1=""
declare arg2=""
## parse positional args
while [ $# -gt 0 ]; do
if [[ $1 == "--help" ]]
then