diff options
author | terminaldweller <thabogre@gmail.com> | 2023-02-18 17:37:42 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2023-02-18 17:37:42 +0000 |
commit | cb545061e4c4207667ca898c2dc21c35477987ee (patch) | |
tree | f163b8c64e4aa4e44d0b3397f3f7120b9b2eb7d5 | |
parent | update (diff) | |
download | scripts-cb545061e4c4207667ca898c2dc21c35477987ee.tar.gz scripts-cb545061e4c4207667ca898c2dc21c35477987ee.zip |
update
-rw-r--r-- | .mutt/.muttrc | 4 | ||||
-rw-r--r-- | .mutt/account.gmail | 7 | ||||
-rw-r--r-- | .mutt/account.self | 5 | ||||
-rw-r--r-- | .mutt/account.zoho | 17 | ||||
-rw-r--r-- | .mutt/mail.zoho.pass | 2 | ||||
-rw-r--r-- | .nethackrc | 39 | ||||
-rw-r--r-- | .newsboat/urls | 2 | ||||
-rw-r--r-- | .tmux.conf | 1 | ||||
-rw-r--r-- | .tunneltop.toml | 65 | ||||
-rw-r--r-- | .zshrc | 56 | ||||
-rwxr-xr-x | bin/postit.sh | 6 | ||||
-rwxr-xr-x | bin/virttop | 376 | ||||
-rw-r--r-- | db/mongo/build_db.js | 67 | ||||
-rw-r--r-- | docker/bitlbee-purple/docker-compose.yaml | 15 | ||||
-rwxr-xr-x | docker/docker_builders.sh | 2 | ||||
-rw-r--r-- | irssi/Dockerfile | 17 | ||||
-rw-r--r-- | postit | 3 | ||||
-rwxr-xr-x | services/clipd/run | 9 | ||||
-rwxr-xr-x | services/docker/run | 7 | ||||
-rw-r--r-- | stylus/github_wide.css | 21 | ||||
-rw-r--r-- | terminaldweller.com/gitter-irc/Dockerfile | 7 | ||||
-rw-r--r-- | terminaldweller.com/gitter-irc/docker-compose.yaml | 21 | ||||
-rwxr-xr-x | tmux/date.sh | 14 | ||||
-rwxr-xr-x | tmux/vcs_info.sh | 36 |
24 files changed, 355 insertions, 444 deletions
diff --git a/.mutt/.muttrc b/.mutt/.muttrc index 8323f65..637d60e 100644 --- a/.mutt/.muttrc +++ b/.mutt/.muttrc @@ -28,7 +28,7 @@ set crypt_timestamp=yes folder-hook 'account.gmail' 'source ~/.mutt/account.gmail' folder-hook 'account.self' 'source ~/.mutt/account.self' -folder-hook 'account.zharf' 'source ~/.mutt/account.zharf' +folder-hook 'account.zoho' 'source ~/.mutt/account.zoho' # default account source ~/.mutt/account.self @@ -36,7 +36,7 @@ source ~/.mutt/account.self macro index,pager <f2> '<sync-mailbox><refresh><enter-command>source ~/.mutt/account.self<enter><change-folder>!<enter>' macro index,pager <f3> '<sync-mailbox><refresh><enter-command>source ~/.mutt/account.gmail<enter><change-folder>!<enter>' -macro index,pager <f4> '<sync-mailbox><refresh><enter-command>source ~/.mutt/account.zharf<enter><change-folder>!<enter>' +macro index,pager <f4> '<sync-mailbox><refresh><enter-command>source ~/.mutt/account.zoho<enter><change-folder>!<enter>' # macros macro index A "T~N<enter>;WNT~O<enter>;WO\CT~T<enter>” “mark all messages read" diff --git a/.mutt/account.gmail b/.mutt/account.gmail index dc92edc..03a9af0 100644 --- a/.mutt/account.gmail +++ b/.mutt/account.gmail @@ -4,9 +4,14 @@ unmailboxes * set from = 'thabogre@gmail.com' set imap_user = 'thabogre@gmail.com' source "gpg -d ~/scripts/mail.gmail.pass.gpg |" -set smtp_url = 'smtp://thabogre@smtp.gmail.com:587' +# set smtp_url = 'smtp://thabogre@smtp.gmail.com:587' +set smtp_url = 'smtps://thabogre@smtp.gmail.com:465' set realname = 'farzad sadeghi' set folder = 'imaps://imap.gmail.com:993' +# set spoolfile = '+Inbox' +# set postponed = '+Inbox/Drafts' +# set record = '+Sent' +# set trash = '' set spoolfile = '+INBOX' set postponed = '+[Gmail]/Drafts' set record = '+[Gmail]/Sent Mail' diff --git a/.mutt/account.self b/.mutt/account.self index 9706023..51e4085 100644 --- a/.mutt/account.self +++ b/.mutt/account.self @@ -4,7 +4,8 @@ unmailboxes * set from = 'devi@terminaldweller.com' set imap_user = 'devi@terminaldweller.com' source "gpg -d ~/scripts/mail.self.pass.gpg |" -set smtp_url = 'smtp://devi@terminaldweller.com@mail.terminaldweller.com:587' +# set smtp_url = 'smtp://devi@terminaldweller.com@mail.terminaldweller.com:587' +set smtp_url = 'smtps://devi@terminaldweller.com@mail.terminaldweller.com:465' set realname = 'farzad sadeghi' set folder = 'imaps://mail.terminaldweller.com:993' set spoolfile = '+INBOX' @@ -15,4 +16,4 @@ set header_cache = ~/.mutt/self/cache/headers set message_cachedir = ~/.mutt/self/cache/bodies set certificate_file = ~/.mutt/self/certificates # mailboxes "+INBOX" "+Drafts" "+Sent" "+Trash" -mailboxes "+INBOX" "+INBOX/Github" "+INBOX/Linkedin" "+INBOX/Launchpad" "+INBOX/Opennic" "+INBOX/Trf" "+INBOX/Devto" +mailboxes "+INBOX" "+INBOX/Github" "+INBOX/Linkedin" "+INBOX/Launchpad" "+INBOX/Opennic" "+INBOX/Trf" "+INBOX/Devto" "+INBOX/Kaggle" diff --git a/.mutt/account.zoho b/.mutt/account.zoho new file mode 100644 index 0000000..436c524 --- /dev/null +++ b/.mutt/account.zoho @@ -0,0 +1,17 @@ +# vim: filetype=neomuttrc + +unmailboxes * +set from = 'bloodstalker@zoho.com' +set imap_user = 'bloodstalker@zoho.com' +source "gpg -d ~/scripts/mail.zoho.pass.gpg |" +set smtp_url = 'smtps://bloodstalker@smtp.zoho.com:465' +set realname = 'farzad sadeghi' +set folder = 'imaps://imap.zoho.com:993' +set spoolfile = '+Inbox' +set postponed = '+Drafts' +set record = '+Sent' +set trash = '+Trash' +set header_cache = ~/.mutt/zoho/cache/headers +set message_cachedir = ~/.mutt/zoho/cache/bodies +set certificate_file = ~/.mutt/zoho/certificates +mailboxes "+Inbox" "+Drafts" "+Sent" "+Trash" diff --git a/.mutt/mail.zoho.pass b/.mutt/mail.zoho.pass new file mode 100644 index 0000000..6cd4db7 --- /dev/null +++ b/.mutt/mail.zoho.pass @@ -0,0 +1,2 @@ +set imap_pass = "" +set smtp_pass = "" diff --git a/.nethackrc b/.nethackrc new file mode 100644 index 0000000..5c99e4a --- /dev/null +++ b/.nethackrc @@ -0,0 +1,39 @@ +# Visual options. +OPTIONS=color + +OPTIONS=symset:DECgraphics +SYMBOLS=S_ghost:6 +SYMBOLS=S_golem:U +SYMBOLS=S_mimic:m + +OPTIONS=statushilites +OPTIONS=hitpointbar +OPTIONS=hilite_status:hitpoints/100%/grey&normal +OPTIONS=hilite_status:hitpoints/<100%/green&normal +OPTIONS=hilite_status:hitpoints/<66%/yellow&normal +OPTIONS=hilite_status:hitpoints/<50%/orange&normal +OPTIONS=hilite_status:hitpoints/<33%/red&bold +OPTIONS=hilite_status:hitpoints/<15%/red&inverse +OPTIONS=hilite_status:power/100%/grey&normal +OPTIONS=hilite_status:power/<100%/green&normal +OPTIONS=hilite_status:power/<66%/yellow&normal +OPTIONS=hilite_status:power/<50%/orange&normal +OPTIONS=hilite_status:power/<33%/red&bold +OPTIONS=hilite_status:cap/burdened/yellow/stressed/orange/strained/red&bold/overtaxed/red&inverse/overloaded/red&inverse&blink +OPTIONS=hilite_status:hunger/satiated/yellow/hungry/orange/weak/red&bold/fainting/red&inverse/fainted/red&inverse&blink +OPTIONS=hilite_status:condition/hallu/yellow +OPTIONS=hilite_status:condition/conf/orange +OPTIONS=hilite_status:condition/stun/red&bold +OPTIONS=hilite_status:condition/termill/red&inverse +OPTIONS=hilite_status:condition/foodpois/red&inverse +OPTIONS=hilite_status:condition/slime/red&inverse +OPTIONS=hilite_status:characteristics/up/green/down/red +OPTIONS=hilite_status:gold/up/yellow/down/brown + + +# Blessed, cursed, enchanted +OPTIONS=menucolors +MENUCOLOR=" blessed"=cyan +MENUCOLOR=" \+[1-9]"=lightcyan +MENUCOLOR=" \-[1-9]"=orange +MENUCOLOR=" cursed"=red diff --git a/.newsboat/urls b/.newsboat/urls index f1bbfa2..fbca30f 100644 --- a/.newsboat/urls +++ b/.newsboat/urls @@ -8,6 +8,7 @@ https://microservices.io/feed.xml https://news.ycombinator.com/rss "~HN" https://www.ecliptik.com/feed.xml "~Ecliptik" https://www.privacytools.io/guides/rss.xml "~Privacy_Tools" +https://voidlinux.org/atom.xml "~VoidLinux" "exec:gemget gemini://mozz.us/journal/atom.xml --output -" "~MOZZ"GEMINI "exec:gemget gemini://midnight.pub/feed.xml --output -" "~Midnight_Pub"GEMINI @@ -120,6 +121,7 @@ https://www.youtube.com/feeds/videos.xml?channel_id=UCVik6mzTCurdJmvdj5dCa7A "~M https://www.youtube.com/feeds/videos.xml?channel_id=UCdSnjmLUUe_NT4ml9OkUi1A "~NewWorldReview"youtube https://www.youtube.com/feeds/videos.xml?channel_id=UCpFFItkfZz1qz5PpHpqzYBw "~Nexpo"youtube https://www.youtube.com/feeds/videos.xml?channel_id=UC9PIn6-XuRKZ5HmYeu46AIw "~Barely_Sociable"youtube +https://www.youtube.com/feeds/videos.xml?channel_id=UCZHmQk67mSJgfCCTn7xBfew "~Yannic_Kilcher"youtube https://www.youtube.com/feeds/videos.xml?user=g297125009 "~Gavin_Freeborn"youtube https://www.youtube.com/feeds/videos.xml?user=Hak5Darren "~Hak_5"youtube @@ -90,6 +90,7 @@ bind-key ! break-pane -d -n _hidden_pane bind-key @ join-pane -s $.0 bind-key p popup -w 80% -h 80% -E ksh +# bind-key p popup -w 80% -h 80% -E xonsh bind-key S popup -w 90% -h 90% -E env WWW_HOME=searx.terminaldweller.com /home/devi/w3m/w3m -o auto_image=FALSE -graph # bind-key F popup -d ${pane_current_path} -w 90% -h 90% -E ranger --cmd cd $(tmux show -p '#{pane_current_path}') bind-key F popup -d ${pane_current_path} -w 90% -h 90% -E ranger diff --git a/.tunneltop.toml b/.tunneltop.toml index 487fa26..748e8de 100644 --- a/.tunneltop.toml +++ b/.tunneltop.toml @@ -185,11 +185,74 @@ test_command_result = "<a href=\"/graph\">Found</a>." test_interval = 300 test_timeout = 10 +[tunnel.slackircd] +address = "127.0.0.1" +port = 7997 +command = "autossh -M 0 -N -L 0.0.0.0:7997:127.0.0.1:6697 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l rooot -p 1022 192.99.102.52" +test_command = "" +test_command_result = "" +test_interval = 300 +test_timeout = 10 + +[tunnel.ircgitter] +address = "127.0.0.1" +port = 5667 +command = "autossh -M 0 -N -L 0.0.0.0:5667:127.0.0.1:5667 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l ubuntu -p 3333 185.130.47.208" +test_command = "" +test_command_result = "" +test_interval = 300 +test_timeout = 10 + [tunnel.upnp_2234] address = "127.0.0.1" port = 2234 command = "autossh -M 0 -N -L 0.0.0.0:2234:127.0.0.1:2234 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l root -p 2022 185.112.147.110" test_command = "" -test_command_result = "<a href=\"/graph\">Found</a>." +test_command_result = "" +test_interval = 300 +test_timeout = 10 + +[tunnel.6socks5_6] +address = "::1" +port = 8990 +command = "autossh -M 0 -N -D [::1]:8990 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l ubuntu -p 3333 2a07:e01:3:204::1" +test_command = 'curl -s -o /dev/null -s -w "%{http_code}" -k -I -6 --socks5 socks5h://[::1]:8990 https://icanhazallips.terminaldweller.com:9380' +test_command_result = "200" +test_interval = 300 +test_timeout = 10 + +[tunnel.6socks5_7] +address = "::1" +port = 8997 +command = "autossh -M 0 -N -D [::1]:8997 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l ubuntu -p 3333 2a07:e03:3:26::1" +test_command = 'curl -s -o /dev/null -s -w "%{http_code}" -k -I -6 --socks5 socks5h://[::1]:8997 https://icanhazallips.terminaldweller.com:9380' +test_command_result = "200" +test_interval = 300 +test_timeout = 10 + +[tunnel.6socks5_8] +address = "::1" +port = 8989 +command = "autossh -M 0 -N -D [::1]:8989 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l ubuntu -p 3333 2a07:e03:3:bd::1" +test_command = 'curl -s -o /dev/null -s -w "%{http_code}" -k -I -6 --socks5 socks5h://[::1]:8989 https://icanhazallips.terminaldweller.com:9380' +test_command_result = "200" +test_interval = 300 +test_timeout = 10 + +[tunnel.6socks5_9] +address = "::1" +port = 8988 +command = "autossh -M 0 -N -D 8988 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l ubuntu -p 3333 2a07:e01:3:1c4::1" +test_command = 'curl -s -o /dev/null -s -w "%{http_code}" -k -I -6 --socks5 socks5h://[::1]:8988 https://icanhazallips.terminaldweller.com:9380' +test_command_result = "200" +test_interval = 300 +test_timeout = 10 + +[tunnel.6socks5_vv] +address = "::1" +port = 8987 +command = "autossh -M 0 -N -D 8987 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l ubuntu -p 3333 2a07:e01:3:30c::1" +test_command = 'curl -s -o /dev/null -s -w "%{http_code}" -k -I -6 --socks5 socks5h://[::1]:8987 https://icanhazallips.terminaldweller.com:9380' +test_command_result = "200" test_interval = 300 test_timeout = 10 @@ -21,6 +21,7 @@ eval `dircolors ~/.dir_colors` # _evalcache dircolors ~/.dir_colors # enable aliases with sudo in the alias +alias git="proxychains4 -q -f ~/proxies/ice/proxychains.conf git" alias sudo="sudo " alias mpv="proxychains4 -q -f ~/proxies/swe/proxychains.conf mpv --save-position-on-quit --term-osd-bar --msg-module --msg-time --cache=yes --cache-secs=9600 --cache-on-disk --cache-dir=/tmp/ --demuxer-max-bytes=500MiB" alias w3m='proxychains4 -q -f ~/proxies/ice/proxychains.conf w3m -o auto_image=FALSE -o user_agent="$(get_random_ua.sh)" -graph' @@ -95,6 +96,7 @@ alias cp="cp -i" alias nuke="rm -rf .[^.]* *" alias bruiser="bruiser --history ~/.bruiser/history.lua" alias digg="dig && clear" +alias bburrow="burrow && clear" alias ogg="ogg123" alias mupdf="/home/devi/extra/mupdf/build/release/mupdf-x11 -D red -P black -I" alias googler="~/extra/googler/googler --colors GKmexy -c us -l en --count 7 --exact " @@ -148,7 +150,7 @@ alias jupyterlab="jupyter lab --no-browser --port 9989" alias iredisrc="vim ~/scripts/.iredisrc" alias fixiredisrc="cp ~/scripts/.iredisrc ~/.iredisrc" # alias irssi="TERM=screen-256color docker run --runtime=runsc -it -e TERM -u $(id -u):$(id -g) --log-driver=none -e DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS" -v $HOME/.irssi:/home/user/.irssi:ro -v /etc/localtime:/etc/localtime:ro devi_irssi" -alias irssi="TERM=screen-256color COLORTERM=truecolor docker run --runtime=runsc -it -e COLORTERM -e TERM -u $(id -u):$(id -g) --log-driver=none -v $HOME/.irssi:/home/user/.irssi:ro -v /etc/localtime:/etc/localtime:ro devi_irssi" +alias irssi="TERM=screen-256color COLORTERM=truecolor docker run --runtime=runsc -it -e COLORTERM -e TERM -u $(id -u):$(id -g) --log-driver=none -v $HOME/.irssi:/home/user/.irssi:ro -v /etc/localtime:/etc/localtime:ro irssi:1.2.3" alias tor_irssi="TERM=screen-256color docker run --runtime=runsc -it -e TERM -u 1001:1001 --log-driver=none -v tor_irssi_mount:/home/user/.irssi -v ~/devi/abbatoir/hole16:/home/user/.irssi/certs tor_irssi" alias i2p_irssi="TERM=screen-256color docker run --runtime=runsc -it -e TERM -u $(id -u):$(id -g) --log-driver=none -v i2p_irssi_mount:/home/user/.irssi irssi:1.2.3" alias openbb="TERM=screen-256color \ @@ -282,7 +284,8 @@ alias mysql='mysql --safe-updates --prompt="\u@\h [\d]>"' alias socat="socat -d -d" alias cmusrc="vim ~/scripts/.config/cmus/rc" alias fixcmusrc="cp ~/scripts/.config/cmus/rc ~/.config/cmus/rc" -alias cointop="proxychains4 -q -f ~/proxies/ice/proxychains.conf ssh -tt -p 3333 ubuntu@185.130.45.46 TERM=screen-256color /home/ubuntu/cointop/cointop" +# alias cointop="proxychains4 -q -f ~/proxies/ice/proxychains.conf ssh -tt -p 3333 ubuntu@185.130.45.46 TERM=screen-256color /home/ubuntu/cointop/cointop" +alias cointop="proxychains4 -q -f ~/proxies/ice/proxychains.conf autossh -M 0 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -tt -p 3333 ubuntu@185.130.45.46 TERM=screen-256color /home/ubuntu/cointop/cointop" alias zshenv="vim ~/scripts/.zshenv" alias fixzshenv="cp ~/scripts/.zshenv ~/.zshenv" alias postman="flatpak run com.getpostman.Postman" @@ -344,6 +347,7 @@ alias ffox_i2p='ssh -C -X -i /home/devi/devi/vagrantboxes.git/main/i2p/.vagrant/ alias sotn="bw_mednafen ~/roms/sotn/Castlevania\ -\ Symphony\ of\ the\ Night.cue" alias silent_hill="bw_mednafen ~/roms/silent_hill/Silent Hill (v1.1).cue" alias bombadillo='ssh -tt -i /home/devi/devi/vagrantboxes.git/main/openbsd/.vagrant/machines/default/libvirt/private_key vagrant@bomb-host.vagrant-libvirt proxychains4 -q bombadillo ' +alias safe_w3m='ssh -tt -i /home/devi/devi/vagrantboxes.git/main/openbsd/.vagrant/machines/default/libvirt/private_key vagrant@bomb-host.vagrant-libvirt WWW_HOME=searx.terminaldweller.com proxychains4 -q w3m ' alias mount="grc mount" alias picocom="picocom --escape b" # https://wiki.slipfox.xyz/wiki/ANSI_escape_code#OSC_(Operating_System_Command)_sequences) @@ -565,29 +569,59 @@ export BROWSER=w3m dig() { globalholecounter=0 - if test "$("ls" -A "/home/devi/devi/abbatoir")"; then + local ABBATOIR_PATH="/home/devi/devi/abbatoir" + if test "$("ls" -A ${ABBATOIR_PATH})"; then while [ 1 ]; do - if [ -d "/home/devi/devi/abbatoir/hole$globalholecounter" ]; then + if [ -d "${ABBATOIR_PATH}/hole$globalholecounter" ]; then # if its not empty - if test "$("ls" -A "/home/devi/devi/abbatoir/hole$globalholecounter")"; then + if test "$("ls" -A "${ABBATOIR_PATH}/hole$globalholecounter")"; then : # if its empty else - cd /home/devi/devi/abbatoir/hole$globalholecounter + cd ${ABBATOIR_PATH}/hole$globalholecounter break fi else - mkdir /home/devi/devi/abbatoir/hole$globalholecounter - cd /home/devi/devi/abbatoir/hole$globalholecounter + mkdir ${ABBATOIR_PATH}/hole$globalholecounter + cd ${ABBATOIR_PATH}/hole$globalholecounter echo $globalholecounter break fi ((globalholecounter++)) done else - mkdir /home/devi/devi/abbatoir - mkdir /home/devi/devi/abbatoir/hole$globalholecounter - cd /home/devi/devi/abbatoir/hole$globalholecounter + mkdir ${ABBATOIR_PATH} + mkdir ${ABBATOIR_PATH}/hole$globalholecounter + cd ${ABBATOIR_PATH}/hole$globalholecounter + fi +} + +burrow() { + globalholecounter=0 + local FLESH_PIT_PATH="/tmp/fleshpit" + if test "$("ls" -A ${FLESH_PIT_PATH})"; then + while [ 1 ]; do + if [ -d "${FLESH_PIT_PATH}/pit$globalholecounter" ]; then + # if its not empty + if test "$("ls" -A "${FLESH_PIT_PATH}/pit$globalholecounter")"; then + : + # if its empty + else + cd ${FLESH_PIT_PATH}/pit$globalholecounter + break + fi + else + mkdir ${FLESH_PIT_PATH}/pit$globalholecounter + cd ${FLESH_PIT_PATH}/pit$globalholecounter + echo $globalholecounter + break + fi + ((globalholecounter++)) + done + else + mkdir ${FLESH_PIT_PATH} + mkdir ${FLESH_PIT_PATH}/pit$globalholecounter + cd ${FLESH_PIT_PATH}/pit$globalholecounter fi } diff --git a/bin/postit.sh b/bin/postit.sh index d0271e3..46addd0 100755 --- a/bin/postit.sh +++ b/bin/postit.sh @@ -1,4 +1,6 @@ #!/usr/bin/env sh -POSTIT=$(cat ~/scripts/postit | dmenu -l 20 -p "Select Postit:") -echo -n "${POSTIT:0:${#POSTIT}}" | xsel -ip +CLIP_HIST_FILE=/tmp/.clip_history +# POSTIT=$(cat ${CLIP_HIST_FILE} | dmenu -l 20 -p "Select Postit:") +sqlite3 $(cat /tmp/lclipd_db_name) 'select content from lclipd;' | dmenu -l 20 | xsel -ib +# echo -n "${POSTIT:0:${#POSTIT}}" | xsel -ip diff --git a/bin/virttop b/bin/virttop deleted file mode 100755 index 4d8943b..0000000 --- a/bin/virttop +++ /dev/null @@ -1,376 +0,0 @@ -#!/usr/bin/env python -"""virt top""" - -# ideally we would like to use the monkeypatch but it is untested -# and experimental -# import defusedxml # type:ignore -# defusedxml.defuse_stdlib() -import argparse -import csv -import dataclasses -import enum -import os -import signal -import sys -import time -import typing - -# we are only using this for type annotation -from xml.dom.minidom import Document # nosec - -from defusedxml import ElementTree # type:ignore -from defusedxml import minidom -import libvirt # type:ignore - - -# pylint: disable=unused-argument -def sig_handler_sigint(signum, frame): - """Just to handle C-c gracefully""" - print() - sys.exit(0) - - -class Argparser: # pylint: disable=too-few-public-methods - """Argparser class.""" - - def __init__(self): - self.parser = argparse.ArgumentParser() - self.parser.add_argument( - "--delay", - "-d", - type=float, - help="The delay between updates", - default=5, - ) - self.parser.add_argument( - "--uri", - "-u", - nargs="+", - type=str, - help="A list of URIs to connect to seperated by commas", - default=["qemu:///system"], - ) - self.args = self.parser.parse_args() - - -# pylint: disable=too-few-public-methods -class Colors(enum.EnumType): - """static color definitions""" - - purple = "\033[95m" - blue = "\033[94m" - green = "\033[92m" - yellow = "\033[93m" - red = "\033[91m" - grey = "\033[1;37m" - darkgrey = "\033[1;30m" - cyan = "\033[1;36m" - ENDC = "\033[0m" - BOLD = "\033[1m" - UNDERLINE = "\033[4m" - blueblue = "\x1b[38;5;24m" - greenie = "\x1b[38;5;23m" - goo = "\x1b[38;5;22m" - screen_clear = "\033c\033[3J" - hide_cursor = "\033[?25l" - - -@dataclasses.dataclass -# pylint: disable=too-many-instance-attributes -class VirtData: - """Holds the data that we collect to display to the user""" - - vm_id: typing.List[str] = dataclasses.field(default_factory=list) - name: typing.List[str] = dataclasses.field(default_factory=list) - cpu_times: typing.List[str] = dataclasses.field(default_factory=list) - mem_actual: typing.List[str] = dataclasses.field(default_factory=list) - mem_unused: typing.List[str] = dataclasses.field(default_factory=list) - write_bytes: typing.List[str] = dataclasses.field(default_factory=list) - read_bytes: typing.List[str] = dataclasses.field(default_factory=list) - macs: typing.List[str] = dataclasses.field(default_factory=list) - ips: typing.List[str] = dataclasses.field(default_factory=list) - disk_reads: typing.List[str] = dataclasses.field(default_factory=list) - disk_writes: typing.List[str] = dataclasses.field(default_factory=list) - snapshot_counts: typing.List[str] = dataclasses.field(default_factory=list) - uri: typing.List[str] = dataclasses.field(default_factory=list) - memory_pool: typing.List[str] = dataclasses.field(default_factory=list) - - pools: typing.List[libvirt.virStoragePool] = dataclasses.field( - default_factory=list - ) - - -def get_network_info( - xml_doc: Document, -) -> typing.Dict[str, str]: - """returns the network info""" - result_dict = {} - interface_types = xml_doc.getElementsByTagName("interface") - for interface_type in interface_types: - interface_nodes = interface_type.childNodes - for interface_node in interface_nodes: - if interface_node.nodeName[0:1] != "#": - for attr in interface_node.attributes.keys(): - result_dict[ - interface_node.attributes[attr].name - ] = interface_node.attributes[attr].value - return result_dict - - -def get_arp_table() -> typing.Dict[str, str]: - """Get the ARP table. return a dict with MAC/IP as key/value pair.""" - result: typing.Dict[str, str] = {} - with open("/proc/net/arp", encoding="utf-8") as arp_table: - reader = csv.reader(arp_table, skipinitialspace=True, delimiter=" ") - for arp_entry in reader: - result[arp_entry[3]] = arp_entry[0] - - return result - - -def get_ip_from_arp_table(arp_table: typing.Dict[str, str], mac: str) -> str: - """get IP from MAC address using the arp table""" - try: - return arp_table[mac] - except KeyError: - return "N/A" - - -def get_disk_info( - xml_doc: Document, -) -> typing.Dict[str, str]: - """returns the disk info""" - result_dict: typing.Dict = {} - disk_types = xml_doc.getElementsByTagName("disk") - for disk_type in disk_types: - disk_nodes = disk_type.childNodes - for disk_node in disk_nodes: - if disk_node.nodeName[0:1] != "#": - for attr in disk_node.attributes.keys(): - result_dict[ - disk_node.attributes[attr].name - ] = disk_node.attributes[attr].value - - return result_dict - - -# pylint: disable=too-many-locals -def ffs( - offset: int, - header_list: typing.Optional[typing.List[str]], - numbered: bool, - *args, -) -> typing.List[str]: - """A simple columnar printer""" - max_column_width = [] - lines = [] - numbers_f: typing.List[int] = [] - dummy = [] - - if sys.stdout.isatty(): - greenie = Colors.greenie - bold = Colors.BOLD - endc = Colors.ENDC - goo = Colors.goo - blueblue = Colors.blueblue - else: - greenie = "" - bold = "" - endc = "" - goo = "" - blueblue = "" - - for arg in args: - max_column_width.append(max(len(repr(argette)) for argette in arg)) - - if header_list is not None: - if numbered: - numbers_f.extend(range(1, len(args[-1]) + 1)) - max_column_width.append( - max(len(repr(number)) for number in numbers_f) - ) - header_list.insert(0, "idx") - - index = range(0, len(header_list)) - for header, width, i in zip(header_list, max_column_width, index): - max_column_width[i] = max(len(header), width) + offset - - for i in index: - dummy.append( - greenie - + bold - + header_list[i].ljust(max_column_width[i]) - + endc - ) - lines.append("".join(dummy)) - dummy.clear() - - index2 = range(0, len(args[-1])) - for i in index2: - if numbered: - dummy.append( - goo + bold + repr(i).ljust(max_column_width[0]) + endc - ) - for arg, width in zip(args, max_column_width[1:]): - dummy.append(blueblue + (arg[i]).ljust(width) + endc) - else: - for arg, width in zip(args, max_column_width): - dummy.append(blueblue + (arg[i]).ljust(width) + endc) - lines.append("".join(dummy)) - dummy.clear() - return lines - - -def size_abr(num: float, shift_by: float) -> str: - """Rounds and abbreviates floats.""" - num = num * shift_by - if num < 1000: - return repr(num) - if num < 1_000_000.0: - return repr(round(num / 1_000, 2)) + " KB" - if num < 1_000_000_000: - return repr(round(num / 1_000_000, 2)) + " MB" - if num < 1_000_000_000_000: - return repr(round(num / 1_000_000_000, 2)) + " GB" - return "N/A" - - -# pylint: disable=too-many-locals -def fill_virt_data_uri( - conn: libvirt.virConnect, - active_hosts: typing.List[int], - virt_data: VirtData, - arp_table: typing.Dict[str, str], -) -> None: - """fill VirtData for one URI.""" - for host_id in active_hosts: - virt_data.uri.append(conn.getURI()) - dom = conn.lookupByID(host_id) - virt_data.snapshot_counts.append(repr(dom.snapshotNum())) - virt_data.cpu_times.append( - repr( - int(dom.getCPUStats(total=True)[0]["cpu_time"] / 1_000_000_000) - ) - + "s" - ) - xml_doc = minidom.parseString(dom.XMLDesc()) - virt_data.name.append(dom.name()) - - mem_stats = dom.memoryStats() - if "actual" in mem_stats: - virt_data.mem_actual.append(size_abr(mem_stats["actual"], 1000)) - else: - virt_data.mem_actual.append("n/a") - - # BSD guests dont support mem balloons? - try: - virt_data.mem_unused.append(size_abr(mem_stats["available"], 1000)) - except KeyError: - virt_data.mem_unused.append("N/A") - - tree = ElementTree.fromstring(dom.XMLDesc()) - iface = tree.find("devices/interface/target").get("dev") - stats = dom.interfaceStats(iface) - virt_data.write_bytes.append(size_abr(stats[4], 1)) - virt_data.read_bytes.append(size_abr(stats[0], 1)) - - found_the_pool: bool = False - disk = tree.find("devices/disk/source").get("file") - for pool in virt_data.pools: - if os.path.basename(disk) in pool.listVolumes(): - virt_data.memory_pool.append(pool.name()) - found_the_pool = True - # you could delete the pool but keep the volumes inside - # which results in a functional VM but it wont have a - # volume inside a pool that we can detect - if not found_the_pool: - virt_data.memory_pool.append("N/A") - - disk_info = get_disk_info(xml_doc) - image_name = disk_info["file"] - _, rd_bytes, _, wr_bytes, _ = dom.blockStats(image_name) - virt_data.disk_reads.append(size_abr(rd_bytes, 1)) - virt_data.disk_writes.append(size_abr(wr_bytes, 1)) - - network_info = get_network_info(xml_doc) - virt_data.macs.append(network_info["address"]) - # virt_data.ips.append(get_ip_by_arp(network_info["address"])) - # TODO-this is obviously not going to work for remote URIs - virt_data.ips.append( - get_ip_from_arp_table(arp_table, network_info["address"]) - ) - - -def main() -> None: - """entrypoint""" - signal.signal(signal.SIGINT, sig_handler_sigint) - argparser = Argparser() - print(Colors.screen_clear, end="") - while True: - virt_data = VirtData() - arp_table = get_arp_table() - for hv_host in argparser.args.uri: - conn = libvirt.openReadOnly(hv_host) - active_hosts = conn.listDomainsID() - if len(active_hosts) > 0: - virt_data.pools = conn.listAllStoragePools() - # for pool in virt_data.pools: - # print(pool.listVolumes()) - # networks = conn.listAllNetworks() - # print([pool.name() for pool in conn.listAllStoragePools()]) - # print([net.name() for net in conn.listAllNetworks()]) - virt_data.vm_id = [ - repr(vm_id) for vm_id in conn.listDomainsID() - ] - fill_virt_data_uri(conn, active_hosts, virt_data, arp_table) - # for conn_id in conn.listAllDomains(): - # print(conn_id.name()) - # print(conn_id.state()) - else: - print("no active VMs found.") - sys.exit(1) - - lines = ffs( - 2, - [ - "ID", - "NAME", - "CPU", - "MEM_ACTUAL", - "MEM_AVAIL", - "NET_WRITE_B", - "NET_READ_B", - "MAC", - "IP", - "IO_READ_B", - "IO_WRITE_B", - "SNAPSHOTS", - "URI", - "STORAGE_POOL", - ], - False, - virt_data.vm_id, - virt_data.name, - virt_data.cpu_times, - virt_data.mem_actual, - virt_data.mem_unused, - virt_data.write_bytes, - virt_data.read_bytes, - virt_data.macs, - virt_data.ips, - virt_data.disk_reads, - virt_data.disk_writes, - virt_data.snapshot_counts, - virt_data.uri, - virt_data.memory_pool, - ) - for line in lines: - print(line) - time.sleep(argparser.args.delay) - # clears the screen - print(Colors.screen_clear, end="") - print(Colors.hide_cursor, end="") - - -if __name__ == "__main__": - main() diff --git a/db/mongo/build_db.js b/db/mongo/build_db.js index 9273193..fb7a611 100644 --- a/db/mongo/build_db.js +++ b/db/mongo/build_db.js @@ -31,7 +31,10 @@ const mangas = { gigantis: "https://manganato.com/manga-mv989778", "ningyo no kuni": "https://readmanganato.com/manga-uq971373", "dead tube": "https://readmanganato.com/manga-pp951398", + "at the mountains of madness": "https://manganato.com/manga-ct979576", "ooki onna": "https://manganato.com/manga-wb953636", + "gantz:e": "https://manganato.com/manga-ho984623", + leviathan: "https://readmanganato.com/manga-pj966444", ingoshima: "https://readmanganato.com/manga-ek981919", "kangoku kaguen": "https://readmanganato.com/manga-nl952268", tenkaichi: "https://manganato.com/manga-mj990344", @@ -41,6 +44,8 @@ const mangas = { "murcielago.": "https://manganato.com/manga-vi953465", "black joke.": "https://manganato.com/manga-om952769", "pinsaro sniper": "https://manganato.com/manga-ig986163", + jinmen: "https://readmanganato.com/manga-ad978186", + "hunter x hunter": "https://readmanganato.com/manga-oc955385", "baki-dou": "https://readmanganato.com/manga-cc980259", "everyone's loose screw'": "https://manganato.com/manga-ga983883", "kumo desu": "https://readmanganato.com/manga-zd976712", @@ -48,6 +53,13 @@ const mangas = { gachiakuta: "https://manganato.com/manga-na990935", "black lagoon": "https://readmanganato.com/manga-", "chainsaw man": "https://readmanganato.com/manga-dn980422", + "at the mountains of madness": "https://manganato.com/manga-ct979576", + "resurrection colloseum": "https://manganato.com/manga-qq993573", + "pumpkin night": "https://chapmanganato.com/manga-br979252", + "maou no hajemekata": "https://chapmanganato.com/manga-ki952417", + "savage hero": "https://manganato.com/manga-qb993758", + "cave of obscenity": "https://manganato.com/manga-pk993067", + "ataerareta skill wo": "https://chapmanganato.com/manga-or991826", }; db = connect("192.168.1.109:27117/devi"); @@ -57,7 +69,11 @@ const movies_obj = { }; const stash_obj = { - momotaro: "https://www.tnaflix.com/amateur-porn/fcdc-056/video6241864", + step: "https://spankbang.com/7s3ed/video/sharing+my+curvy+girlfriend+with+my+skinny+stepsis", +}; + +const manga_obj = { + "hell's tormentor kraken": "https://manganato.com/manga-or992226", }; function inser_into_db(mongo_collection, object) { @@ -79,30 +95,29 @@ function inser_into_db(mongo_collection, object) { inser_into_db(db.stash, stash_obj); inser_into_db(db.movies, movies_obj); +inser_into_db(db.mangas, manga_obj); -var mangas_entry = db.mangas.find({}); -Object.keys(mangas_entry).forEach((prop) => { - console.log(prop); -}); -while (mangas_entry.hasNext()) { - var mangas_id = mangas_entry.next()._id; - console.log(mangas_id); -} -db.mangas.updateOne( - { _id: mangas_id }, - { - $set: { - "at the mountains of madness": "https://manganato.com/manga-ct979576", - }, - } -); +// var mangas_entry = db.mangas.find({}); +// Object.keys(mangas_entry).forEach((prop) => { +// console.log(prop); +// }); +// while (mangas_entry.hasNext()) { +// var mangas_id = mangas_entry.next()._id; +// console.log(mangas_id); +// } +// db.mangas.updateOne( +// { _id: mangas_id }, +// { +// $set: {}, +// } +// ); -var animes_entry = db.animes.find({}); -Object.keys(animes_entry).forEach((prop) => { - console.log(prop); -}); -while (animes_entry.hasNext()) { - var animes_id = animes_entry.next()._id; - console.log(animes_id); -} -db.animes.updateOne({ _id: animes_id }, { $set: {} }); +// var animes_entry = db.animes.find({}); +// Object.keys(animes_entry).forEach((prop) => { +// console.log(prop); +// }); +// while (animes_entry.hasNext()) { +// var animes_id = animes_entry.next()._id; +// console.log(animes_id); +// } +// db.animes.updateOne({ _id: animes_id }, { $set: {} }); diff --git a/docker/bitlbee-purple/docker-compose.yaml b/docker/bitlbee-purple/docker-compose.yaml index 193a14f..dd582b0 100644 --- a/docker/bitlbee-purple/docker-compose.yaml +++ b/docker/bitlbee-purple/docker-compose.yaml @@ -1,22 +1,19 @@ version: "3.7" services: bitlbee: - image: bitlbee_devi + image: ezkrg_bitlbee_libpurple networks: - bitlbeenet ports: - "8667:6667" + user: 1000:1000 restart: unless-stopped - network_mode: bridge user: "bitlbee:bitlbee" - command: ["/usr/sbin/bitlbee", "-F","-n","-u","bitlbee","-c","/var/lib/bitlbee/bitlbee.conf", "-d","bitlbee-user-data"] + command: ["/usr/sbin/bitlbee", "-F","-n","-u","bitlbee","-c","/var/lib/bitlbee/bitlbee.conf", "-d","/var/lib/bitlbee"] volumes: - ./conf/bitlbee.conf:/var/lib/bitlbee/bitlbee.conf + - userdata:/var/lib/bitlbee networks: bitlbeenet: - ipam: - driver: overlay - config: - - subnet: 172.18.0.0/16 - - ip_range: 172.18.5.0.24 - - gateway: 172.18.0.1 +volumes: + userdata: diff --git a/docker/docker_builders.sh b/docker/docker_builders.sh index c524ec4..5dc6e76 100755 --- a/docker/docker_builders.sh +++ b/docker/docker_builders.sh @@ -1,6 +1,6 @@ #!/bin/sh -ALL_PROXY="socks5://127.0.0.1:9995" +ALL_PROXY="socks5h://127.0.0.1:9995" SOCKS_4_PROXY="socks5://127.0.0.1:9995" SOCKS_6_PROXY="socks5://[::1]:9993" NO_PROXY="127.0.0.0/8,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12" diff --git a/irssi/Dockerfile b/irssi/Dockerfile index ed8d271..2a630f4 100644 --- a/irssi/Dockerfile +++ b/irssi/Dockerfile @@ -1,6 +1,6 @@ # https://github.com/jessfraz/irssi # For the time being we have build on alpine:edge since perl::Glib::Object::Introspection is only available on edge/testing -FROM alpine:edge +FROM alpine:3.17 # https://georgik.rocks/how-to-start-d-bus-in-docker-container/ # apk add dbus dbus-x11 # dbus-uuidgen > /var/lib/dbus/machine-id @@ -74,6 +74,18 @@ RUN set -eux; \ ; \ ninja -C Build -j "$(nproc)"; \ ninja -C Build install; +ENV HTTPS_PROXY=socks5://192.168.1.214:9995 +RUN apk add git glib python3-dev && \ + cd /home/user && \ + git clone https://github.com/irssi-import/irssi-python && \ + cd /home/user/irssi-python && \ + autoreconf -ivf -I. && \ + ./configure --with-irssi=/usr/src/irssi && \ + make -C src constants && \ + make && \ + mkdir /home/user/.irssi/modules && \ + cp src/.libs/libpython.so ~/.irssi/modules +ENV HTTPS_PROXY= RUN cd /; \ rm -rf /usr/src/irssi; \ \ @@ -85,7 +97,7 @@ RUN cd /; \ )"; \ apk add --virtual .irssi-rundeps $runDeps; \ echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && apk update; \ - apk add --no-cache perl-glib perl-datetime perl-dbi perl-dbd-pg perl-lwp-protocol-https proxychains-ng perl-glib-object-introspection libnotify; \ + apk add --no-cache perl-glib perl-datetime perl-dbi perl-dbd-pg perl-lwp-protocol-https proxychains-ng perl-glib-object-introspection perl-mojolicious libnotify; \ # apk add dbus; \ # dbus-uuidgen > /var/lib/dbus/machine-id; \ # mkdir -p /var/run/dbus; \ @@ -98,6 +110,7 @@ RUN cd /; \ COPY ./proxychains.conf /etc/proxychains/ WORKDIR $HOME +RUN cp /home/user/.irssi/modules/libpython.so /usr/local/lib/irssi/modules/libpython_core.so USER user CMD ["proxychains4", "-q", "irssi"] @@ -51,3 +51,6 @@ ntfs-3g https://virastaran.net/a/w/11467/ https://www.dhl.com/nl-en/home/tracking/tracking-parcel.html?submit=1&tracking-id=CY570784975DE https://github.com/net4people/bbs +https://www.kaggle.com/datasets/hassan06/nslkdd +https://www.kaggle.com/datasets/mrwellsdavid/unsw-nb15 +https://magma.lavafeld.org/guide/osint-sources.html#looking-glasses diff --git a/services/clipd/run b/services/clipd/run index 493539d..34c3239 100755 --- a/services/clipd/run +++ b/services/clipd/run @@ -1,3 +1,10 @@ #!/bin/sh exec 2>&1 -DISPLAY=:0.0 exec /home/devi/scripts/bin/clipd -s 200 -f /home/devi/.clip_history +# DISPLAY=:0.0 exec lua5.3 /home/devi/devi/lclip.git/sqlite3/lclipd.lua -s 200 +exec \ + env \ + XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" \ + lua5.3 \ + /home/devi/devi/lclip.git/sqlite3/lclipd.lua \ + -s 200 \ + > /dev/null 2>&1 diff --git a/services/docker/run b/services/docker/run index 05473df..528089e 100755 --- a/services/docker/run +++ b/services/docker/run @@ -6,4 +6,9 @@ mountpoint -q /sys/fs/cgroup/systemd || { mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd; } #exec chpst -o 1048576 -p 1048576 dockerd $OPTS 2>&1 -exec env NO_PROXY="localhost,127.0.0.0/8,192.168.0.0/24,10.0.0.0/8,172.16.0.0/12" HTTPS_PROXY="socks5://127.0.0.1:9995" HTTP_PROXY="socks5://127.0.0.1:9995" chpst -o 1048576 -p 1048576 dockerd $OPTS 2>&1 +# exec env NO_PROXY="localhost,127.0.0.0/8,192.168.0.0/24,10.0.0.0/8,172.16.0.0/12" HTTPS_PROXY="socks5://127.0.0.1:9995" HTTP_PROXY="socks5://127.0.0.1:9995" chpst -o 1048576 -p 1048576 dockerd $OPTS 2>&1 +# echo localhost,127.0.0.0/8,192.168.0.0/24,10.0.0.0/8,172.16.0.0/12 > /etc/sv/docker/envs/NO_PROXY +# echo socks5://127.0.0.1:9995 > /etc/sv/docker/envs/HTTP_PROXY +# echo socks5://127.0.0.1:9995 > /etc/sv/docker/envs/HTTPS_PROXY +# echo socks5://127.0.0.1:9995 > /etc/sv/docker/envs/ALL_PROXY +exec chpst -e /etc/sv/docker/envs -o 1048576 -p 1048576 dockerd $OPTS 2>&1 diff --git a/stylus/github_wide.css b/stylus/github_wide.css new file mode 100644 index 0000000..8f3cb2d --- /dev/null +++ b/stylus/github_wide.css @@ -0,0 +1,21 @@ +@-moz-document domain("github.com") { + div.clearfix:nth-child(4) { + max-width: 97%; + width: 97%; + } + + .markdown-body { + max-width: 97%; + width: 97%; + } + + div.clearfix:nth-child(2) { + max-width: 97%; + width: 97%; + } + + div.container-xl:nth-child(2) { + max-width: 97%; + width: 97%; + } +} diff --git a/terminaldweller.com/gitter-irc/Dockerfile b/terminaldweller.com/gitter-irc/Dockerfile new file mode 100644 index 0000000..174d8de --- /dev/null +++ b/terminaldweller.com/gitter-irc/Dockerfile @@ -0,0 +1,7 @@ +FROM node:lts-alpine3.17 +RUN apk update \ + && apk add git \ + && git clone https://gitlab.com/gitterHQ/irc-bridge \ + && cd irc-bridge \ + && npm install +WORKDIR /irc-bridge diff --git a/terminaldweller.com/gitter-irc/docker-compose.yaml b/terminaldweller.com/gitter-irc/docker-compose.yaml new file mode 100644 index 0000000..ddc704b --- /dev/null +++ b/terminaldweller.com/gitter-irc/docker-compose.yaml @@ -0,0 +1,21 @@ +version: "3" +services: + irc-gitter: + image: irc-gitter + build: + context: . + networks: + - ircgitternet + ports: + - "127.0.0.1:5667:6667" + restart: unless-stopped + entrypoint: ["npm", "start"] + cap_drop: + - ALL + cap_add: + - CHOWN + - SETGID + - SETUID +networks: + ircgitternet: + diff --git a/tmux/date.sh b/tmux/date.sh index 7a82d91..ce6e0eb 100755 --- a/tmux/date.sh +++ b/tmux/date.sh @@ -3,16 +3,18 @@ # source common.sh SEPARATOR_LEFT_BOLD="" SEPARATOR_LEFT_THIN="" -PROXY="proxychains4 -q -f /home/devi/proxies/ice/proxychains.conf" +# PROXY="proxychains4 -q -f /home/devi/proxies/ice/proxychains.conf" internet_time_cache() { INTERNET_TIME_CACHE_AGE=60 INTERNET_TIME_CACHE_OUTPUT=/tmp/tmux_internet_time_cache # if the cache has not expired yet - if [ $(( $( stat --format=%Y $INTERNET_TIME_CACHE_OUTPUT ) + INTERNET_TIME_CACHE_AGE )) -gt $( date +%s ) ];then + if [ $(( $( stat --format=%Y $INTERNET_TIME_CACHE_OUTPUT ) + INTERNET_TIME_CACHE_AGE )) -gt "$( date +%s )" ];then : else - date -u +"%T" -d @$(curl -s --connect-timeout 10 --socks5-hostname localhost:9054 --user-agent "$(get_random_ua.sh)" http://worldtimeapi.org/api/timezone/Europe/London.json | jq '.unixtime') > ${INTERNET_TIME_CACHE_OUTPUT} + if OUTPUT=$(date -u +"%T" -d @$(curl -s --connect-timeout 10 --socks5-hostname localhost:9053 --user-agent "$(get_random_ua.sh)" http://worldtimeapi.org/api/timezone/Europe/London.json | jq '.unixtime')); then + echo "${OUTPUT}" > ${INTERNET_TIME_CACHE_OUTPUT} + fi fi cat ${INTERNET_TIME_CACHE_OUTPUT} } @@ -20,10 +22,12 @@ internet_time_cache() { weather_info_cache() { WEATHER_INFO_CACHE_AGE=300 WEATHER_INFO_CACHE_OUTPUT=/tmp/tmux_weather_info_cache - if [ $(( $( stat --format=%Y $WEATHER_INFO_CACHE_OUTPUT ) + INTERNET_TIME_CACHE_AGE )) -gt $( date +%s ) ];then + if [ $(( $( stat --format=%Y $WEATHER_INFO_CACHE_OUTPUT ) + WEATHER_INFO_CACHE_AGE )) -gt "$( date +%s )" ];then : else - ${PROXY} curl -s 'wttr.in/tehran?T&format=%f' > ${WEATHER_INFO_CACHE_OUTPUT} + if OUTPUT=$(curl -s --connect-timeout 10 --socks5-hostname socks5h://127.0.0.1:9053 'wttr.in/tehran?T&format=%f'); then + echo "${OUTPUT}" > ${WEATHER_INFO_CACHE_OUTPUT} + fi fi cat ${WEATHER_INFO_CACHE_OUTPUT} } diff --git a/tmux/vcs_info.sh b/tmux/vcs_info.sh index ba8b6a8..673c07e 100755 --- a/tmux/vcs_info.sh +++ b/tmux/vcs_info.sh @@ -66,10 +66,38 @@ function repo_info { } function get_eth_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}" + PRICE_TIME_CACHE=60 + PRICE_CACHE_OUTPUT_ETH=/tmp/tmux_PRICE_CACHE_ETH + PRICE_CACHE_OUTPUT_XMR=/tmp/tmux_PRICE_CACHE_XMR + PRICE_CACHE_OUTPUT_CAKE=/tmp/tmux_PRICE_CACHE_CAKE + # 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") + if [ $(( $( stat --format=%Y $PRICE_CACHE_OUTPUT_ETH ) + PRICE_TIME_CACHE )) -gt "$( date +%s )" ];then + : + else + if ETH_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=ETH&unit=USD" | jq ".price"); then + echo "${ETH_OUTPUT}" > ${PRICE_CACHE_OUTPUT_ETH} + fi + fi + if [ $(( $( stat --format=%Y $PRICE_CACHE_OUTPUT_CAKE ) + PRICE_TIME_CACHE )) -gt "$( date +%s )" ];then + : + else + if CAKE_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=CAKE&unit=USD" | jq ".price"); then + echo "${CAKE_OUTPUT}" > ${PRICE_CACHE_OUTPUT_CAKE} + fi + fi + if [ $(( $( stat --format=%Y $PRICE_CACHE_OUTPUT_XMR ) + PRICE_TIME_CACHE )) -gt "$( date +%s )" ];then + : + else + if XMR_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=XMR&unit=USD" | jq ".price"); then + echo "${XMR_OUTPUT}" > ${PRICE_CACHE_OUTPUT_XMR} + fi + fi + + + result="$(cat ${PRICE_CACHE_OUTPUT_ETH})"/"$(cat ${PRICE_CACHE_OUTPUT_CAKE})"/"$(cat ${PRICE_CACHE_OUTPUT_XMR})" + echo "${result}" } tmux_session_info=" #S:#I.#P" |