Loading .bashrc +30 −22 Original line number Diff line number Diff line # shellcheck disable=SC2148,SC1091 # If not running interactively, don't do anything [ -z "$PS1" ] && return Loading @@ -11,14 +12,14 @@ then shopt -s histappend shopt -s checkwinsize shopt -s cmdhist if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi [ -f /etc/bash_completion ] && . /etc/bash_completion [ -d $HOME/.bash_completion.d ] && . $HOME/.bash_completion.d/* # shellcheck disable=SC2086,SC1090 [ -d "$HOME/.bash_completion.d" ] && . $HOME/.bash_completion.d/* # shellcheck disable=SC1090 # added by travis gem [ -f $HOME/.travis/travis.sh ] && source $HOME/.travis/travis.sh [ -f "$HOME/.travis/travis.sh" ] && . "$HOME/.travis/travis.sh" fi # make less more friendly for non-text input files, see lesspipe(1) Loading @@ -31,15 +32,13 @@ fi # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then eval "`dircolors -b`" eval "$(dircolors -b)" alias ls='ls --color=auto' alias grep='grep --color=auto' fi if [ -f /usr/local/bin/virtualenvwrapper.sh ] then . /usr/local/bin/virtualenvwrapper.sh fi # shellcheck disable=SC2142 [ -f /usr/local/bin/virtualenvwrapper.sh ] && . /usr/local/bin/virtualenvwrapper.sh export REPREPRO_BASE_DIR=$HOME/Documents/Shore/debian-repository export EDITOR=vim Loading @@ -60,6 +59,7 @@ alias deborphan='deborphan -a --no-show-section --ignore-suggests' alias aptitude='aptitude --display-format %p --quiet' alias obsolete='aptitude search ?obsolete' alias missing-recommends="aptitude search '~RBrecommends:~i'" # shellcheck disable=2142 alias deinstalled="dpkg --get-selections | awk '\$2==\"deinstall\" {print \$1}'" alias ansible-local='ansible localhost -c local -i localhost,' alias ansible-local-playbook='ansible-playbook -i localhost, -c local' Loading @@ -76,24 +76,27 @@ alias 0-day-cleanup='ssh xbmc.shore.co.il "sudo -u debian-transmission find /srv alias httpbin='tox -c $HOME/.tox.ini.httpbin --' deduce-aws-region () { export AWS_DEFAULT_REGION="$(curl --silent \ AWS_DEFAULT_REGION="$(curl --silent \ http://169.254.169.254/latest/dynamic/instance-identity/document \ | sed -n 's/ *"region" : "\([a-z0-9\-]*\)"/\1/gp')" export AWS_DEFAULT_REGION echo "$AWS_DEFAULT_REGION" } ssh-keyscan-add () { (ssh-keyscan $@; cat $HOME/.ssh/known_hosts) | sort -u >> $HOME/.ssh/known_hosts # shellcheck disable=SC2094 (ssh-keyscan "$@"; cat "$HOME/.ssh/known_hosts") | sort -u >> "$HOME/.ssh/known_hosts" } gen-csr () { openssl req -new -newkey rsa:4096 -nodes -out $1.csr -keyout $1.key openssl req -new -newkey rsa:4096 -nodes -out "$1.csr" -keyout "$1.key" } docker-dev () { local root="$(git rev-parse --show-toplevel)" local repo="$(basename $root)" local uid="$(id -u)" 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 \ Loading @@ -102,7 +105,7 @@ docker-dev () { --tty \ --volume "$HOME:$HOME" \ --volume "$root:$root" \ --user $uid \ --user "$uid" \ --workdir "$PWD" "$repo:dev" /bin/sh -l } Loading @@ -113,14 +116,19 @@ sync-comics () { } update-requirements () { cd $(git rev-parse --show-toplevel) for file in $(git ls-files *requirements*.txt) reporoot="$(git rev-parse --show-toplevel) || (echo Failed to find Git repo. && return 1)" # shellcheck disable=SC2164 cd "$reporoot" for file in $(git ls-files "*requirements*.txt") do pur --requirement $file git add $file pur --requirement "$file" git add "$file" done git commit -m"- Updated requirements." # shellcheck disable=SC2164 cd - > /dev/null } . $HOME/Documents/Shore/bundle_certs/bundle_certs # shellcheck disable=SC1090 . "$HOME/Documents/Shore/bundle_certs/bundle_certs" .pre-commit-config.yaml 0 → 100644 +14 −0 Original line number Diff line number Diff line - repo: git://github.com/pre-commit/pre-commit-hooks sha: v0.7.1 hooks: - id: check-added-large-files - id: check-merge-conflict - id: flake8 files: \.pythonstartup|Documents/Shore/cleanup/vagrant-.* - repo: https://www.shore.co.il/git/shell-pre-commit/ sha: v0.4.0 hooks: - id: shell-lint files: \.bash_completion\.d/molecule|\.bashrc|\.githooks/post-merge|\.profile|Documents/Shore/cleanup/.*-clean|Documents/train-wifi\.sh - id: shellcheck files: \.bashrc|\.githooks/post-merge|\.profile|Documents/Shore/cleanup/docker-.*|Documents/train-wifi\.sh .profile +1 −0 Original line number Diff line number Diff line # shellcheck disable=SC2148 export ENV="$HOME/.bashrc" Documents/Shore/cleanup/docker-clean +4 −4 Original line number Diff line number Diff line #!/bin/sh docker rm $(docker ps --quiet --filter=status=exited) 2>/dev/null || true docker rm $(docker ps --quiet --filter=status=created) 2>/dev/null || true docker rmi $(docker images --quiet --filter=dangling=true) 2>/dev/null || true docker volume rm $(docker volume ls --quiet --filter=dangling=true) 2>/dev/null || true docker rm "$(docker ps --quiet --filter=status=exited)" 2>/dev/null || true docker rm "$(docker ps --quiet --filter=status=created)" 2>/dev/null || true docker rmi "$(docker images --quiet --filter=dangling=true)" 2>/dev/null || true docker volume rm "$(docker volume ls --quiet --filter=dangling=true)" 2>/dev/null || true Documents/Shore/cleanup/docker-update +1 −1 Original line number Diff line number Diff line #!/bin/sh -e for image in $(docker images | awk '$1!="<none>" && NR>1 {printf("%s:%s\n", $1, $2)}') do docker pull $image || echo "Skipping..." docker pull "$image" || echo "Skipping..." done Loading
.bashrc +30 −22 Original line number Diff line number Diff line # shellcheck disable=SC2148,SC1091 # If not running interactively, don't do anything [ -z "$PS1" ] && return Loading @@ -11,14 +12,14 @@ then shopt -s histappend shopt -s checkwinsize shopt -s cmdhist if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi [ -f /etc/bash_completion ] && . /etc/bash_completion [ -d $HOME/.bash_completion.d ] && . $HOME/.bash_completion.d/* # shellcheck disable=SC2086,SC1090 [ -d "$HOME/.bash_completion.d" ] && . $HOME/.bash_completion.d/* # shellcheck disable=SC1090 # added by travis gem [ -f $HOME/.travis/travis.sh ] && source $HOME/.travis/travis.sh [ -f "$HOME/.travis/travis.sh" ] && . "$HOME/.travis/travis.sh" fi # make less more friendly for non-text input files, see lesspipe(1) Loading @@ -31,15 +32,13 @@ fi # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then eval "`dircolors -b`" eval "$(dircolors -b)" alias ls='ls --color=auto' alias grep='grep --color=auto' fi if [ -f /usr/local/bin/virtualenvwrapper.sh ] then . /usr/local/bin/virtualenvwrapper.sh fi # shellcheck disable=SC2142 [ -f /usr/local/bin/virtualenvwrapper.sh ] && . /usr/local/bin/virtualenvwrapper.sh export REPREPRO_BASE_DIR=$HOME/Documents/Shore/debian-repository export EDITOR=vim Loading @@ -60,6 +59,7 @@ alias deborphan='deborphan -a --no-show-section --ignore-suggests' alias aptitude='aptitude --display-format %p --quiet' alias obsolete='aptitude search ?obsolete' alias missing-recommends="aptitude search '~RBrecommends:~i'" # shellcheck disable=2142 alias deinstalled="dpkg --get-selections | awk '\$2==\"deinstall\" {print \$1}'" alias ansible-local='ansible localhost -c local -i localhost,' alias ansible-local-playbook='ansible-playbook -i localhost, -c local' Loading @@ -76,24 +76,27 @@ alias 0-day-cleanup='ssh xbmc.shore.co.il "sudo -u debian-transmission find /srv alias httpbin='tox -c $HOME/.tox.ini.httpbin --' deduce-aws-region () { export AWS_DEFAULT_REGION="$(curl --silent \ AWS_DEFAULT_REGION="$(curl --silent \ http://169.254.169.254/latest/dynamic/instance-identity/document \ | sed -n 's/ *"region" : "\([a-z0-9\-]*\)"/\1/gp')" export AWS_DEFAULT_REGION echo "$AWS_DEFAULT_REGION" } ssh-keyscan-add () { (ssh-keyscan $@; cat $HOME/.ssh/known_hosts) | sort -u >> $HOME/.ssh/known_hosts # shellcheck disable=SC2094 (ssh-keyscan "$@"; cat "$HOME/.ssh/known_hosts") | sort -u >> "$HOME/.ssh/known_hosts" } gen-csr () { openssl req -new -newkey rsa:4096 -nodes -out $1.csr -keyout $1.key openssl req -new -newkey rsa:4096 -nodes -out "$1.csr" -keyout "$1.key" } docker-dev () { local root="$(git rev-parse --show-toplevel)" local repo="$(basename $root)" local uid="$(id -u)" 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 \ Loading @@ -102,7 +105,7 @@ docker-dev () { --tty \ --volume "$HOME:$HOME" \ --volume "$root:$root" \ --user $uid \ --user "$uid" \ --workdir "$PWD" "$repo:dev" /bin/sh -l } Loading @@ -113,14 +116,19 @@ sync-comics () { } update-requirements () { cd $(git rev-parse --show-toplevel) for file in $(git ls-files *requirements*.txt) reporoot="$(git rev-parse --show-toplevel) || (echo Failed to find Git repo. && return 1)" # shellcheck disable=SC2164 cd "$reporoot" for file in $(git ls-files "*requirements*.txt") do pur --requirement $file git add $file pur --requirement "$file" git add "$file" done git commit -m"- Updated requirements." # shellcheck disable=SC2164 cd - > /dev/null } . $HOME/Documents/Shore/bundle_certs/bundle_certs # shellcheck disable=SC1090 . "$HOME/Documents/Shore/bundle_certs/bundle_certs"
.pre-commit-config.yaml 0 → 100644 +14 −0 Original line number Diff line number Diff line - repo: git://github.com/pre-commit/pre-commit-hooks sha: v0.7.1 hooks: - id: check-added-large-files - id: check-merge-conflict - id: flake8 files: \.pythonstartup|Documents/Shore/cleanup/vagrant-.* - repo: https://www.shore.co.il/git/shell-pre-commit/ sha: v0.4.0 hooks: - id: shell-lint files: \.bash_completion\.d/molecule|\.bashrc|\.githooks/post-merge|\.profile|Documents/Shore/cleanup/.*-clean|Documents/train-wifi\.sh - id: shellcheck files: \.bashrc|\.githooks/post-merge|\.profile|Documents/Shore/cleanup/docker-.*|Documents/train-wifi\.sh
.profile +1 −0 Original line number Diff line number Diff line # shellcheck disable=SC2148 export ENV="$HOME/.bashrc"
Documents/Shore/cleanup/docker-clean +4 −4 Original line number Diff line number Diff line #!/bin/sh docker rm $(docker ps --quiet --filter=status=exited) 2>/dev/null || true docker rm $(docker ps --quiet --filter=status=created) 2>/dev/null || true docker rmi $(docker images --quiet --filter=dangling=true) 2>/dev/null || true docker volume rm $(docker volume ls --quiet --filter=dangling=true) 2>/dev/null || true docker rm "$(docker ps --quiet --filter=status=exited)" 2>/dev/null || true docker rm "$(docker ps --quiet --filter=status=created)" 2>/dev/null || true docker rmi "$(docker images --quiet --filter=dangling=true)" 2>/dev/null || true docker volume rm "$(docker volume ls --quiet --filter=dangling=true)" 2>/dev/null || true
Documents/Shore/cleanup/docker-update +1 −1 Original line number Diff line number Diff line #!/bin/sh -e for image in $(docker images | awk '$1!="<none>" && NR>1 {printf("%s:%s\n", $1, $2)}') do docker pull $image || echo "Skipping..." docker pull "$image" || echo "Skipping..." done