Skip to content

Instantly share code, notes, and snippets.

@DALDEI
DALDEI / bash-getopt-example.sh
Last active August 29, 2015 14:26 — forked from hercynium/bash-getopt-example.sh
declarative getopt in bash
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
source /bath/to/bash-getopt
foo_dflt="wibble"
bash-getopt "$@" <<END_OPTS
@DALDEI
DALDEI / git-mv-with-history
Created May 16, 2016 15:20 — forked from emiller/git-mv-with-history
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@DALDEI
DALDEI / .bashrc
Last active February 2, 2018 11:50 — forked from miracle2k/.bashrc
Convert an existing docker container into a "docker run" command line
# Convert an existing docker container into a "docker run" command line.
#
# This is useful when trying to debug containers that have been created
# by orchestration tools.
#
# Install jq: stedolan.github.io/jq/
# Improved version that handles ports, volumes, binds
function format_run() {
cid=$1
@DALDEI
DALDEI / yq
Created June 2, 2017 20:12 — forked from earonesty/yq
#!/bin/env python
import yaml
import sys
import json
import argparse
from subprocess import Popen, PIPE
import argparse
import os