Skip to content

Instantly share code, notes, and snippets.

View nicerobot's full-sized avatar
🤖
☯️ ☮️ 🐶 🐾 👾 🎮 🎼 🎶 🕺 🎧 🌻 🌱 🏞 🌊 🌔 🌎

nicerobot nicerobot

🤖
☯️ ☮️ 🐶 🐾 👾 🎮 🎼 🎶 🕺 🎧 🌻 🌱 🏞 🌊 🌔 🌎
View GitHub Profile
@nicerobot
nicerobot / README.md
Last active April 2, 2019 01:09
JS Fiddle GitGraph for Happy Path Feature Development Release Cycle
@nicerobot
nicerobot / .docker_aliases
Created December 26, 2018 03:17 — forked from cjus/.docker_aliases
Docker aliases
#!/bin/sh
alias dm='docker-machine'
alias dmx='docker-machine ssh'
alias dk='docker'
alias dki='docker images'
alias dks='docker service'
alias dkrm='docker rm'
alias dkl='docker logs'
alias dklf='docker logs -f'
@nicerobot
nicerobot / certificate
Created November 24, 2018 04:50
openssl to dump site certificate
openssl s_client -connect ${1:-google.com}:${2:-443} </dev/null | openssl x509 -in /dev/stdin -noout -text
@nicerobot
nicerobot / git-hash-tracked.sh
Last active March 13, 2019 00:25
Hash tracked git files
#!/usr/bin/env bash
# Useful for, for example, versioning docker images built from subdirectories in a mono-repo.
cd ${1:-.} || exit
git ls-tree -r --name-only $(git rev-parse --symbolic-full-name --abbrev-ref HEAD) \
| while read f; do [[ -d "${f}" ]] || [[ -f "${f}" ]] && echo ${f}; done \
| sort -fd \
| tr '\n' '\0' \
| xargs -0 openssl sha1 \
| openssl sha1
@nicerobot
nicerobot / gist:2f4fb758fe77c171cdfedcb664aee2b8
Created November 4, 2018 02:12
Generic script header to handle both source or invocation
#!/usr/bin/env bash
sourced() { [ 'bash' = "${0:-i}" ] || [ "${BASH_SOURCE[0]}" != "${0:-i}" ]; }
sourced && {
SELF=$(
[ "${ZSH_VERSION}" ] && echo "${(%):-%N}" \
|| [ "${BASH_VERSION}" ] && echo "${BASH_SOURCE[0]}" \
|| echo "${0}"
)
export SCRIPT_HOME=$(cd $(dirname ${SELF})/..; pwd)
@nicerobot
nicerobot / .gitignore
Created October 27, 2018 19:14 — forked from pepasflo/.gitignore
Scripts for encrypting / decrypting secrets (to prevent them from being accidentally checked into git)
secrets/
@nicerobot
nicerobot / preamble.sh
Created October 24, 2018 02:27
Common Bash variables
#!/usr/bin/env bash
STARTD=${PWD}
SELFD=$(cd $(dirname ${0}) >/dev/null 2>&1; pwd)
SELF=$(basename ${0})
SELFN=$(basename ${SELFD})
SELFU=${SELF%.*}
SELFZ=${SELFD}/${SELF}
NOW=$(date +%Y%m%dt%H%M%S)
UNQ=${NOW}.${RANDOM}
LOGD=${SELFD}/${SELFU}.${UNQ}
@nicerobot
nicerobot / tgzx
Last active August 9, 2019 04:13
Self-extracting, encrypted tarballs. Much simpler than https://www.linuxjournal.com/node/1005818
#!/usr/bin/env bash
tgzx() {
(( ${#} >= 2 )) || { echo 'usage: tgzx archive-file [files | directories]'; return 1; }
printf '#!/usr/bin/env bash\ntail -n+3 ${0} | openssl enc -aes-256-cbc -d -a | tar ${1:-xv}z; exit\n' >${1}
tar zc "${@:2}" | openssl enc -aes-256-cbc -a -salt >>${1} && chmod +x ${1}
}
@nicerobot
nicerobot / README.md
Last active May 22, 2022 12:57
PostgreSQL Kubernetes Service

Create the Kubernetes service

curl -s https://gist.githubusercontent.com/nicerobot/fef144c9328b487e85f7a6ccbd5f70bc/raw/kubectl | bash -s -- apply

Run psql

---
apiVersion: v1
kind: Service
metadata:
labels:
service: ambassador
name: ambassador
spec:
type: LoadBalancer
ports: