Skip to content

Instantly share code, notes, and snippets.

@mdenkinger
mdenkinger / zsh-visual-studio-code.sh
Created January 2, 2020 08:07
zsh: visual studio code
function code {
if [[ $# = 0 ]]
then
open -a "Visual Studio Code"
else
local argPath="$1"
[[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}"
open -a "Visual Studio Code" "$argPath"
fi
}
@mdenkinger
mdenkinger / ssh-add-private-keys.sh
Created January 2, 2020 08:05
zsh: ssh add private keys
# ssh-agent and ssh-add
# ensure the authentication agent is running to hold
# private keys used for public key authentication (RSA, DSA, ECDSA, Ed25519).
if [ -z "$SSH_AUTH_SOCK" ] ; then
eval `ssh-agent`
fi
# add default rsa private key if it is not already added
ssh-add -l | grep -q `ssh-keygen -lf $HOME/.ssh/id_rsa | awk '{print $2}'` || ssh-add $HOME/.ssh/id_rsa
#!/usr/bin/env zsh
#
# Samples to use jq. jq is a lightweight and flexible command-line JSON processor.
# See: https://stedolan.github.io/jq/
# get a sub array and filter these elements twice like an AND condition and collect the result into a large array --slurp
curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes[] | select(.service=="EC2") | select(.region=="eu-central-1")' | jq -s .
@mdenkinger
mdenkinger / zsh-ssh-add-private-key.sh
Created January 2, 2020 08:00
zsh: ssh add private keys - install
#!/usr/bin/env zsh
while [ `grep -L ENCRYPTED $HOME/.ssh/id_rsa` ] ; do
echo "private key is not password protected!"
echo "setting password for $HOME/.ssh/id_rsa"
eval `ssh-keygen -p -f ~/.ssh/id_rsa`
done
mkdir -p $HOME/.zsh/snippets
pushd $HOME/.zsh/snippets
if cd zsh-ssh-add-private-keys; then
@mdenkinger
mdenkinger / jenkins_terraform_installations.groovy
Last active October 10, 2018 14:37
Jenkins Groovy Installer Terraform Plugin
import hudson.tools.InstallSourceProperty;
import hudson.tools.ToolProperty;
import hudson.tools.ToolPropertyDescriptor;
import hudson.util.DescribableList;
import org.jenkinsci.plugins.terraform.*;
/**
* configure Terraform installations for the Terraform Plugin
* https://wiki.jenkins.io/display/JENKINS/Terraform+Plugin
*
### Keybase proof
I hereby claim:
* I am mdenkinger on github.
* I am mdenkinger (https://keybase.io/mdenkinger) on keybase.
* I have a public key whose fingerprint is 41B9 1952 024A FC1F CA70 8F57 F4B9 F692 A0A6 0865
To claim this, I am signing this object: