From af89305dfee7222bdbbdc8b9572c9c80575541ad Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Sat, 10 Dec 2022 11:04:35 +0330 Subject: update --- .tmux.conf | 5 +++- .w3m/cgi-bin/fzf_surfraw_tmux.cgi | 2 +- .w3m/cgi-bin/restore_session.cgi | 2 +- .w3m/keymap | 4 +-- .zshrc | 29 ++++++++++---------- stylus/kernel_org.css | 20 ++++++++++++++ tmux/date.sh | 14 ++++------ tmux/vcs_info.sh | 58 +++++++++++++++++---------------------- 8 files changed, 74 insertions(+), 60 deletions(-) create mode 100644 stylus/kernel_org.css diff --git a/.tmux.conf b/.tmux.conf index 9a4deb1..a6f397b 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -47,7 +47,8 @@ set-option -g prefix C-a set -g status-interval 120 set-option -g history-limit 10000 set-option -g repeat-time 500 -set -g display-time 1000 +set -g display-time 0 +set status-keys vi #prefix highlight settings set -g @prefix_highlight_show_copy_mode 'on' @@ -172,6 +173,8 @@ continuumStatus="#[fg=colour16 bg=colour70 bold]#(xkb-switch -p)#[nobold]#{?#{pa sshStatus="#{?#{pane_ssh_connected},#[fg=colour15 bold],#[fg=colour15 nobold]}#U@#H#{?#{pane_ssh_connected},:#{pane_ssh_port}#[fg=colour31 bg=colour26],#[fg=colour24 bg=colour26]}" set-option -g status-left "#{prefix_highlight}$wg_is_keys_off$continuumStatus$sshStatus#[nobold]#(/home/devi/scripts/tmux/vcs_info.sh)" set-option -g status-right "#(/home/devi/scripts/tmux/date.sh)#{online_status}" +# set-option -g status-left ">>>" +# set-option -g status-right "<<<" current_window_format="#{?window_zoomed_flag,#[fg=colour63#, bg=colour16]#[fg=colour63#, bg=colour16#, bold] Z #W #[fg=colour63#, bg=colour16],#[fg=colour255#, bg=colour16] #I #W #[fg=colour255#, bg=colour16]}" diff --git a/.w3m/cgi-bin/fzf_surfraw_tmux.cgi b/.w3m/cgi-bin/fzf_surfraw_tmux.cgi index 11516fd..1c1bafb 100755 --- a/.w3m/cgi-bin/fzf_surfraw_tmux.cgi +++ b/.w3m/cgi-bin/fzf_surfraw_tmux.cgi @@ -34,7 +34,7 @@ PREFIX=$(surfraw -elvi | grep -v 'LOCAL\|GLOBAL'| fzf -e | awk '{print $1}') if [ "$PREFIX" = "" ]; then exit; fi # get user input -read -r -e -p " $PREFIX >> Enter Your Search Keyword: " INPUT +read -r " $PREFIX >> Enter Your Search Keyword: " INPUT # print proper url and copy to primary clipboard (aka highlighted clipboard) and tmux clipboard # surfraw -p "$PREFIX" "$INPUT" | xsel -p diff --git a/.w3m/cgi-bin/restore_session.cgi b/.w3m/cgi-bin/restore_session.cgi index 4e30311..2262211 100755 --- a/.w3m/cgi-bin/restore_session.cgi +++ b/.w3m/cgi-bin/restore_session.cgi @@ -29,7 +29,7 @@ mkdir -p "$HOME/.w3m/bin" RESTORE_SESSSION="$HOME/.w3m/bin/w3mlastsession" # add shell header echo "#!/usr/bin/env sh" > "$RESTORE_SESSSION" -echo "torsocks w3m -graph \\" >> "$RESTORE_SESSSION" +echo "proxychains4 -q -f ~/proxies/ice/proxychains.conf w3m -o auto_image=FALSE -graph \\" >> "$RESTORE_SESSSION" # remove dupes without sorting, add -N flag at beginning and append trailing slash to each url awk '!x[$0]++' "$HOME/.w3m/RestoreSession.txt" | while read -r line ; do echo "-N '$line' \\" >> "$RESTORE_SESSSION" ; done # echo "2>/dev/null" >> "$RESTORE_SESSSION" diff --git a/.w3m/keymap b/.w3m/keymap index c950b63..d45692a 100644 --- a/.w3m/keymap +++ b/.w3m/keymap @@ -124,8 +124,8 @@ keymap go COMMAND "SHELL /usr/lib/w3m/cgi-bin/goto_clipboard.cgi" keymap SPC-s COMMAND "TAB_GOTO searx.terminaldweller.com" keymap d COMMAND "EXTERN 'echo %s >> ~/.w3m/RestoreTab.txt' ; CLOSE_TAB" -#keymap u TAB_GOTO /usr/lib/w3m/cgi-bin/restore_tab.cgi -keymap u TAB_GOTO /home/devi/.w3m/cgi-bin/restore_tab.cgi +keymap u TAB_GOTO /usr/lib/w3m/cgi-bin/restore_tab.cgi +# keymap u TAB_GOTO /home/devi/.w3m/cgi-bin/restore_tab.cgi keymap SPC-m CURSOR_MIDDLE keymap SPC-l CURSOR_BOTTOM diff --git a/.zshrc b/.zshrc index 0c6f6d3..bf8bf19 100644 --- a/.zshrc +++ b/.zshrc @@ -25,8 +25,8 @@ alias gd="git diff --color-words" # enable aliases with sudo in the alias alias sudo="sudo " -alias w3m='proxychains4 -q -f ~/proxies/ice/proxychains.conf /home/devi/w3m/w3m -o auto_image=FALSE -o user_agent="$(get_random_ua.sh)" -graph' -alias torw3m='torsocks --port 9053 /home/devi/w3m/w3m -o auto_image=FALSE -o user_agent="$(get_random_ua.sh)" -graph' +alias w3m='proxychains4 -q -f ~/proxies/ice/proxychains.conf w3m -o auto_image=FALSE -o user_agent="$(get_random_ua.sh)" -graph' +alias torw3m='torsocks --port 9053 w3m -o auto_image=FALSE -o user_agent="$(get_random_ua.sh)" -graph' alias rm="rm -I --one-file-system --preserve-root=all" alias vv="vim" alias ls="exa" @@ -46,7 +46,7 @@ alias fixtmuxrc='cp ~/scripts/.tmux.conf ~/.tmux.conf' alias fixctagsrc='cp ~/scripts/.ctags ~/.ctags' # alias fixtvrc='cp ~/scripts/.tvrc ~/.tvrc' # alias tmuxpowerline='vim ~/scripts/default.sh' -alias speedtest="curl -o /dev/null http://speedtest.sea01.softlayer.com/downloads/test100.zip" +alias speedtest="curl --connect-timeout 10 -o /dev/null http://speedtest.sea01.softlayer.com/downloads/test100.zip" alias zshrc="vim ~/scripts/.zshrc" alias vimrc="vim ~/scripts/.vimrc" alias tmuxrc="vim ~/scripts/.tmux.conf" @@ -246,7 +246,7 @@ alias pulsemixer="pulsemixer --color 1" alias vagrant="https_proxy=socks5://[::1]:9993 vagrant --color --timestamp" alias vm_disposable="cp ~/scripts/vagrant/disposable/Vagrantfile ." alias vm_disposable_alpine="cp ~/scripts/vagrant/disposable-alpine/Vagrantfile ." -alias checktor="curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s https://check.torproject.org/api/ip" +alias checktor="curl --socks5 localhost:9054 --socks5-hostname localhost:9050 -s https://check.torproject.org/api/ip" alias ip="grc ip" alias ipp="ip -s -s -d" alias zathura="tabbed -c -r 2 zathura -e id" @@ -302,10 +302,15 @@ alias scapy="scapy -H" alias dg="grc /usr/bin/dig" alias lsof="grc lsof" alias xxd="xxd -g 2 -E -u -c 32" -alias torcurl='curl --user-agent "$(get_random_ua.sh)" --socks5-hostname localhost:9053' +alias torcurl='curl --connect-timeout 10 --user-agent "$(get_random_ua.sh)" --socks5-hostname localhost:9053' alias gpg2="HTTP_PROXY=socks5://127.0.0.1:9995 HTTPS_PROXY=socks5://127.0.0.1:9995 gpg2" alias gpg="HTTP_PROXY=socks5://127.0.0.1:9995 HTTPS_PROXY=socks5://127.0.0.1:9995 gpg" alias lxctop='watch -x -c -d -t -n 5 lxc list -c n,t,4,a,b,u,e,D,m,S,s,P' +alias iptables="grc iptables" +alias ping="grc ping" +alias list_iptables="sudo iptables -nvL --line-numbers" +alias sensors_pp="sensors -A -j 2> /dev/null | json_pp -json_opt pretty,canonical | pygmentize -l json -P style=$PYGMENTIZE_STYLE | $PAGER" +alias vdiff="vimdiff" # change the 4th terminal color to #0000ff # echo -e '\e]P40000ff' @@ -453,15 +458,11 @@ backup_home(){ } fixrc() { - cp ~/scripts/.zshrc ~/.zshrc - # source ~/.zshrc - exec zsh + cp ~/scripts/.zshrc ~/.zshrc && exec zsh } fixtheme() { - cp ~/scripts/devi.zsh-theme ~/.oh-my-zsh/themes/devi.zsh-theme - # source ~/.zshrc - exec zsh + cp ~/scripts/devi.zsh-theme ~/.oh-my-zsh/themes/devi.zsh-theme && exec zsh } export PATH=$PATH:/home/devi/.cargo/bin @@ -671,14 +672,14 @@ dff() { } jcurl() { - curl "$@" | json_pp -json_opt pretty,canonical | pygmentize -l json -P style=$PYGMENTIZE_STYLE + curl --connect-timeout 10 "$@" | json_pp -json_opt pretty,canonical | pygmentize -l json -P style=$PYGMENTIZE_STYLE | $PAGER } xcurl() { - curl "$@" | xml_pp | pygmentize -l xml -P style=$PYGMENTIZE_STYLE + curl --connect-timeout 10 "$@" | xml_pp | pygmentize -l xml -P style=$PYGMENTIZE_STYLE | $PAGER } hcurl() { - torsocks --port 9054 curl -i -D /dev/stderr --user-agent 'Chrome/79' "https://papers.ssrn.com/sol3/papersstract_id=1925128" "$@" | pygmentize -l html -P style=$PYGMENTIZE_STYLE + torsocks --port 9054 curl --connect-timeout 10 -i -D /dev/stderr --user-agent "$(get_random_ua.sh)" "$@" | pygmentize -l html -P style=$PYGMENTIZE_STYLE | $PAGER } # these i stole from junegunn to try out diff --git a/stylus/kernel_org.css b/stylus/kernel_org.css new file mode 100644 index 0000000..9248422 --- /dev/null +++ b/stylus/kernel_org.css @@ -0,0 +1,20 @@ +@-moz-document domain("www.kernel.org") { + body { + font-family: "DejaVu Sans Mono"; + } + + .wy-nav-side { + background-color: #000000; + color: #005f5f; + } + + .wy-nav-content { + background-color: #000000; + color: #005f5f; + } + + li.current:nth-child(2) > ul:nth-child(2) { + background-color: #000000; + color: #005f5f; + } +} diff --git a/tmux/date.sh b/tmux/date.sh index b3f6436..ca75a6d 100755 --- a/tmux/date.sh +++ b/tmux/date.sh @@ -1,11 +1,11 @@ -#!/usr/bin/env bash +#!/bin/sh # source common.sh SEPARATOR_LEFT_BOLD="" SEPARATOR_LEFT_THIN="" RESULT=$(date +"%a %D %H:%M") -#PROXY="proxychains4 -f /home/devi/proxies/ca/proxychains.conf" +PROXY="proxychains4 -q -f /home/devi/proxies/ice/proxychains.conf" DAY="#[fg=colour255 bg=colour31]"$(echo "$RESULT" | gawk '{print $1}') DATE="#[fg=colour255 bg=colour31]"$(echo "$RESULT" | gawk '{print $2}') @@ -16,20 +16,18 @@ JDATE="#[fg=colour255 bg=colour29]"$(jdate | gawk '{print $2" "$3}') # OPENWEATHERMAP_TOKEN=$(jq -r ".token" < /home/devi/scripts/tmux/openweathermap.json) # WEATHER_INFO=$(sleep 120 && proxychains4 -q -f /home/devi/proxies/ice/proxychains.conf curl "https://api.openweathermap.org/data/2.5/weather?q=Tehran&appid=${OPENWEATHERMAP_TOKEN}&units=metric"|jq ".main.temp") -WEATHER_INFO=$(proxychains4 -f ~/proxies/ice/proxychains.conf curl 'wttr.in/tehran?T&format=%f') +WEATHER_INFO=$(${PROXY} curl -s 'wttr.in/tehran?T&format=%f') if echo "${WEATHER_INFO}" | grep Unknown\ location; then WEATHER="#[fg=colour255 bg=colour32]"no_temp else WEATHER="#[fg=colour255 bg=colour32]"${WEATHER_INFO} fi -date >> /tmp/time_counter - -CPU_TEMP=$(sensors -j | jq .["\"coretemp-isa-0000\""]."\"Package id 0\"".temp1_input) -CPU_SECTION="#[fg=colour36 bg=colour24]${SEPARATOR_LEFT_BOLD}#[fg=colour16 bg=colour36]${CPU_TEMP} C" +CPU_TEMP=$(sensors -j 2>/dev/null | jq .["\"coretemp-isa-0000\""]."\"Package id 0\"".temp1_input) +CPU_SECTION="#[fg=colour36 bg=colour24]${SEPARATOR_LEFT_BOLD}#[fg=colour16 bg=colour36]${CPU_TEMP}°C" BATTERY=$(upower -i "$(upower -e | grep 'BAT')" | grep -E "percentage" | awk '{print $2}') -if ! headsetcontrol -b ; then +if ! headsetcontrol -b >/dev/null 2>&1; then HEADSET_BATTERY="not found" else HEADSET_BATTERY=$(headsetcontrol -b | grep Battery | awk '{print $2}') diff --git a/tmux/vcs_info.sh b/tmux/vcs_info.sh index 375ad5e..77773d6 100755 --- a/tmux/vcs_info.sh +++ b/tmux/vcs_info.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -source common.sh +# source common.sh SEPARATOR_RIGHT_BOLD="" # SEPARATOR_RIGHT_THIN="" @@ -12,60 +12,52 @@ get_tmux_cwd() { tmux display -p -F "#{pane_current_path}" } tmux_path=$(get_tmux_cwd) -cd "$tmux_path" -IFS='/' read -ra tmux_path_array <<< "$tmux_path" -pos=$(( ${#tmux_path_array[*]} - 1 )) -last=${tmux_path_array[$pos]} -for i in "${tmux_path_array[@]}" -do - if [[ $i == "$last" ]]; then - shortened_path+=$i - else - shortened_path+=${i:0:1}/ - fi -done +# cd "$tmux_path" && IFS='/' read -ra tmux_path_array <<<"$tmux_path" +# pos=$((${#tmux_path_array[*]} - 1)) +# last=${tmux_path_array[$pos]} +# for i in "${tmux_path_array[@]}"; do +# if [[ $i == "$last" ]]; then +# shortened_path+=$i +# else +# shortened_path+=${i:0:1}/ +# fi +# done function gitadditions { - git rev-parse --git-dir > /dev/null 2>&1 - if [[ $? == 0 ]]; then + if cd "${tmux_path}" && git rev-parse --git-dir >/dev/null 2>&1; then insertions=$(git --no-pager diff --numstat | awk '{sum1+=$1}END{print sum1}') - echo +$insertions + echo +"$insertions" fi } function gitdeletions { - git rev-parse --git-dir > /dev/null 2>&1 - if [[ $? == 0 ]]; then + if cd "${tmux_path}" && git rev-parse --git-dir >/dev/null 2>&1; then deletions=$(git --no-pager diff --numstat | awk '{sum2+=$2}END{print sum2}') - echo -$deletions + echo -"$deletions" fi } function git_untracked_info { - git rev-parse --git-dir > /dev/null 2>&1 - if [[ $? == 0 ]]; then + if cd "${tmux_path}" && git rev-parse --git-dir >/dev/null 2>&1; then untracked=$(git ls-files --others --exclude-standard | wc -w) - echo ⋯$untracked + echo ⋯"$untracked" fi } function git_branch_info { - git rev-parse --git-dir > /dev/null 2>&1 - if [[ $? == 0 ]]; then + if cd "${tmux_path}" && git rev-parse --git-dir >/dev/null 2>&1; then branch=$(git rev-parse --abbrev-ref HEAD) - echo " "$branch + echo " $branch" fi } function repo_info { - git rev-parse --git-dir > /dev/null 2>&1 - if [[ $? == 0 ]]; then + if cd "${tmux_path}" && git rev-parse --git-dir >/dev/null 2>&1; then insertions=$(git --no-pager diff --numstat | awk '{sum1+=$1}END{print sum1}') - git remote -v | grep github > /dev/null 2>&1 - if [[ $? == 0 ]]; then + if git remote -v | grep github >/dev/null 2>&1; then echo   else - echo  + echo  fi else : @@ -73,9 +65,9 @@ function repo_info { } function get_eth_price { - eth_price=$(proxychains4 -q -f ~/proxies/swe/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/price?name=ETH&unit=USD" | jq ".price") - cake_price=$(proxychains4 -q -f ~/proxies/swe/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/price?name=CAKE&unit=USD" | jq ".price") - monero_price=$(proxychains4 -q -f ~/proxies/swe/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/price?name=XMR&unit=USD" | jq ".price") + eth_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=ETH&unit=USD" | jq ".price") + cake_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=CAKE&unit=USD" | jq ".price") + monero_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=XMR&unit=USD" | jq ".price") echo "${eth_price}/${cake_price}/${monero_price}" } -- cgit v1.2.3