diff --git a/.bashrc b/.bashrc index 15ab928bb36d33c6adfbca0c8f9ce3efebaba475..47b6dd5cd0f56179ebb06e667fb509d776c3610d 100644 --- a/.bashrc +++ b/.bashrc @@ -52,7 +52,6 @@ alias ecr-login='eval $(aws ecr get-login)' alias hostlocal='docker run --rm --privileged --net=host gliderlabs/hostlocal' alias apt-daily="sudo /bin/sh -c 'apt-get update && apt-get dist-upgrade --download-only --yes && apt-get autoclean'" alias flatpak-daily='flatpak --user update --no-deploy' -alias docker-build='docker build -t "$(basename $PWD)" ./' alias cdtemp='cd $(mktemp -d)' alias 0-day-cleanup='ssh xbmc.shore.co.il "sudo -u debian-transmission find /srv/library/Comics -name *.part -path *0-Day\ Week\ of* -delete"' alias httpbin='gunicorn httpbin:app' @@ -73,7 +72,7 @@ alias clean-swp="find \$HOME/ -name '*.swp' -delete" alias unssh="ssh -o \"UserKnownHostsFile /dev/null\" -o \"StrictHostKeyChecking no\"" alias todo="vim \$HOME/Documents/TODO.yml" alias sudo="sudo " -alias presentation='docker run -itv "$PWD:/project" adarnimrod/presentation' +alias presentation='docker dev adarnimrod/presentation' alias prune_prerun='find "$HOME" -maxdepth 1 -name ".prerun.*" -print0 | grep -zv "$(pgrep -u "$(id -u)" bash)" | xargs -0r rm ' alias netdata='docker run --detach --name netdata --cap-add SYS_PTRACE --volume /proc:/host/proc:ro --volume /sys:/host/sys:ro --volume /var/run/docker.sock:/var/run/docker.sock --publish 19999:19999 firehol/netdata' alias json-tool='python3 -m json.tool' @@ -102,23 +101,6 @@ gen_csr () { openssl req -new -newkey rsa:4096 -nodes -out "$1.csr" -keyout "$1.key" } -docker_dev () { - local root repo uid - root="$(git rev-parse --show-toplevel)" - repo="$(basename "$root")" - uid="$(id -u)" - docker build -t "$repo:dev" "$root" - docker run --interactive \ - --publish-all \ - --name "$repo" \ - --rm \ - --tty \ - --volume "$HOME:$HOME" \ - --volume "$root:$root" \ - --user "$uid" \ - --workdir "$PWD" "$repo:dev" /bin/sh -l -} - sync_comics () { local this_month last_month format format='+xbmc.shore.co.il:/srv/library/Comics/0-Day\ Week\ of\ %Y.%m.*' diff --git a/Documents/bin/docker b/Documents/bin/docker new file mode 120000 index 0000000000000000000000000000000000000000..22cb46f8d7894a2aaf35ad42108135984c1f5cd8 --- /dev/null +++ b/Documents/bin/docker @@ -0,0 +1 @@ +wrapper \ No newline at end of file diff --git a/Documents/bin/docker-Build b/Documents/bin/docker-Build new file mode 100755 index 0000000000000000000000000000000000000000..dafc80732dcc4bd4a9d716cc4e515e9b0e3d2590 --- /dev/null +++ b/Documents/bin/docker-Build @@ -0,0 +1,3 @@ +#!/bin/sh +set -eu +docker build -t "$(basename "$PWD")" ./ diff --git a/Documents/bin/docker-dev b/Documents/bin/docker-dev new file mode 100755 index 0000000000000000000000000000000000000000..94157953304eeb64cb3d03223eefce82482646ae --- /dev/null +++ b/Documents/bin/docker-dev @@ -0,0 +1,3 @@ +#!/bin/sh +set -eu +docker run --rm -Pitv "$PWD:/volume" "$@" diff --git a/Documents/bin/wrapper b/Documents/bin/wrapper new file mode 100755 index 0000000000000000000000000000000000000000..1b8af530d06fd65ed18af69b3b400a1dc26e4fe5 --- /dev/null +++ b/Documents/bin/wrapper @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu + +basename="$(basename "$0")" +command="$(env -i which "$basename")" || { echo "$basename: not found"; exit 127; } +if alias="$(which "$basename-${1:-}")" +then + shift + "$alias" "$@" +else + "$command" "$@" +fi