Commit f899e629 authored by nimrod's avatar nimrod
Browse files

A commit that's just too big.

Too many changes in one commit that aren't relevant to each other all
because I didn't commit these for some time and they piled up, exactly
what I shouldn't do.

- Remove some Git submodules. They're not needed.
- Remove the REPREPRO_BASE_DIR environment variable, it's set with
direnv inside that project.
- Use Docker Buildkit.
- Use auto Python interpeter with Ansible, prefer Python3.
- Better ls aliases.
- Netcat aliases to listen and check ports and sockets.
- Aliases and functions for Terraform.
- Use Black to format Python code.
- Show the run duration and exit code in a line before the prompt, maybe
better with Bash earlier than 5.0, where there's an annoying with line
wrapping.
- Valid name for the flatpak_kill shell function.
- Delete user-dirs files, didn't do anything anyway.
- Convert README from reStructuredText to Markdown.
- Don't install gsutil with Python2, use snap to install the Google SDK.
- More pre-commit hooks, update the exiting ones, format the file for
yamllint, Use flake8 from it's repo, the one from the hooks repo is
deprecated.
- Clean the Shore SSH config.
- Add the shared AWS keys to the Endless SSH config.
parent 429fb60b
Loading
Loading
Loading
Loading
+57 −9
Original line number Diff line number Diff line
@@ -2,12 +2,12 @@
# If not running interactively, don't do anything
[ -z "$PS1" ] && return

export PS1='\u@\h:\w\$ '
export LANG=en_US.UTF8
export HISTFILE="$HOME/.history"
export HISTCONTROL=ignoreboth:erasedups
export HISTSIZE=100000
export HISTFILESIZE=100000
export REPREPRO_BASE_DIR="$HOME/Documents/Shore/debian-repository"
export EDITOR=vim
export GOPATH="$HOME/Documents/Golang"
export PATH="$GOPATH/bin:/usr/lib/go/bin/:$PATH"
@@ -33,6 +33,7 @@ export ANSIBLE_CACHE_PLUGIN_CONNECTION="$HOME/.ansible/facts"
export ANSIBLE_CALLBACK_WHITELIST="profile_tasks, timer"
export ANSIBLE_SSH_CONTROL_PATH="/tmp/ssh-%%h"
export ANSIBLE_INVENTORY_ANY_UNPARSED_IS_FAILED=True
export ANSIBLE_PYTHON_INTERPRETER=auto
export LYNX_SAVE_SPACE="$HOME/Downloads"
export LYNX_TEMP_SPACE="$HOME/.cache/lynx"
export VAGRANT_DEFAULT_PROVIDER="virtualbox"
@@ -49,10 +50,11 @@ export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
export LESS_TERMCAP_ue=$'\E[0m'
export HELM_HOME="$HOME/.helm"
export DOCKER_BUILDKIT=1

alias ll='ls -lha'
alias la='ls -A'
alias l='ls -CF'
alias la='ls -AF'
alias l='ls -F'
alias gcc='gcc --std=c99 -Wall -Wextra -Werror -pedantic'
alias dpkglog="grep -v 'status\\|trigproc\\|configure' /var/log/dpkg.log"
alias deborphan='deborphan -a --no-show-section --ignore-suggests'
@@ -78,7 +80,7 @@ alias tolower='awk "{print tolower(\$0)}"'
# shellcheck disable=SC2142
alias toupper='awk "{print toupper(\$0)}"'
alias wifi-portal='curl --silent --fail --write-out "%{redirect_url}" --output /dev/null http://detectportal.firefox.com/success.txt'
alias transmission-remote='ssh -fNo ExitOnForwardFailure=yes xbmc.shore.co.il && transmission-remote'
alias transmission-remote='forward xbmc.shore.co.il 9091:localhost:9091 && transmission-remote'
alias kpcli='kpcli --kdb ~/Documents/Database.kdbx'
alias gen-mac="hexdump -n5 -e '\"02\" 5/1 \":%02X\" \"\\n\"' /dev/urandom"
alias clean-swp="find \$HOME/ -name '*.swp' -delete"
@@ -113,6 +115,51 @@ alias prune_docker_remote='find ~/.ssh -maxdepth 1 -type s -name "docker_*" -del
alias close='ssh -fnNTS ~/.ssh/%C.sock -O exit'
alias jjb='jenkins-jobs'
alias diff='diff --unified'
alias check_tcp='nc -vzw1'
alias check_unix='nc -Uvzw1'
alias listen_tcp='nc -vlk 0.0.0.0'
alias listen_udp='nc -uvlk 0.0.0.0'
alias listen_unix='nc -Uvlk'
alias ta='terraform apply tfplan'

if ! command -v notify-send > /dev/null
then
    alias notify-send='bell'
elif [ -n "$GIO_LAUNCHED_DESKTOP_FILE" ]
then
    # shellcheck disable=SC2139
    alias notify-send="notify-send --hint \"string:desktop-entry:$(basename "$GIO_LAUNCHED_DESKTOP_FILE")\""
fi

tp () {
    workspace="$(terraform workspace show)"
    if [ "$workspace" = "default" ]
    then
        terraform plan -out tfplan "$@"
    else
        terraform plan -out tfplan -var-file "$workspace.tfvars" "$@"
    fi
}

taa () {
    workspace="$(terraform workspace show)"
    if [ "$workspace" = "default" ]
    then
        terraform apply -auto-approve "$@"
    else
        terraform apply -auto-approve -var-file "$workspace.tfvars" "$@"
    fi
}

tr () {
    workspace="$(terraform workspace show)"
    if [ "$workspace" = "default" ]
    then
        terraform refresh "$@"
    else
        terraform refresh -var-file "$workspace.tfvars" "$@"
    fi
}

genpass () {
    bytes="${1:-32}"
@@ -219,7 +266,7 @@ match_ssl_pair () {
    return "$exitcode"
}

flatpak-kill () {
flatpak_kill () {
    if [ "$#" -lt 1 ]
    then
        echo "You must specify application name." >> /dev/stderr
@@ -236,15 +283,16 @@ flatpak-kill () {

__prompt () {
    local exitstatus="$?"
    local runduration endtime
    local runduration endtime pre_prompt
    ! [ "$(type history 2> /dev/null)" = 'history is a shell builtin' ] || history -a
    PS1='\u@\h:\w\$ '
    if [ -n "${starttime:-}" ]
    then
        endtime="$(date +%s)"
        runduration="$(( endtime - starttime))"
        [ "$runduration" -lt '10' ] || PS1="\\[\\e[1;96m[Run duration: $runduration]\\e[0m\\] $PS1"
        [ "$exitstatus" -eq '0' ] || [ -z "${run_command:-}" ] || PS1="\\[\\e[1;91m[Exit status: $exitstatus]\\e[0m\\] $PS1"
        pre_prompt=''
        [ "$exitstatus" -eq '0' ] || [ -z "${run_command:-}" ] || pre_prompt="$pre_prompt\\e[1;91m[Exit status: $exitstatus]\\e[0m "
        [ "$runduration" -lt '5' ] || pre_prompt="$pre_prompt\\e[1;96m[Run duration: $runduration]\\e[0m "
        [ -z "$pre_prompt" ] || echo -e "$pre_prompt"
        unset run_command
    fi
    last_command='__prompt'

.config/user-dirs.dirs

deleted100644 → 0
+0 −15
Original line number Diff line number Diff line
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
+0 −1
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ go get github.com/kaorimatz/mysqldump-loader || true
go get github.com/lucagrulla/cw || true
go get sigs.k8s.io/kind || true
echo Installing Python apps >> /dev/stderr
python2 -m pip install --user gsutil
python3 -m pip install --user --requirement requirements.txt
echo Downloading binary and vendored files, creating generated files >> /dev/stderr
git clean -fX .bash_completion.d/
+0 −7
Original line number Diff line number Diff line
@@ -10,14 +10,7 @@
	path = Documents/Shore/bundle_certs
	url = https://www.shore.co.il/git/bundle_certs/
	branch = master
[submodule "Documents/Shore/debian-repository"]
	path = Documents/Shore/debian-repository
	url = https://www.shore.co.il/git/debian-repository
	branch = master
[submodule "Documents/Shore/ansible-desktop-playbooks"]
	path = Documents/Shore/Ansible/ansible-desktop-playbooks
	url = https://www.shore.co.il/git/ansible-desktop-playbooks
	branch = master
[submodule "Documents/Shore/poquita"]
    path = Documents/Shore/poquita
    url = https://www.shore.co.il/git/poquita
+74 −18
Original line number Diff line number Diff line
# vim:ff=unix ts=2 sw=2 ai expandtab
---
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
@@ -9,21 +10,76 @@ repos:
      - id: check-symlinks
      - id: detect-private-key
      - id: trailing-whitespace
    -   id: flake8
        exclude: pythonrc.py|rabbitmqadmin
      - id: requirements-txt-fixer
  - repo: https://www.shore.co.il/git/shell-pre-commit/
    rev: v0.6.0
    hooks:
      - id: shell-lint
        exclude: &excluded_shellscripts \.bash_completion\.d/(docker-machine\.bash|fabric-completion.bash|docker-compose)|\.travis/travis\.sh
        exclude: &excluded_shellscripts |-
          \.bash_completion\.d/(docker-machine\.bash|fabric-completion.bash|docker-compose)|\.travis/travis\.sh
      - id: shellcheck
        exclude: *excluded_shellscripts
      - id: shell-lint
        alias: shell-lint .bashrc
        name: shell-lint .bashrc
        files: \.bashrc
        types: [text]
      - id: shellcheck
        alias: Shellcheck .bashrc
        name: Shellcheck .bashrc
        files: \.bashrc
        types: [text]
  - repo: https://github.com/adrienverge/yamllint
    rev: v1.17.0
    hooks:
      - id: yamllint
  - repo: https://github.com/amperser/proselint/
    rev: 0.10.1
    hooks:
      - id: proselint
        types: [plain-text]
        exclude: LICENSE
  - repo: https://github.com/ambv/black
    rev: 18.9b0
    hooks:
      - id: black
        exclude: &excluded_pythonscripts pythonrc.py|rabbitmqadmin
        args:
          - |
              --line-length=79
  - repo: https://github.com/PyCQA/prospector
    rev: 1.1.6.4
    hooks:
      - id: prospector
        exclude: *excluded_pythonscripts
        args:
          - |-
              --max-line-length=79
          - |-
              --tool=pyroma
          - |-
              --tool=dodgy
        additional_dependencies:
          - pyroma
          - dodgy
  - repo: https://gitlab.com/pycqa/flake8
    rev: 3.7.7
    hooks:
      - id: flake8
        exclude: *excluded_pythonscripts
        args:
          - |-
            --max-line-length=79
        additional_dependencies:
          - flake8-bugbear
  - repo: https://github.com/pre-commit/mirrors-pylint
    rev: v2.3.1
    hooks:
      - id: pylint
        exclude: *excluded_pythonscripts
        args:
          - |-
            --disable=R0801
  - repo: https://github.com/PyCQA/bandit
    rev: 1.6.1
    hooks:
      - id: bandit
        exclude: *excluded_pythonscripts
Loading