diff options
author | terminaldweller <thabogre@gmail.com> | 2022-02-21 15:22:59 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2022-02-21 15:22:59 +0000 |
commit | 26d4cd29fe3e7cfc59c7964ddd054e83ce4d95dd (patch) | |
tree | 8669bd7744e81f9575264dc8db0055e6641e1618 | |
parent | updated haproxy for cargo (diff) | |
download | scripts-26d4cd29fe3e7cfc59c7964ddd054e83ce4d95dd.tar.gz scripts-26d4cd29fe3e7cfc59c7964ddd054e83ce4d95dd.zip |
updates
-rw-r--r-- | .bashrc | 112 | ||||
-rw-r--r-- | .inputrc | 11 | ||||
-rw-r--r-- | .kshrc | 2 | ||||
-rw-r--r-- | .screenrc | 1 | ||||
-rw-r--r-- | .vimrc | 6 | ||||
-rw-r--r-- | .zshrc | 8 | ||||
-rwxr-xr-x | bin/checkstyle | 3 | ||||
-rwxr-xr-x | bin/color | 7 | ||||
-rwxr-xr-x | bin/google-java-format | 3 | ||||
-rw-r--r-- | devi.zsh-theme | 11 | ||||
-rw-r--r-- | postit | 1 | ||||
-rw-r--r-- | terminaldweller.com/cargo/docker-compose.yaml | 2 | ||||
-rw-r--r-- | terminaldweller.com/cargo/nginx.conf | 2 | ||||
-rw-r--r-- | terminaldweller.com/haproxy/haproxy.cfg | 8 |
14 files changed, 74 insertions, 103 deletions
@@ -1,109 +1,25 @@ -# ~/.bashrc: executed by bash(1) for non-login shells. -# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) -# for examples - -# If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac -# don't put duplicate lines or lines starting with space in the history. -# See bash(1) for more options HISTCONTROL=ignoreboth - -# append to the history file, don't overwrite it -shopt -s histappend - -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000 -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. +shopt -s histappend shopt -s checkwinsize -# If set, the pattern "**" used in a pathname expansion context will -# match all files and zero or more directories and subdirectories. -#shopt -s globstar - -# make less more friendly for non-text input files, see lesspipe(1) -#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# set variable identifying the chroot you work in (used in the prompt below) if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi -# set a fancy prompt (non-color, unless we know we "want" color) -case "$TERM" in - xterm-color|*-256color) color_prompt=yes;; -esac - -# uncomment for a colored prompt, if the terminal has the capability; turned -# off by default to not distract the user: the focus in a terminal window -# should be on the output of commands, not on the prompt -#force_color_prompt=yes - -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi -fi - -if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' -else - PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' -fi -unset color_prompt force_color_prompt - -# If this is an xterm set the title to user@host:dir -case "$TERM" in -xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" - ;; -*) - ;; -esac - -# enable color support of ls and also add handy aliases -if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' - - #alias grep='grep --color=auto' - #alias fgrep='fgrep --color=auto' - #alias egrep='egrep --color=auto' -fi - -# colored GCC warnings and errors export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' -# some more ls aliases -#alias ll='ls -l' -#alias la='ls -A' -#alias l='ls -CF' - -# Alias definitions. -# You may want to put all your additions into a separate file like -# ~/.bash_aliases, instead of adding them here directly. -# See /usr/share/doc/bash-doc/examples in the bash-doc package. - if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi -# enable programmable completion features (you don't need to enable -# this, if it's already enabled in /etc/bash.bashrc and /etc/profile -# sources /etc/bash.bashrc). if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion @@ -135,3 +51,29 @@ alias ~="cd ~" alias grep="grep --color=auto" export LESS='--RAW-CONTROL-CHARS --ignore-case --status-column --LONG-PROMPT --HILITE-UNREAD --tabs=2' export PATH=$PATH:/usr/sbin + +disk_usage=$(df | grep /dev/sda1 | awk '{print $5}') + +# https://www.askapache.com/linux/bash-power-prompt/ +function aa_prompt_defaults () +{ + local colors=`tput colors 2>/dev/null||echo -n 1` C=; + + if [[ $colors -ge 256 ]]; then + C="`tput setaf 33 2>/dev/null`" + AA_P='mf=x mt=x n=0; while [[ $n < 1 ]];do read a mt a; read a mf a; (( n++ )); done</proc/meminfo; export AA_PP="\033[38;5;2m"$((mf/1024))/"\033[38;5;89m"$((mt/1024))MB--$disk_usage; unset -v mf mt n a' + else + C="`tput setaf 4 2>/dev/null`" + AA_P='mf=x mt=x n=0; while [[ $n < 1 ]];do read a mt a; read a mf a; (( n++ )); done</proc/meminfo; export AA_PP="\033[92m"$((mf/1024))/"\033[32m"$((mt/1024))MB--$disk_usage; unset -v mf mt n a' + fi; + + eval $AA_P; + + PROMPT_COMMAND='stty echo; history -a; echo -en "\e[34h\e[?25h"; (($SECONDS % 2==0 )) && eval $AA_P; echo -en "$AA_PP";'; + SSH_TTY=${SSH_TTY:-`tty 2>/dev/null||readlink /proc/$$/fd/0 2>/dev/null`} + + PS1="\[\e[m\n\e[1;32m\][\$\$:\$PPID \j:\!\[\e[1;31m\]]\[\e[0;36m\] \T \d \[\e[1;34m\][${C}\u@\H\[\e[1;34m\]:\[\e[0;37m\]${SSH_TTY/\/dev\/} \[\e[0;32m\]+${SHLVL}\[\e[1;31m\]] \[\e[1;37m\]\w\[\e[0;37m\]\n\\$ "; + + export PS1 AA_P PROMPT_COMMAND SSH_TTY +} +aa_prompt_defaults @@ -1 +1,12 @@ +set disable-completion off set editing-mode vi +set bell-style none +set blink-matching-paren on +set colored-completion-prefix on +set colored-stats on +set enable-bracketed-paste on +set match-hidden-files on +set page-completions on +set show-all-if-ambiguous on +set show-mode-in-prompt on +set visible-stats on @@ -89,4 +89,4 @@ function fd { export SHELL="ksh" export PATH=$PATH:/home/devi/scripts/bin -export PATH=$PATH:/home/devi/google-java-format +export PATH=$PATH:/home/devi/bin @@ -4,3 +4,4 @@ escape ^Bb defscrollback 1000 vbell off term screen-256color +altscreen on @@ -575,9 +575,9 @@ let g:tmux_navigator_no_mappings = 1 let g:tmux_navigator_disable_when_zoomed = 1 let g:tmux_navigator_save_on_switch = 2 " nnoremap <silent> <C-h> :TmuxNavigateLeft<cr> -nnoremap <silent> <C-j> :TmuxNavigateDown<cr> -nnoremap <silent> <C-k> :TmuxNavigateUp<cr> -nnoremap <silent> <C-l> :TmuxNavigateRight<cr> +" nnoremap <silent> <C-j> :TmuxNavigateDown<cr> +" nnoremap <silent> <C-k> :TmuxNavigateUp<cr> +" nnoremap <silent> <C-l> :TmuxNavigateRight<cr> nnoremap <silent> <C-w><C-w> :TmuxNavigatePrevious<cr> "vim.session options @@ -96,6 +96,7 @@ alias pirate-get="pirate-get -S ~/magnets/" alias vps="ssh 87.236.209.206 -l ubuntu -p 1022" alias vpn="ssh 192.99.102.52 -l rooot -p 1022" alias vpn2="ssh 145.239.165.137 -l rooot" +alias vpn3="ssh root@185.112.147.110 -p 2022" alias pytags="ctags --fields=+l --languages=python --python-kinds=-iv -R ." alias v="vim" alias kshrc="vim ~/scripts/.kshrc" @@ -153,9 +154,10 @@ alias zgit="proxychains4 git" alias zssh="proxychains4 ssh" alias zscp="proxychains4 scp" alias socks5z="ssh -N -D 9998 -o ExitOnForwardFailure=yes -l pi 192.168.1.108" -alias socks5ir="ssh -N -D 9997 -o ClientAliveInterval=0 ExitOnForwardFailure=yes -l ubuntu -p 1022 terminaldweller.com" -alias socks5vpn1="ssh -N -D 9999 -o ClientAliveInterval=0 ExitOnForwardFailure=yes -l rooot 145.239.165.137" -alias socks5vpn2="ssh -N -D 9996 -o ClientAliveInterval=0 ExitOnForwardFailure=yes -l rooot -p 1022 192.99.102.52" +alias socks5ir="ssh -N -D 9997 -o ExitOnForwardFailure=yes -l ubuntu -p 1022 terminaldweller.com" +alias socks5vpn1="ssh -N -D 9999 -o ExitOnForwardFailure=yes -l rooot 145.239.165.137" +alias socks5vpn2="ssh -N -D 9996 -o ExitOnForwardFailure=yes -l rooot -p 1022 192.99.102.52" +alias socks5vpn3="ssh -N -D 9995 -o ExitOnForwardFailure=yes -l root -p 2022 185.112.147.110" alias cloud_one="ssh 130.185.121.80 -l ubuntu -p 1022" alias zharf_server="zssh 192.168.12.5 -l farzad" alias k9sskin="vim ~/scripts/.k9s/skin.yml" diff --git a/bin/checkstyle b/bin/checkstyle new file mode 100755 index 0000000..40869c3 --- /dev/null +++ b/bin/checkstyle @@ -0,0 +1,3 @@ +#!/bin/sh + +exec env javac /home/devi/checkstyle/checkstyle-9.3-all.jar "$@" @@ -1,6 +1,7 @@ -#!/bin/sh -for i in {0..255};do - if (( i % 12 == 0 )); then echo;fi +#!/bin/bash +set -e +for i in $(seq 0 255);do + if [ $(( i % 12 )) = 0 ];then echo ;fi printf "\x1b[38;5;${i}mcolour${i}\x1b[0m\t" done echo diff --git a/bin/google-java-format b/bin/google-java-format new file mode 100755 index 0000000..43ca97f --- /dev/null +++ b/bin/google-java-format @@ -0,0 +1,3 @@ +#!/bin/sh + +exec env javac /home/devi/google-java-format/google-java-format-1.13.0-all-deps.jar "$@" diff --git a/devi.zsh-theme b/devi.zsh-theme index 8464cc5..26de429 100644 --- a/devi.zsh-theme +++ b/devi.zsh-theme @@ -61,6 +61,7 @@ if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then babyblue="%F{39}" somegreen="%F{22}" randomblue="%F{26}" + yaorange="%F{67}" else turquoise="$fg[cyan]" orange="$fg[yellow]" @@ -266,15 +267,18 @@ rebuildquery() { zstyle ':zsh-kubectl-prompt:' separator ':' getkubernetesinfo() { - local SUB_PROMPT="%{$somegreen%}<$ZSH_KUBECTL_USER:$ZSH_KUBECTL_PROMPT>%{$reset_color%}" + local SUB_PROMPT="%{$somegreen%}<<$ZSH_KUBECTL_USER:$ZSH_KUBECTL_PROMPT>>%{$reset_color%}" if [[ "$ZSH_KUBECTL_USER" =~ "admin" ]];then SUB_PROMPT="%{$someblue%}<$ZSH_KUBECTL_PROMPT>%{$reset_color%}" fi echo $SUB_PROMPT } -# PS1=$'%{$new2%}$(sudo_query)%{$reset_color%}%{$swampgreen%}%n%{$reset_color%} on %{$purblue%}%M%{$reset_color%} in %{$yagreen%}$(pwd_shortened)%{$reset_color%} at %{$muckgreen%}$(time_function)%{$reset_color%}$vcs_info_msg_0_%{$limblue%}%{$gnew%}$(gitadditions)%{$gnew2%}$(gitdeletions)%{$reset_color%}%{$deeppink%}$(virtualenv_info)%{$reset_color%}%{$teal%}$(node_version)%{$reset_color%}%{$gover%}$(goversion)%{$reset_color%}%{$rust%}$(rustversion)%{$reset_color%}%{$babyblue%}$(ruby_version)%{$reset_color%}%{$sneakyc%}$(sneaky)%{$reset_color%}%{$new%}$(rebuildquery)%{$reset_color%} %{$someblue%}<$ZSH_KUBECTL_USER:$ZSH_KUBECTL_PROMPT>%{$reset_color%}%{$batred%}$(dir_writeable)%{$reset_color%}' -PS1=$'%{$new2%}$(sudo_query)%{$reset_color%}%{$swampgreen%}%n%{$reset_color%} on %{$purblue%}%M%{$reset_color%} in %{$yagreen%}$(pwd_shortened)%{$reset_color%} at %{$muckgreen%}$(time_function)%{$reset_color%}$vcs_info_msg_0_%{$limblue%}%{$gnew%}$(gitadditions)%{$gnew2%}$(gitdeletions)%{$reset_color%}%{$deeppink%}$(virtualenv_info)%{$reset_color%}%{$teal%}$(node_version)%{$reset_color%}%{$gover%}$(goversion)%{$reset_color%}%{$rust%}$(rustversion)%{$reset_color%}%{$babyblue%}$(ruby_version)%{$reset_color%}%{$sneakyc%}$(sneaky)%{$reset_color%}%{$new%}$(rebuildquery)%{$reset_color%} $(getkubernetesinfo)%{$batred%}$(dir_writeable)%{$reset_color%}' +getterminal() { + if [ ! $TTY = "" ]; then echo $TTY;else echo $STY;fi +} + +PS1=$'%{$new2%}$(sudo_query)%{$reset_color%}%{$yablue%}%n@%M:$(getterminal)%{$reset_color%} %{$yagreen%}$(pwd_shortened)%{$reset_color%} %{$muckgreen%}$(time_function)%{$reset_color%}$vcs_info_msg_0_%{$limblue%}%{$gnew%}$(gitadditions)%{$gnew2%}$(gitdeletions)%{$reset_color%}%{$deeppink%}$(virtualenv_info)%{$reset_color%}%{$teal%}$(node_version)%{$reset_color%}%{$gover%}$(goversion)%{$reset_color%}%{$rust%}$(rustversion)%{$reset_color%}%{$babyblue%}$(ruby_version)%{$reset_color%}%{$sneakyc%}$(sneaky)%{$reset_color%}%{$new%}$(rebuildquery)%{$reset_color%} $(getkubernetesinfo)%{$batred%}$(dir_writeable)%{$reset_color%}' PS2=$'' PS3=$'\n%{$randomblue%}--➜%{$reset_color%}' get_prompt_len() { @@ -375,6 +379,7 @@ source ~/.oh-my-zsh/plugins/zle-vi-visual/zle_vi_visual.zsh function zle-line-init zle-keymap-select { RIGHT_PROMPT="%{$teal%}$timer_final%{$reset_color%} \ %{$lorange%}%?↵%{$reset_color%}\ +%{$yaorange%} L$SHLVL%{$reset_color%}\ %{$veryorange%}$(bg_job_count)%{$reset_color%}\ %{$bluesomething%}$(inranger)%{$reset_color%}" # %{$purple4%}$(get_prompt_len)%{$reset_color%}" @@ -35,3 +35,4 @@ xrandr --output eDP1 --mode 1920x1080 --right-of HDMI2 fc-list : family style https://smallpdf.com/jpg-to-pdf cat /home/devi/.clip_history | dmenu -l 10 | xsel -ib +git worktree add -b hotfix ~/code/hotfix trunk diff --git a/terminaldweller.com/cargo/docker-compose.yaml b/terminaldweller.com/cargo/docker-compose.yaml index 50eafab..ef2e1b8 100644 --- a/terminaldweller.com/cargo/docker-compose.yaml +++ b/terminaldweller.com/cargo/docker-compose.yaml @@ -12,5 +12,7 @@ services: volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - /home/ubuntu/cargo:/cargo + cap_drop: + - ALL networks: cargonet: diff --git a/terminaldweller.com/cargo/nginx.conf b/terminaldweller.com/cargo/nginx.conf index d65508d..118825c 100644 --- a/terminaldweller.com/cargo/nginx.conf +++ b/terminaldweller.com/cargo/nginx.conf @@ -11,7 +11,7 @@ http { ssl_ciphers HIGH:!aNULL:!MD5; sendfile on; tcp_nopush on; - + location / { root /cargo; autoindex on; diff --git a/terminaldweller.com/haproxy/haproxy.cfg b/terminaldweller.com/haproxy/haproxy.cfg index d9d6214..9a71d5e 100644 --- a/terminaldweller.com/haproxy/haproxy.cfg +++ b/terminaldweller.com/haproxy/haproxy.cfg @@ -32,8 +32,8 @@ frontend http use_backend blog-backend-cert if letsencrypt-acl blog-host use_backend api-crypto-backend-cert if letsencrypt-acl api-host crypto-api-acl use_backend api-mila-backend-cert if letsencrypt-acl api-host mila-api-acl - use_backend certbot-backend if letsencrypt-acl !chat-host !blog-host !api-host use_backend searx-backend if letsencrypt-acl searx-host + use_backend certbot-backend if letsencrypt-acl !chat-host !blog-host !api-host use_backend blog-backend if blog-host use_backend mail-backend if mail-host use_backend api-backend if api-host @@ -256,17 +256,17 @@ backend chat-backend-c2s server chat-host 130.185.121.80:5222 backend chat-cert-backend mode http - server chat-cert-server 130.185.121.80:80 + server chat-cert-server 130.185.121.80:8880 backend searx-backend mode http - server searx-host 185.126.202.69:80 + server searx-host 130.185.121.80:80 backend searx-backend-s timeout server 60s timeout client 60s mode tcp option ssl-hello-chk - server searx-host-s 185.126.202.69:443 + server searx-host-s 130.185.121.80:443 backend cargo-backend-s timeout server 60s |