Skip to content

Instantly share code, notes, and snippets.


Fabian cmndrsp0ck

View GitHub Profile
cmndrsp0ck / init.vim
Last active Mar 18, 2020
neovim configuration file
View init.vim
" Plugin management
" Download vim-plug from the URL below and follow the installation
" instructions:
call plug#begin('~/.vim/plugged')
" Dependencies
View centos7-90-digitalocean.cfg
# DigitalOcean: this file was written via cloud-init and composed from /etc/cloud/cloud.cfg
# In order to support resize events, 'growpart' and 'resizefs' are run each boot.
# 'update_etc_hosts' will be run only once per instance. To see the differences, run
# 'diff -u /etc/cloud/cloud.cfg /etc/cloud/cloud.cfg.d/90-digitalocean.cfg'.
- default
cmndrsp0ck /
Created Apr 11, 2019 — forked from Kartones/
PostgreSQL command line cheatsheet


Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
cmndrsp0ck /
Last active Mar 20, 2019 — forked from innovia/
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
View GitDeleteCommands.ps1
## Delete a remote branch
$ git push origin --delete <branch> # Git version 1.7.0 or newer
$ git push origin :<branch> # Git versions older than 1.7.0
## Delete a local branch
$ git branch --delete <branch>
$ git branch -d <branch> # Shorter version
$ git branch -D <branch> # Force delete un-merged branches
## Delete a local remote-tracking branch
cmndrsp0ck / consul.service
Created Sep 10, 2018 — forked from yunano/consul.service
View consul.service
Description=consul agent
ExecStart=/usr/local/sbin/consul agent $OPTIONS -config-dir=/etc/consul.d
cmndrsp0ck / consul-template.service
Created Sep 10, 2018 — forked from yunano/consul-template.service
View consul-template.service
Description=consul-template consul.service vault.service
ExecStart=/usr/local/sbin/consul-template $OPTIONS -config=/etc/consul-template.d
cmndrsp0ck /
Created Jul 9, 2018 — forked from rponte/
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
cmndrsp0ck /
Last active Feb 9, 2019 — forked from hofmannsven/
My simply Git Cheatsheet
cmndrsp0ck /
Created May 23, 2018
Generate random number of variable digit length
function randNum() {
# Generate random number of variable length with a default of 5 digits
local val
local len=${1:-5}
for (( x=0; x<${len}; x++ )); do
val+=($(echo $((RANDOM%9))));
printf -- "%s" "${val[@]}"