Oct 2019 updates

This commit is contained in:
viktorbarzin 2019-10-13 23:47:59 +01:00
parent 922beef048
commit 0d405e8864
7 changed files with 1758 additions and 180 deletions

View file

@ -3,6 +3,7 @@ alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias py='python3'
alias ipy='ipython3'
alias whatisopen='sudo netstat -pnlt'
alias calc='gcalccmd'
alias pmr='python manage.py runserver'
@ -11,7 +12,7 @@ alias pmm='python manage.py migrate'
alias pmmm='python manage.py makemigrations'
# Start vim with system clipboard
# alias vim="vimx" # don't alias this - make symlink instead
alias vim="vimx" # don't alias this - make symlink instead
alias vi="vim"
# git aliases
@ -32,7 +33,7 @@ alias randomstr="tr -dc a-z1-4 </dev/urandom | tr 1-2 ' \n' | awk 'length==0 ||
alias battery="upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E 'time to empty|state|to\ full|percentage'"
alias svali_papka=download_github_folder
alias omg="sudo service NetworkManager restart"
alias omg1.1="sudo modprobe -rv iwldvm && sudo modprobe -r iwlwifi; sudo modprobe iwlwifi"
alias omg1.1="sudo rmmod iwlmvm && sudo rmmod iwlwifi; sudo modprobe iwlwifi"
alias zsh_fix="mv ~/.zsh_history ~/.zsh_history_bad; strings ~/.zsh_history_bad > ~/.zsh_history;fc -R ~/.zsh_history; rm ~/.zsh_history_bad"
alias myip="curl ifconfig.co"
alias rmswp="find ~/.vim/tmp/ -iname \"*swp\" -delete"
@ -47,7 +48,8 @@ alias root="sudo su -"
then
echo 'Rsync is running, not going to sleep.'
else
(/bin/lock &) && sudo systemctl suspend
# (/bin/lock &) && sudo systemctl suspend
sudo systemctl suspend
fi
}
@ -89,6 +91,7 @@ alias update="sudo $pm update"
alias upgrade="sudo $pm upgrade"
alias install="sudo $pm install"
alias remove="sudo $pm remove"
alias reinstall="sudo $pm reinstall"
# secureme(){
# workon ansible;
@ -175,16 +178,17 @@ alias remove="sudo $pm remove"
# sudo mount /dev/kubuntu-vg/$snapshot_name $mount_point
# sudo chroot $mount_point /bin/zsh
# }
wifi_int_name="$(cat /proc/net/wireless | perl -ne '/(\w+):/ && print $1')"
alias ifl="ifconfig|less"
# Docker aliases
alias dsl="docker swarm leave --force"
alias dsi="docker swarm init --advertise-addr=$(ifconfig wlp2s0 | grep inet | awk '/1/{print $2}')"
alias dsi="docker swarm init --advertise-addr=$wifi_int_name"
alias dsjtm="docker swarm join-token manager"
alias dsjtw="docker swarm join-token worker"
alias noip6="sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf/wlp2s0/disable_ipv6'"
alias yesip6="sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/wlp2s0/disable_ipv6'"
alias noip6="sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf/$wifi_int_name/disable_ipv6'"
alias yesip6="sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/$wifi_int_name/disable_ipv6'"
# alias omg2="killall plasmashell; plasmashell > /dev/null 2>&1 & disown"
alias omg2="kwin --replace &"
@ -225,8 +229,10 @@ alias lip="ifconfig $(route -n | head -n 3 | tail -n 1 | awk '{print $8}') | gre
#alias tldr="rm -r /home/viktor/.tldr_cache/ &> /dev/null; tldr"
alias sl=ls
alias vimrc="vim ~/.vimrc"
alias zshrc="vim ~/.zshrc"
alias f="free -h"
alias h="sudo htop"
alias a="sudo atop"
alias e="exa -bghHliS"
alias hosts="sudo vim /etc/hosts"
@ -348,6 +354,51 @@ function encrypt() {
gpg --symmetric $1.tar.gz
echo "Deleting $1 and $1.tar.gz"
rm -rf $1 $1.tar.gz
}
function decrypt() {
gpg --decrypt $1 | tar xzvf -
}
alias kb=kubectl
# use avr-gcc for latfortuna, but gcc works as well
function make_tags() {
avr-gcc -M $* | sed -e 's/[\\ ]/\n/g' | \
sed -e '/^$/d' -e '/\.o:[ \t]*$/d' | ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q
}
#alias server="python3 -m http.server --bind 0.0.0.0 8000"
alias server="/opt/miniserve-linux"
alias gr="go run"
alias hg="hugo -D server --bind 0.0.0.0"
alias logout="qdbus org.kde.ksmserver /KSMServer logout 0 0 0"
alias sucss="cd ~/pentesting/sucss-19 && workon sucss-playground-webapp"
alias i="sudo iotop"
alias ssucss="ssh sucss.ecs.soton.ac.uk"
alias gpc="globalprotect connect; sudo sed -i '1 i\\nameserver 152.78.110.110' /etc/resolv.conf"
alias gpd="globalprotect disconnect; sudo sed -i '1d' /etc/resolv.conf"
function whoishome() {
# echo "Finding connected devices..."
ips=$(nmap -sn 192.168.0.1/24 | grep for | awk '{print $5}')
# echo "Getting entries from ARP table..."
# Get entries in arp table
python3 -c '
import sys
users={
"C8:21:58:98:29:25": "lubo-laptop",
"2C:0E:3D:A7:C1:19": "viktor-phone",
"18:F0:E4:2A:CB:B0": "lubo-phone",
"A0:32:99:C4:0E:38": "nasko-phone",
"48:01:C5:39:A6:3D": "ioana-phone",
"48:89:E7:18:0E:66": "viktor-laptop",
}
# print("Connected device: ")
for line in sys.argv[1].split("\n"):
ip = line.split()[1].replace("(", "").replace(")", "")
mac = line.split()[3].upper()
if mac in users:
print(f"{users[mac]}")
' "$(arp -a | grep -v incomplete)"
}

View file

@ -9,7 +9,6 @@
# -- general -------------------------------------------------------------------
set -g default-shell /usr/bin/zsh
set -g default-terminal "screen-256color" # colors!
setw -g xterm-keys on
set -s escape-time 10 # faster command sequences
@ -33,17 +32,13 @@ bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
# -- display -------------------------------------------------------------------
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed
setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed
set -g set-titles off # set terminal title
# set -g set-titles on # set terminal title
# set -g set-titles-string '#h ❐ #S ● #I #W'
# set -g set-titles-string '#h #S #I #W'
# set -g set-titles-string '#{client_name} | #{host}"'
set -g set-titles on # set terminal title
set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000 # slightly longer status messages display time
@ -61,12 +56,11 @@ set -g visual-activity off
# -- navigation ----------------------------------------------------------------
# create session
#bind C-c new-session
bind C-c new-session
# find session
bind C-f command-prompt -p find-session 'switch-client -t %%'
set-window-option -g status-left " #S "
# split current window horizontally
bind - split-window -v
# split current window vertically
@ -81,7 +75,7 @@ bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one
# maximize current pane
bind + run 'cut -c3- ~/.tmux.conf | sh -s _maximize_pane #{session_name} #D'
bind + run 'cut -c3- ~/.tmux.conf | sh -s _maximize_pane "#{session_name}" #D'
# pane resizing
bind -r H resize-pane -L 2
@ -144,9 +138,12 @@ run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/nu
run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'
# copy to Mac OSX clipboard
# copy to macOS clipboard
if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"'
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"'
@ -171,6 +168,7 @@ if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'
# -- 8< ------------------------------------------------------------------------
run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
run -b '[ -z "#{session_id}" ] && [ -z "#{version}" ] && tmux set display-time 3000 \; display "This configuration will soon require tmux >= 2.4" \; set -u display-time || true'
# EOF
@ -178,6 +176,18 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# # exit the script if any statement returns a non-true return value
# set -e
#
# unset GREP_OPTIONS
# export LC_NUMERIC=C
#
# if ! printf '' | sed -E 's///' 2>/dev/null; then
# if printf '' | sed -r 's///' 2>/dev/null; then
# sed () {
# n=$#; while [ "$n" -gt 0 ]; do arg=$1; shift; case $arg in -E*) arg=-r${arg#-E};; esac; set -- "$@" "$arg"; n=$(( n - 1 )); done
# command sed "$@"
# }
# fi
# fi
#
# __newline='
# '
#
@ -185,7 +195,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# ( ([ x"$1" = x"enabled" ] || [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"1" ]) && return 0 ) || return 1
# }
#
# _circled_digit() {
# _circled() {
# circled_digits='⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳'
# if [ "$1" -le 20 ] 2>/dev/null; then
# i=$(( $1 + 1 ))
@ -196,28 +206,46 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# fi
# }
#
# if command -v perl > /dev/null 2>&1; then
# _decode_unicode_escapes() {
# printf '%s' "$*" | perl -CS -pe 's/(\\u([0-9A-Fa-f]{1,4})|\\U([0-9A-Fa-f]{1,8}))/chr(hex($2.$3))/eg' 2>/dev/null
# }
# elif bash --norc --noprofile -c '[[ ! $BASH_VERSION < 4.2. ]]' > /dev/null 2>&1; then
# _decode_unicode_escapes() {
# bash --norc --noprofile -c "printf '%b' '$*'"
# }
# elif command -v python > /dev/null 2>&1; then
# _decode_unicode_escapes() {
# python -c "import re; import sys; sys.stdout.write(re.sub(r'\\\U([0-9A-Fa-f]{1,8})', lambda match: r'\U%s' % match.group(1).zfill(8), r'$*').encode().decode('unicode-escape', 'ignore'))"
# }
# else
# _decode_unicode_escapes() {
# printf '%b' "$*"
# }
# fi
#
# _maximize_pane() {
# current_session=${1:-$(tmux display -p '#{session_name}')}
# current_pane=${2:-$(tmux display -p '#{pane_id}')}
#
# dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -o '^1 %.\+maximized.\+$' || true)
# restore=$(echo "$dead_panes" | sed -n -E -e "s/^1 $current_pane .+maximized.+(%[0-9]+)$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t $current_pane/p" -e "s/^1 (%[0-9]+) .+maximized.+$current_pane$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t \1/p" )
# dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -E -o '^1 %.+maximized.+$' || true)
# restore=$(echo "$dead_panes" | sed -n -E -e "s/^1 $current_pane .+maximized.+'(%[0-9]+)'$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t $current_pane/p" -e "s/^1 (%[0-9]+) .+maximized.+'$current_pane'$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t \1/p" )
#
# if [ -z "$restore" ]; then
# [ "$(tmux list-panes -t "$current_session:" | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return
# window=$(tmux new-window -t "$current_session:" -P "exec maximized... 2> /dev/null & tmux setw -t $current_session: remain-on-exit on; printf 'Pane has been maximized, press <prefix>+ to restore. %s' \\$current_pane")
# window=$(tmux new-window -t "$current_session:" -P "exec maximized... 2> /dev/null & tmux setw -t \"$current_session:\" remain-on-exit on; printf \"Pane has been maximized, press <prefix>+ to restore. %s\" '$current_pane'")
# window=${window%.*}
#
# guard=10
# while [ x"$(tmux list-panes -t "$window" -F '#{session_name}:#{window_index} #{pane_dead}' 2>/dev/null)" != x"$window 1" ] && [ "$guard" -ne 0 ]; do
# sleep 0.01
# guard=$((guard - 1))
# retry=10
# while [ x"$(tmux list-panes -t "$window" -F '#{session_name}:#{window_index} #{pane_dead}' 2>/dev/null)" != x"$window 1" ] && [ "$retry" -ne 0 ]; do
# sleep 0.05
# retry=$((retry - 1))
# done
# if [ "$guard" -eq 0 ]; then
# if [ "$retry" -eq 0 ]; then
# tmux display 'Unable to maximize pane'
# fi
#
# new_pane=$(tmux display -p '#{pane_id}')
# new_pane=$(tmux display -t "$window" -p '#{pane_id}')
# tmux setw -t "$window" remain-on-exit off \; swap-pane -s "$current_pane" -t "$new_pane"
# else
# $restore || tmux kill-pane
@ -239,6 +267,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# }
#
# _battery() {
# count=0
# charge=0
# uname_s=$(uname -s)
# case "$uname_s" in
@ -256,6 +285,8 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# ;;
# *Linux*)
# while IFS= read -r batpath; do
# grep -i -q device "$batpath/scope" 2> /dev/null && continue
#
# if [ x"$discharging" != x"true" ]; then
# discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false")
# fi
@ -301,7 +332,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# done
# ;;
# esac
# charge=$(awk -v charge="$charge" -v count="$count" 'BEGIN { print charge / count }')
# [ "$count" -ne 0 ] && charge=$(awk -v charge="$charge" -v count="$count" 'BEGIN { print charge / count }')
# if [ "$charge" -eq 0 ]; then
# tmux set -ug '@battery_status' \;\
# set -ug '@battery_bar' \;\
@ -354,7 +385,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# [ x"$palette_style" = x"gradient" ] && \
# palette="196 202 208 214 220 226 190 154 118 82 46"
# [ x"$palette_style" = x"heat" ] && \
# palette="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196"
# palette="243 245 247 144 143 142 184 214 208 202 196"
#
# palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }')
# eval set -- "$palette"
@ -453,60 +484,91 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# set -g '@battery_percentage' "$battery_percentage"
# }
#
# _tty_info() {
# tty="${1##/dev/}"
# uname -s | grep -q "CYGWIN" && cygwin=true
#
# if [ x"$cygwin" = x"true" ]; then
# ps -af | tail -n +2 | awk -v tty="$tty" '
# ((/ssh/ && !/-W/) || !/ssh/) && $4 == tty {
# user[$2] = $1; parent[$2] = $3; child[$3] = $2
# }
# END {
# for (i in user)
# {
# if (!(i in child) && parent[i] != 1)
# {
# file = "/proc/" i "/cmdline"; getline command < file; close(file)
# gsub(/\0/, " ", command)
# print i, user[i], command
# exit
# }
# }
# }
# '
# else
# ps -t "$tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk '
# NR > 1 && ((/ssh/ && !/-W/) || !/ssh/) {
# user[$2] = $1; parent[$2] = $3; child[$3] = $2; for (i = 4 ; i <= NF; ++i) command[$2] = i > 4 ? command[$2] FS $i : $i
# }
# END {
# for (i in parent)
# {
# if (!(i in child) && parent[i] != 1)
# {
# print i, user[i], command[i]
# exit
# }
# }
# }
# '
# fi
# }
#
# _ssh_or_mosh_args() {
# args=$(printf '%s' "$1" | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }')
# if [ -z "$args" ]; then
# args=$(printf '%s' "$1" | grep 'mosh-client' | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g')
# fi
#
# printf '%s' "$args"
# }
#
# _username() {
# tty=${1:-$(tmux display -p '#{pane_tty}')}
# ssh_only=$2
# # shellcheck disable=SC2039
# if [ x"$OSTYPE" = x"cygwin" ]; then
# pid=$(ps -a | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { print $1 }')
# [ -n "$pid" ] && ssh_parameters=$(tr '\0' ' ' < "/proc/$pid/cmdline" | sed 's/^ssh //')
# else
# ssh_parameters=$(ps -t "$tty" -o command= | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }')
# fi
# if [ -n "$ssh_parameters" ]; then
#
# tty_info=$(_tty_info "$tty")
# command=$(printf '%s' "$tty_info" | cut -d' ' -f3-)
#
# ssh_or_mosh_args=$(_ssh_or_mosh_args "$command")
# if [ -n "$ssh_or_mosh_args" ]; then
# # shellcheck disable=SC2086
# username=$(ssh -G $ssh_parameters 2>/dev/null | awk 'NR > 2 { exit } ; /^user / { print $2 }')
# username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk 'NR > 2 { exit } ; /^user / { print $2 }')
# # shellcheck disable=SC2086
# [ -z "$username" ] && username=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" $ssh_parameters 2>&1 | awk '/^%username% / { print $2; exit }')
# [ -z "$username" ] && username=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%username% / { print $2; exit }')
# else
# if ! _is_enabled "$ssh_only"; then
# # shellcheck disable=SC2039
# if [ x"$OSTYPE" = x"cygwin" ]; then
# username=$(whoami)
# else
# username=$(ps -t "$tty" -o user= -o pid= -o ppid= -o command= | awk '
# !/ssh/ { user[$2] = $1; ppid[$3] = 1 }
# END {
# for (i in user)
# if (!(i in ppid))
# {
# print user[i]
# exit
# }
# }
# ')
# fi
# username=$(printf '%s' "$tty_info" | cut -d' ' -f2)
# fi
# fi
#
# echo "$username"
# printf '%s' "$username"
# }
#
# _hostname() {
# tty=${1:-$(tmux display -p '#{pane_tty}')}
# ssh_only=$2
# # shellcheck disable=SC2039
# if [ x"$OSTYPE" = x"cygwin" ]; then
# pid=$(ps -a | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { print $1 }')
# [ -n "$pid" ] && ssh_parameters=$(tr '\0' ' ' < "/proc/$pid/cmdline" | sed 's/^ssh //')
# else
# ssh_parameters=$(ps -t "$tty" -o command= | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }')
# fi
# if [ -n "$ssh_parameters" ]; then
#
# tty_info=$(_tty_info "$tty")
# command=$(printf '%s' "$tty_info" | cut -d' ' -f3-)
#
# ssh_or_mosh_args=$(_ssh_or_mosh_args "$command")
# if [ -n "$ssh_or_mosh_args" ]; then
# # shellcheck disable=SC2086
# hostname=$(ssh -G $ssh_parameters 2>/dev/null | awk 'NR > 2 { exit } ; /^hostname / { print $2 }')
# hostname=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk 'NR > 2 { exit } ; /^hostname / { print $2 }')
# # shellcheck disable=SC2086
# [ -z "$hostname" ] && hostname=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%hostname%% %h >&2'" $ssh_parameters 2>&1 | awk '/^%hostname% / { print $2; exit }')
# [ -z "$hostname" ] && hostname=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%hostname%% %h >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%hostname% / { print $2; exit }')
# #shellcheck disable=SC1004
# hostname=$(echo "$hostname" | awk '\
# { \
@ -521,7 +583,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# fi
# fi
#
# echo "$hostname"
# printf '%s' "$hostname"
# }
#
# _root() {
@ -542,6 +604,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# now=$(date +%s)
# ;;
# *Linux*|*CYGWIN*|*MSYS*|*MINGW*)
# boot=0
# now=$(cut -d' ' -f1 < /proc/uptime)
# ;;
# *OpenBSD*)
@ -552,12 +615,16 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# awk -v boot="$boot" -v now="$now" '
# BEGIN {
# uptime = now - boot
# y = int(uptime / 31536000)
# dy = int(uptime / 86400) % 365
# d = int(uptime / 86400)
# h = int(uptime / 3600) % 24
# m = int(uptime / 60) % 60
# s = int(uptime) % 60
#
# system("tmux set -g @uptime_d " d + 0 " \\; " \
# system("tmux set -g @uptime_y " y + 0 " \\; " \
# "set -g @uptime_dy " dy + 0 " \\; " \
# "set -g @uptime_d " d + 0 " \\; " \
# "set -g @uptime_h " h + 0 " \\; " \
# "set -g @uptime_m " m + 0 " \\; " \
# "set -g @uptime_s " s + 0)
@ -581,19 +648,22 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# _split_window() {
# tty=${1:-$(tmux display -p '#{pane_tty}')}
# shift
# # shellcheck disable=SC2039
# if [ x"$OSTYPE" = x"cygwin" ]; then
# pid=$(ps -a | sort -d | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && !/-W/ { print $1; exit 0 }')
# [ -n "$pid" ] && ssh=$(tr '\0' ' ' < "/proc/$pid/cmdline")
# else
# ssh=$(ps -t "$tty" -o command= | sort -d | awk '/ssh/ && !/-W/ { print $0; exit 0 }')
# fi
# if [ -n "$ssh" ]; then
# # shellcheck disable=SC2046
# tmux split-window "$@" $(echo "$ssh" | sed -e "s/;/\\\\;/g")
# else
# tmux split-window "$@"
# fi
#
# tty_info=$(_tty_info "$tty")
# command=$(printf '%s' "$tty_info" | cut -d' ' -f3-)
#
# case "$command" in
# *mosh-client*)
# # shellcheck disable=SC2046
# tmux split-window "$@" mosh $(echo "$command" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/')
# ;;
# *ssh*)
# # shellcheck disable=SC2046
# tmux split-window "$@" $(echo "$command" | sed -e 's/;/\\;/g')
# ;;
# *)
# tmux split-window "$@"
# esac
# }
#
# _apply_overrides() {
@ -603,7 +673,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# screen-*|tmux-*)
# ;;
# *)
# tmux set-option -ga terminal-overrides ",$TERM:Tc"
# tmux set-option -ga terminal-overrides ",*256col*:Tc"
# ;;
# esac
# fi
@ -625,7 +695,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# fi
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'new-window\(\s\+-c\s\+"#{pane_current_path}\|$\)')
# $(tmux list-keys 2>/dev/null | grep -E 'new-window(\s+-c\s+"#{pane_current_path}"|$)')
# EOF
#
# tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true}
@ -633,13 +703,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# [ -z "$line" ] && continue
# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then
# right=$(printf '%s' "$line" | cut -c"$column-" | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/split-window([ \t]+-(h|v))?$/& -c "#{pane_current_path}"/g')
# right=$(printf '%s' "$line" | cut -c"$column-" | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e '/#\{pane_current_path\}/!s/split(-|_)window([ \t]+#\{pane_tty\})?([ \t]+-(h|v))?/& -c "#{pane_current_path}"/g')
# else
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/-c[ \t]+"#\{pane_current_path\}"$//g')
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/[ \t]+(-c[ \t]+(\\")?"#\{pane_current_path\}"(\\")?|-c #\{pane_current_path\})//g')
# fi
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'split\(-\|_\)window')
# $(tmux list-keys 2>/dev/null | grep -E 'split(-|_)window')
# EOF
#
# tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false}
@ -647,13 +717,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# [ -z "$line" ] && continue
# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/split-window([^;]+)/run-shell "cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1"/g')
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e '/_split_window/!s/"/\\"/g' -e 's/split-window([^;]*)/run-shell "cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1"/g')
# else
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/run-shell "cut -c3- ~\/\.tmux\.conf \| sh -s _split_window #\{pane_tty\}([^;]+)"/split-window\1/g' -e 's/#\{.+\}/\"&\"/g')
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/\\"/"/g' -e 's/run-shell "cut -c3- ~\/\.tmux\.conf \| sh -s _split_window #\{pane_tty\}([^;]*)"/split-window\1/g' -e 's/#\{.+\}/\"&\"/g')
# fi
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'split\(-\|_\)window')
# $(tmux list-keys 2>/dev/null | grep -E 'split(-|_)window')
# EOF
#
# tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false}
@ -661,13 +731,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# [ -z "$line" ] && continue
# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# if _is_enabled "$tmux_conf_new_session_prompt"; then
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/new-session$/command-prompt -p new-session \"new-session -s %%\"/g')
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/new-session$/command-prompt -p new-session \"new-session -s '"'"'%%'"'"'\"/g')
# else
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }'| sed -E -e 's/command-prompt -p new-session[^;]+/new-session/g')
# fi
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'new-session')
# $(tmux list-keys 2>/dev/null | grep 'new-session')
# EOF
#
# tmux_conf_copy_to_os_clipboard=${tmux_conf_copy_to_os_clipboard:-false}
@ -681,10 +751,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# if [ -n "$command" ]; then
# # shellcheck disable=SC2086
# for table in "" "-t emacs-copy" "-t vi-copy"; do
# line=$(tmux list-keys $table 2>/dev/null | grep -e 'copy-selection\|copy-pipe' | head -1)
# line=$(tmux list-keys $table 2>/dev/null | grep -E 'copy-selection|copy-pipe' | head -1)
# [ -z "$line" ] && continue
# prefix=${line%copy-*}
# column=${#prefix}
# [ -z "$line" ] && continue
#
# while IFS= read -r line; do
# [ -z "$line" ] && continue
@ -692,11 +762,11 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e "s/copy-selection(-and-cancel)?$/copy-pipe\1 \"$command\"/g")
# else
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e "s/copy-pipe(-and-cancel)? \"$command\"$/copy-selection\1/g")
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e "s/copy-pipe(-and-cancel)? \"?$command\"?$/copy-selection\1/g")
# fi
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys $table 2>/dev/null | grep -e 'copy-selection\|copy-pipe')
# $(tmux list-keys $table 2>/dev/null | grep -E 'copy-selection|copy-pipe')
# EOF
# done
# fi
@ -747,10 +817,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
#
# # -- status line -------------------------------------------------------
#
# tmux_conf_theme_left_separator_main=${tmux_conf_theme_left_separator_main-''}
# tmux_conf_theme_left_separator_sub=${tmux_conf_theme_left_separator_sub-'|'}
# tmux_conf_theme_right_separator_main=${tmux_conf_theme_right_separator_main-''}
# tmux_conf_theme_right_separator_sub=${tmux_conf_theme_right_separator_sub-'|'}
# tmux_conf_theme_left_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_main-''}")
# tmux_conf_theme_left_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_sub-'|'}")
# tmux_conf_theme_right_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_main-''}")
# tmux_conf_theme_right_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_sub-'|'}")
#
# tmux_conf_theme_message_fg=${tmux_conf_theme_message_fg:-'#000000'} # black
# tmux_conf_theme_message_bg=${tmux_conf_theme_message_bg:-'#ffff00'} # yellow
@ -774,6 +844,17 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# set -g status-left-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\
# set -g status-right-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr"
#
# tmux_conf_theme_terminal_title=${tmux_conf_theme_terminal_title:-'#h ❐ #S ● #I #W'}
#
# tmux_conf_theme_terminal_title=$(echo "$tmux_conf_theme_terminal_title" | sed \
# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \
# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g')
# tmux set -g set-titles-string "$(_decode_unicode_escapes "$tmux_conf_theme_terminal_title")"
#
# tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-'#8a8a8a'} # white
# tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-'#080808'} # dark gray
# tmux_conf_theme_window_status_attr=${tmux_conf_theme_window_status_attr:-'none'}
@ -784,18 +865,30 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_theme_window_status_current_attr=${tmux_conf_theme_window_status_current_attr:-'bold'}
# tmux_conf_theme_window_status_current_format=${tmux_conf_theme_window_status_current_format:-'#I #W'}
# if [ x"$(tmux show -g -v status-justify)" = x"right" ]; then
# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_window_status_bg]$tmux_conf_theme_right_separator_main#[fg=default,bg=default,default] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_right_separator_main"
# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_window_status_bg]$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_right_separator_main"
# else
# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg]$tmux_conf_theme_left_separator_main#[fg=default,bg=default,default] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none]$tmux_conf_theme_left_separator_main"
# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg]$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none]$tmux_conf_theme_left_separator_main"
# fi
#
# tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | sed 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #I)%g')
# tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #I)%g')
# tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | sed \
# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \
# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g')
# tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed \
# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \
# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g')
#
# tmux setw -g window-status-style "fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr" \;\
# setw -g window-status-format "$tmux_conf_theme_window_status_format" \;\
# setw -g window-status-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_format")" \;\
# setw -g window-status-current-style "fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr" \;\
# setw -g window-status-current-format "$tmux_conf_theme_window_status_current_format"
# setw -g window-status-current-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_current_format")"
#
# tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-'default'}
# tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-'default'}
@ -829,6 +922,11 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_theme_root_bg=${tmux_conf_theme_root_bg:-'none'}
# tmux_conf_theme_root_attr=${tmux_conf_theme_root_attr:-'bold,blink'}
#
# tmux_conf_theme_synchronized=${tmux_conf_theme_synchronized:-'🔒'} # U+1F512
# tmux_conf_theme_synchronized_fg=${tmux_conf_theme_synchronized_fg:-'none'}
# tmux_conf_theme_synchronized_bg=${tmux_conf_theme_synchronized_bg:-'none'}
# tmux_conf_theme_synchronized_attr=${tmux_conf_theme_synchronized_attr:-'none'}
#
# # -- status left style
#
# tmux_conf_theme_status_left=${tmux_conf_theme_status_left-' ❐ #S '}
@ -845,6 +943,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \
# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} #D)#[inherit]%g")
#
# tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \
# -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized,}%g")
#
# if [ -n "$tmux_conf_theme_status_left" ]; then
# status_left=$(awk \
# -v fg_="$tmux_conf_theme_status_left_fg" \
@ -929,6 +1030,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \
# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} #D)#[inherit]%g")
#
# tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \
# -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized,}%g")
#
# if [ -n "$tmux_conf_theme_status_right" ]; then
# status_right=$(awk \
# -v fg_="$tmux_conf_theme_status_right_fg" \
@ -1017,14 +1121,14 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \
# -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g')
#
# tmux set -g '@battery_bar_symbol_full' "$tmux_conf_battery_bar_symbol_full" \;\
# set -g '@battery_bar_symbol_empty' "$tmux_conf_battery_bar_symbol_empty" \;\
# tmux set -g '@battery_bar_symbol_full' "$(_decode_unicode_escapes "$tmux_conf_battery_bar_symbol_full")" \;\
# set -g '@battery_bar_symbol_empty' "$(_decode_unicode_escapes "$tmux_conf_battery_bar_symbol_empty")" \;\
# set -g '@battery_bar_length' "$tmux_conf_battery_bar_length" \;\
# set -g '@battery_bar_palette' "$tmux_conf_battery_bar_palette" \;\
# set -g '@battery_hbar_palette' "$tmux_conf_battery_hbar_palette" \;\
# set -g '@battery_vbar_palette' "$tmux_conf_battery_vbar_palette" \;\
# set -g '@battery_status_charging' "$tmux_conf_battery_status_charging" \;\
# set -g '@battery_status_discharging' "$tmux_conf_battery_status_discharging"
# set -g '@battery_status_charging' "$(_decode_unicode_escapes "$tmux_conf_battery_status_charging")" \;\
# set -g '@battery_status_discharging' "$(_decode_unicode_escapes "$tmux_conf_battery_status_discharging")"
# status_right="#(cut -c3- ~/.tmux.conf | sh -s _battery)$status_right"
# ;;
# esac
@ -1045,14 +1149,18 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# esac
#
# case "$status_left $status_right" in
# *'#{uptime_d}'*|*'#{uptime_h}'*|*'#{uptime_m}'*)
# *'#{uptime_d}'*|*'#{uptime_h}'*|*'#{uptime_m}'*|*'#{uptime_s}'*)
# status_left=$(echo "$status_left" | sed -E \
# -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \
# -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \
# -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \
# -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \
# -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \
# -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g')
# status_right=$(echo "$status_right" | sed -E \
# -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \
# -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \
# -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \
# -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \
# -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \
# -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g')
@ -1070,11 +1178,11 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# ;;
# esac
#
# status_left=$(echo "$status_left" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g')
# status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g')
# status_left=$(echo "$status_left" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g')
# status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g')
#
# tmux set -g status-left-length 1000 \; set -g status-left "$status_left" \;\
# set -g status-right-length 1000 \; set -g status-right "$status_right"
# tmux set -g status-left-length 1000 \; set -g status-left "$(_decode_unicode_escapes "$status_left")" \;\
# set -g status-right-length 1000 \; set -g status-right "$(_decode_unicode_escapes "$status_right")"
#
# # -- clock -------------------------------------------------------------
#
@ -1102,7 +1210,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# _apply_overrides
# _apply_bindings
# _apply_theme
# for name in $(printenv | grep -Eo '^tmux_conf_[^=]+'); do tmux setenv -gu "$name"; done;
# for name in $(printenv | grep -E -o '^tmux_conf_[^=]+'); do tmux setenv -gu "$name"; done;
# }
#
# _urlview() {
@ -1116,3 +1224,18 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# }
#
# "$@"
# Custom added - MUST be in the end
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-processes 'vi vim nvim man less more tail top htop'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'

View file

@ -90,19 +90,39 @@ tmux_conf_theme_status_fg='#8a8a8a' # light gray
tmux_conf_theme_status_bg='#080808' # dark gray
tmux_conf_theme_status_attr='none'
# terminal title
# - built-in variables are:
# - #{circled_window_index}
# - #{circled_session_name}
# - #{hostname}
# - #{hostname_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_terminal_title='#h ❐ #S ● #I #W'
# window status style
# - built-in variables are:
# - #{circled_window_index}
# - #{circled_session_name}
# - #{hostname}
# - #{hostname_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_window_status_fg='#8a8a8a' # light gray
tmux_conf_theme_window_status_bg='#080808' # dark gray
tmux_conf_theme_window_status_attr='none'
tmux_conf_theme_window_status_format='#I #W'
#tmux_conf_theme_window_status_format='#{circled_window_index} #W'
# tmux_conf_theme_window_status_format='#I #W#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}'
#tmux_conf_theme_window_status_format='#I #W#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}'
# window current status style
# - built-in variables are:
# - #{circled_window_index}
# - #{circled_session_name}
# - #{hostname}
# - #{hostname_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_window_status_current_fg='#000000' # black
tmux_conf_theme_window_status_current_bg='#00afff' # light blue
tmux_conf_theme_window_status_current_attr='bold'
@ -126,14 +146,14 @@ tmux_conf_theme_window_status_last_bg='default'
tmux_conf_theme_window_status_last_attr='none'
# status left/right sections separators
tmux_conf_theme_left_separator_main=''
tmux_conf_theme_left_separator_sub='|'
tmux_conf_theme_right_separator_main=''
tmux_conf_theme_right_separator_sub='|'
tmux_conf_theme_left_separator_main='' # /!\ you don't need to install Powerline
tmux_conf_theme_left_separator_sub='' # you only need fonts patched with
tmux_conf_theme_right_separator_main='' # Powerline symbols or the standalone
tmux_conf_theme_right_separator_sub='' # PowerlineSymbols.otf font
# tmux_conf_theme_left_separator_main=''
# tmux_conf_theme_left_separator_sub='|'
# tmux_conf_theme_right_separator_main=''
# tmux_conf_theme_right_separator_sub='|'
tmux_conf_theme_left_separator_main='\uE0B0' # /!\ you don't need to install Powerline
tmux_conf_theme_left_separator_sub='\uE0B1' # you only need fonts patched with
tmux_conf_theme_right_separator_main='\uE0B2' # Powerline symbols or the standalone
tmux_conf_theme_right_separator_sub='\uE0B3' # PowerlineSymbols.otf font, see README.md
# status left/right content:
# - separate main sections with '|'
@ -151,17 +171,21 @@ tmux_conf_theme_right_separator_sub='' # PowerlineSymbols.otf font
# - #{pairing}
# - #{prefix}
# - #{root}
# - #{uptime_d}
# - #{synchronized}
# - #{uptime_y}
# - #{uptime_d} (modulo 365 when #{uptime_y} is used)
# - #{uptime_h}
# - #{uptime_m}
# - #{uptime_s}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} '
tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} '
# tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} '
tmux_conf_theme_status_right="IP:#(ifconfig $(route -n | sed -n '3p' | awk '{print $8}') | grep 'inet ' | cut -d ' ' -f 10) , \
DNS:#(echo $(cat /etc/resolv.conf | grep 'nameserver [0-9]' | awk '{print $2}')) , \
Gateway:#(echo $(route -n | sed -n '3p' | awk '{print $2}')) #{prefix}#{pairing} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname}"
# status left style
tmux_conf_theme_status_left_fg='#000000,#e4e4e4,#e4e4e4' # black, white , white
tmux_conf_theme_status_left_bg='#ffff00,#ff00af,#00afff' # yellow, pink, white blue
@ -169,17 +193,17 @@ tmux_conf_theme_status_left_attr='bold,none,none'
# status right style
tmux_conf_theme_status_right_fg='#8a8a8a,#e4e4e4,#000000' # light gray, white, black
tmux_conf_theme_status_right_bg='#080808,#d70000,#e4e4e4' # white, dark gray, red, white
tmux_conf_theme_status_right_bg='#080808,#d70000,#e4e4e4' # dark gray, red, white
tmux_conf_theme_status_right_attr='none,none,bold'
# pairing indicator
tmux_conf_theme_pairing='👓' # U+1F453
tmux_conf_theme_pairing='👓 ' # U+1F453
tmux_conf_theme_pairing_fg='none'
tmux_conf_theme_pairing_bg='none'
tmux_conf_theme_pairing_attr='none'
# prefix indicator
tmux_conf_theme_prefix='⌨' # U+2328
tmux_conf_theme_prefix='⌨ ' # U+2328
tmux_conf_theme_prefix_fg='none'
tmux_conf_theme_prefix_bg='none'
tmux_conf_theme_prefix_attr='none'
@ -190,11 +214,17 @@ tmux_conf_theme_root_fg='none'
tmux_conf_theme_root_bg='none'
tmux_conf_theme_root_attr='bold,blink'
# synchronized indicator
tmux_conf_theme_synchronized='🔒' # U+1F512
tmux_conf_theme_synchronized_fg='none'
tmux_conf_theme_synchronized_bg='none'
tmux_conf_theme_synchronized_attr='none'
# battery bar symbols
tmux_conf_battery_bar_symbol_full='◼'
tmux_conf_battery_bar_symbol_empty='◻'
#tmux_conf_battery_bar_symbol_full='♥'
#tmux_conf_battery_bar_symbol_empty='·'
# tmux_conf_battery_bar_symbol_full='◼'
# tmux_conf_battery_bar_symbol_empty='◻'
tmux_conf_battery_bar_symbol_full='♥'
tmux_conf_battery_bar_symbol_empty='·'
# battery bar length (in number of symbols), possible values are:
# - auto
@ -223,17 +253,28 @@ tmux_conf_battery_vbar_palette='gradient'
#tmux_conf_battery_vbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green
# symbols used to indicate whether battery is charging or discharging
tmux_conf_battery_status_charging='↑' # U+2191
tmux_conf_battery_status_discharging='↓' # U+2193
#tmux_conf_battery_status_charging='⚡ ' # U+26A1
#tmux_conf_battery_status_charging='🔌 ' # U+1F50C
#tmux_conf_battery_status_discharging='🔋 ' # U+1F50B
# tmux_conf_battery_status_charging='↑' # U+2191
# tmux_conf_battery_status_discharging='↓' # U+2193
tmux_conf_battery_status_charging='⚡ ' # U+26A1
tmux_conf_battery_status_charging='🔌 ' # U+1F50C
tmux_conf_battery_status_discharging='🔋 ' # U+1F50B
# clock style
# clock style (when you hit <prefix> + t)
# you may want to use %I:%M %p in place of %R in tmux_conf_theme_status_right
tmux_conf_theme_clock_colour='#00afff' # light blue
tmux_conf_theme_clock_style='24'
# -- clipboard -----------------------------------------------------------------
# in copy mode, copying selection also copies to the OS clipboard
# - true
# - false (default)
# on macOS, this requires installing reattach-to-user-namespace, see README.md
# on Linux, this requires xsel or xclip
tmux_conf_copy_to_os_clipboard=false
# -- user customizations -------------------------------------------------------
# this is the place to override or undo settings
@ -241,19 +282,19 @@ tmux_conf_theme_clock_style='24'
#set -g history-limit 10000
# start with mouse mode enabled
set -g mouse on
# set -g mouse off
#set -g mouse on
# force Vi mode
# really you should export VISUAL or EDITOR environment variable, see manual
#set -g status-keys vi
#set -g mode-keys vi
set-window-option -g mode-keys vi
set -g status-keys vi
set -g mode-keys vi
# replace C-b by Alt-a (M-a) instead of using both prefixes
set -gu prefix2
unbind C-a
unbind C-b
# replace C-b by C-a instead of using both prefixes
# set -gu prefix2
# unbind C-a
# unbind C-b
# set -g prefix C-a
# bind C-a send-prefix
set -g prefix M-x
bind M-x send-prefix
@ -261,7 +302,7 @@ bind M-x send-prefix
#set -g status-position top
bind \ split-window -h -c "#{pane_current_path}" # Split panes horizontal
bind - split-window -v -c "#{pane_current_path}" # Split panes vertically
# Use Alt-vim keys without prefix key to switch panes
bind -n M-h select-pane -L
bind -n M-j select-pane -D
@ -280,10 +321,8 @@ bind k resize-pane -U 5
bind l resize-pane -R 5
bind h resize-pane -L 5
run-shell /home/viktor/.tmux/resurrect/resurrect.tmux
# Copy to system clipboard using xlip
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind-key s set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"

28
.vimrc
View file

@ -63,12 +63,6 @@ let g:xptemplate_key = '<Tab>'
"inoremap <Caps> <space><space><space><space>
" Python main method snippet
"let g:xptemplate_brace_complete = '([{<'
let g:xptemplate_minimal_prefix = 1
" let g:xptemplate_vars="$author=viktor.barzin"
" let g:xptemplate_vars="$email=viktor.barzin@samitor.com"
" Rebind <Leader> key
" I like to have it here becuase it is easier to reach than the default and
" it is next to ``m`` and ``n`` which I use for navigating between tabs.
@ -126,6 +120,7 @@ let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline_powerline_fonts=1
" let g:airline_section_b = '%{strftime("%c")}'
" let g:airline_section_y = 'BN: %{bufnr("%")} FT: %y'
let g:airline#extensions#ale#enabled = 1
" Enable wildmenu which is an enhanced command completion
"
@ -223,7 +218,7 @@ syntax on
vnoremap // y/<C-R>"<CR>
" Showing line numbers and length
" set tw=79 " width of document (used by gd)
set tw=79 " width of document (used by gd)
" set tw=120 " width of document (used by gd)
set nowrap " don't automatically wrap on load
set fo-=t " don't automatically wrap text when typing
@ -437,3 +432,22 @@ nnoremap <F6> :GundoToggle<CR>
augroup encrypted
autocmd BufNewFile */soton/*/coursework* :X
augroup END
" SEttings for Go
let g:neocomplete#enable_at_startup = 1 " DO NOT MOVE in another file
let g:xptemplate_key = '<Space><Space>'
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['eslint'],
\}
" Put these lines at the very end of your vimrc file.
" Load all plugins now.
" Plugins need to be added to runtimepath before helptags can be generated.
packloadall
" Load all of the helptags now, after plugins have been loaded.
" All messages and errors will be ignored.
silent! helptags ALL

15
.zshenv
View file

@ -1,15 +0,0 @@
# export PYENV_ROOT="$HOME/.pyenv"
# export PATH="$PYENV_ROOT/bin:$PATH"
# eval "$(pyenv init -)"
#export PATH="/home/viktor/.pyenv/bin:$PATH"
#eval "$(pyenv init -)"
#eval "$(pyenv virtualenv-init -)"
export VIRTUALENVWRAPPER_PYTHON=python3
export VIRTUALENV_PYTHON=python3
export WORKON_HOME=$HOME/.virtualenvs
# export VIRTUALENV_PYTHON=python
source /home/viktor/.virtualenvwrapper.sh

16
.zshrc
View file

@ -118,7 +118,8 @@ j () {
# source /usr/local/bin/virtualenvwrapper.sh
# eval ssh-agent > /dev/null
VIRTUALENVWRAPPER_PYTHON=python3
# VIRTUALENVWRAPPER_PYTHON=python3
export PYTHONBREAKPOINT=ipdb.set_trace
source ~/.zshenv
# Color man pages
@ -142,3 +143,16 @@ bindkey '^x^e' edit-command-line
# Vi style:
# zle -N edit-command-line
# bindkey -M vicmd v edit-command-line
# add GO to path
export PATH="/home/viktor/go/bin:$PATH"
# add JDK 12 go path
export PATH="/opt/jdk-12.0.1/bin:$PATH"
# add azure core tools to path
export PATH="/opt/azure/:$PATH"
# add k8s autocompletion
# source <(kubectl completion zsh)
unset command_not_found_handle

1352
virtualenvwrapper.sh Normal file

File diff suppressed because it is too large Load diff