From 12aa838615093b5ecb6de79f9de21d925dcea81a Mon Sep 17 00:00:00 2001 From: Phantop Date: Sun, 20 Mar 2022 23:12:23 -0400 Subject: [PATCH] fish: pager, fisher, jo, fd; qute: hosts, alias --- bin/72 | 4 ---- bin/aliases | 39 ++++++++++++++++---------------- bin/nse | 13 +++++++++++ bin/setup | 3 +-- bin/zzexe | 4 ++-- fish/config.fish | 47 +++++++++++++++++---------------------- qutebrowser/adblock.py | 27 +++------------------- qutebrowser/aliases.py | 6 ++++- qutebrowser/bindings.py | 6 ++--- qutebrowser/config.py | 7 +----- qutebrowser/javascript.py | 4 +++- qutebrowser/user.scss | 36 ++++++++++++++++-------------- 12 files changed, 90 insertions(+), 106 deletions(-) delete mode 100755 bin/72 create mode 100755 bin/nse diff --git a/bin/72 b/bin/72 deleted file mode 100755 index afb4112..0000000 --- a/bin/72 +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -xrandr --newmode $(cvt 1920 1080 72 | tail -n1 | cut -d' ' -f2-) -xrandr --addmode $(xrandr --listactivemonitors | tail -n1 | cut -d' ' -f5- | awk '$1=$1') $(cvt 1920 1080 72 | tail -n1 | cut -d' ' -f2) -xrandr --output $(xrandr --listactivemonitors | tail -n1 | cut -d' ' -f5- | awk '$1=$1') --mode $(cvt 1920 1080 72 | tail -n1 | cut -d' ' -f2) diff --git a/bin/aliases b/bin/aliases index d2d787d..2cf99b9 100755 --- a/bin/aliases +++ b/bin/aliases @@ -1,14 +1,17 @@ #!/usr/bin/fish -alias a 'alias -s' -set -U fish_features 3.0 -rm -r ~/.config/fish/functions +rm -r ~/.config/fish/* +ln -s ~/.dotfiles/fish/config.fish ~/.config/fish -a acmus 'timeout --foreground (math 3600 - (date +%s) % 3600) mpv --loop https://acmusicext.com/static/$argv/sunny/(date +%-I%p|tr APM apm).ogg' +curl -sL https://git.io/fisher | source +fisher install {jorgebucaran/replay,PatrickF1/fzf}.fish +set -U fish_features 3.{0,1,4} + +alias a 'alias -s' +a acmus 'timeout (math 60 - (date +%M))m mpv --loop https://acmusicext.com/static/$argv/sunny/(date +%-I%P).ogg' a aliases 'v (env which aliases); command aliases' -a all2jxl 'fd -e{png,jpg} -x cjxl -e 8 -d 0 {} {.}.jxl && fd -e jxl -x rm {.}.{pn,jp}g' -a ao3 'grep -Eo works/[0-9]+ $argv | uniq | tr -d a-z | parallel aria2c "https://ao3.org/downloads{}/\*.epub" -d ao3; rm' +a all2jxl 'fd -e{pn,jp}g -x cjxl -e 8 -d 0 {} {.}.jxl \; -x rm' +a ao3 'grep works/.\*/b $argv | cut -d/ -f3 | parallel curl -OJL ao3.org/downloads/{}/1.epub;:' a base64d 'echo (echo $argv | base64 -d 2>/dev/null) | tee /dev/stderr 2>| clip;:' -a bax 'source (which bax) && bax' a catbox 'curl https://catbox.moe/user/api.php -F reqtype=fileupload -F fileToUpload=@$argv;:' a clip 'xclip -sel clip' a cpugov 's cpupower frequency-set -g performance' @@ -18,43 +21,39 @@ a dot 'cd ~/.dotfiles' a ff 'fd -HILi -Edosdevices -E.git' a g git a giveme 's chown $USER' -a gsopti 'fd -e pdf -x gs -sDEVICE=pdfwrite -dNOPAUSE -sOutputFile={}1 {} && fd -e pdf -x mv {}1 {}' +a gsopti 'fd -e pdf -x gs -sDEVICE=pdfwrite -dNOPAUSE -sOutputFile={}1 {} \; -x mv {}1 {}' a hardinfo 'inxi -SPARM -GCDN -v1 -xGCRS -Fxz' a imgsum 'printf "$argv: " && identify -format "%#\n"' a l ls a la 'l -A' a launcher 'rofi -combi-modi "drun,run" -show combi -modi "combi,window"' -a less 'eval $PAGER' a listen 'pactl list | grep loop && set t un; pactl "$t"load-module module-loopback' a ncdu 'ncdu --color off --graph-style hash' -a nix 'bax . ~/.nix-profile/etc/profile.d/nix.sh; command nix' +a nix 'replay . ~/.nix-profile/etc/profile.d/nix.sh; command nix' +a nsp 'netsurf (pandoc $argv -s -t html | psub -s .html);:' +a nsmd 'netsurf (md2html $argv | psub -s .html);:' a off shutdown -a offh 'off (math "60*"$argv);:' a open xdg-open -a pagedl 'wget -H -k -p --no-clobber -e robots=off' -a png2webp 'fd -e png -x cwebp -z 9 -mt {} -o {.}.webp && fd -e webp -x rm {.}.png' +a png2webp 'fd -e png -x cwebp -z 9 -mt {} -o {.}.webp \; -x rm' a qutainer 'qutebrowser -B /tmp' a rmdirs 'ff -t d -x rmdir -p' a rmlinks 'ff -t l -x rm' a qb 'qutebrowser --target auto' -a qbm 'qb (md2html $argv | psub -s .html);:' a re 'systemctl reboot -i' a s 'sudo env "PATH=$PATH"' a se 's eopkg' -a spleet 'spleeter separate -o . -c flac' a tar bsdtar -a tcsv 'curl -sL http://torrents-csv.ml/service/search?q="$argv"|jq ".[]|.name,.infohash,.seeders";:' +a tcsv 'curl -sL http://torrents-csv.ml/service/search?q=$argv | jq ".[]|.name,.infohash,.seeders";:' a temp 'curl temp.sh -T' -a tldrl 'curl -s https://raw.githubusercontent.com/tldr-pages/tldr/master/pages/{common,linux}/$argv.md;:' +a tldrl 'curl -s https://raw.githubusercontent.com/tldr-pages/tldr/main/pages/{common,linux}/$argv.md;:' a transfer 'curl https://transfer.sh/(basename $argv) -T' a twitch 'mpv https://twitch.tv/$argv & disown ;:' -a twitch-dl 'ffmpeg -i (yt-dlp -e $argv[1]|tr / _) -c copy $argv[2..-1] "file:(yt-dlp -g $argv[1]).mkv"' -a untar 'tar xf' +a uneopkg 'parallel "unzip -op {} install.tar.xz | tar xf -" ::: *.eopkg' a up 'se up --y' a v vi +a venv 'python3 -m venv venv && source venv/bin/activate.fish && pip3 install -r requirements.txt' a vi nvim a wallp 'gsettings set org.gnome.desktop.background picture-uri file://(realpath $argv);:' -a warcdl 'pagedl --warc-file=(basename $argv)' a wm 'startx (which $argv[1]) $argv[2..-1]' a ydl 'while not yt-dlp $argv; end;:' diff --git a/bin/nse b/bin/nse new file mode 100755 index 0000000..b7393a3 --- /dev/null +++ b/bin/nse @@ -0,0 +1,13 @@ +#!/bin/sh +d=$(mktemp -d) +bsdtar xf "$@" -C$d +t=$(fd -e ncx . $d) +xml_grep content $t | uniq | grep content | cut -d\" -f2 |\ + sed -e 's#.*#&
#' -e 's#">[^/<]*/#">#'\ + -e 's/\.xhtml/\.html/g' > $(dirname $t)/index.html +fd -e xhtml . $d -x mv {} {.}.html +if test -z $BROWSER; then + BROWSER=netsurf +fi +eval $BROWSER $(dirname $t)/index.html +rm -rf $d diff --git a/bin/setup b/bin/setup index 1e763a3..d1159e9 100755 --- a/bin/setup +++ b/bin/setup @@ -8,7 +8,7 @@ dev="arcanist ccache git-extras llvm-clang neovim parallel qt-creator solbuild" gui="caja gimp keepassxc kitty nicotine-plus qutebrowser syncthing zathura-mupdf" med="audaci{ty,ous{,-plugins}} avidemux mkvtoolnix mpv opus-tools spek yt-dlp" ric="ant-dracula-gtk-theme autojump font-ubuntu-ttf rofi starship stow" -tui="advancecomp aria2 fd fish fzf innoextract jpegoptim most ncdu ripgrep tig" +tui="advancecomp aria2 fd fish fzf innoextract jpegoptim ncdu ripgrep tig" sys="bleachbit corectrl ifuse linux-tools-cpupower p7zip tlp usbmuxd upx" se up; se it -c system.devel $dev $gui $med $ric $sys $tui @@ -22,7 +22,6 @@ un(){ F=$(mktemp); mkdir -p "$2"; curl https://api.github.com/repos/"$1"/release grep -om1 http.\*zip | wget -i- -O"$F"; unzip "$F" -d "$2";} un bloc97/Anime4k ~/.config/mpv/shaders un mozilla/pdf.js ~/.local/share/qutebrowser/pdfjs -wget https://adsbypasser.github.io/releases/adsbypasser.full.es7.user.js -P ~/.config/qutebrowser/greasemonkey/ pip3 install adblock pipx-in-pipx readability-lxml chsh -s "$(which fish)" diff --git a/bin/zzexe b/bin/zzexe index b1e8a27..57e226d 100755 --- a/bin/zzexe +++ b/bin/zzexe @@ -20,13 +20,13 @@ chmod +x "$out" ln -s "$out" "$dir" trap "res=$?" 0 1 2 3 5 10 13 15 EOF - echo "$prefix"'$dir/`basename $out` $@' >> "$1"~ + echo "$prefix"'$dir/`basename $out` "$@"' >> "$1"~ cat >> "$1"~ << 'EOF' rm "$out" "$dir"/`basename $out` exit $res EOF - zstd --ultra -22 "$1" && + zstdmt --ultra -22 "$1" && cat "$1"~ "$1".zst > "$1" rm "$1".zst "$1~" chmod +x "$1" diff --git a/fish/config.fish b/fish/config.fish index f82912b..b820eac 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -1,30 +1,25 @@ fish_add_path -g ~/{.local,Games}/bin /usr/lib64/ccache/bin +export EDITOR=nvim MANPAGER='nvim +Man!' USE_CCACHE=1 -if tty -s - set -x EDITOR nvim - set -x PAGER most - set -x MANPAGER 'nvim +Man!' - set -x USE_CCACHE 1 +set fish_greeting +set fish_color_command --bold +set fish_color_comment red +set fish_color_end brmagenta +set fish_color_error brred +set fish_color_escape 'bryellow' '--bold' +set fish_color_match --background=brblue +set fish_color_operator bryellow +set fish_color_param cyan +set fish_color_quote yellow +set fish_color_redirection brblue +set fish_color_status red +set fish_color_user brgreen +set fish_color_valid_path --underline +set fish_pager_color_prefix 'white' '--bold' '--underline' - set fish_greeting - set fish_color_command --bold - set fish_color_comment red - set fish_color_end brmagenta - set fish_color_error brred - set fish_color_escape 'bryellow' '--bold' - set fish_color_match --background=brblue - set fish_color_operator bryellow - set fish_color_param cyan - set fish_color_quote yellow - set fish_color_redirection brblue - set fish_color_status red - set fish_color_user brgreen - set fish_color_valid_path --underline - set fish_pager_color_prefix 'white' '--bold' '--underline' +bind \ed 'ncdu' +bind \ef 'fzf | clip' +bind \e\co 'open (_fzf_wrapper)' - bind \ed 'ncdu' - bind \ef 'fzf | clip' - - starship init fish --print-full-init | source - source /usr/share/autojump/autojump.fish -end +source /usr/share/autojump/autojump.fish +tty -s && starship init fish --print-full-init | source diff --git a/qutebrowser/adblock.py b/qutebrowser/adblock.py index a8bf25a..c11dab4 100644 --- a/qutebrowser/adblock.py +++ b/qutebrowser/adblock.py @@ -1,36 +1,15 @@ host = c.content.blocking.hosts.lists.append -host("https://github.com/Perflyst/PiHoleBlocklist/raw/master/AmazonFireTV.txt") -host("https://github.com/jmdugan/blocklists/raw/master/corporations/twitter/all") -host("https://github.com/jmdugan/blocklists/raw/master/corporations/microsoft/all") -host("https://github.com/jmdugan/blocklists/raw/master/corporations/facebook/all") +host("https://www.github.developerdan.com/hosts/lists/facebook-extended.txt") abp = c.content.blocking.adblock.lists.append abp("https://fanboy.co.nz/r/fanboy-ultimate.txt") abp("https://fanboy.co.nz/fanboy-antifacebook.txt") -abp("https://secure.fanboy.co.nz/fanboy-annoyance.txt") -abp("https://secure.fanboy.co.nz/fanboy-cookiemonster.txt") +abp("https://fanboy.co.nz/fanboy-annoyance.txt") +abp("https://fanboy.co.nz/fanboy-cookiemonster.txt") abp("https://easylist-downloads.adblockplus.org/antiadblockfilters.txt") abp("https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt") -abp("https://github.com/brave/adblock-lists/raw/master/brave-unbreak.txt") -abp("https://github.com/brave/adblock-lists/raw/master/coin-miners.txt") -abp("https://github.com/brave/adblock-lists/raw/master/brave-lists/brave-firstparty-cname.txt") -abp("https://github.com/brave/adblock-lists/raw/master/brave-lists/brave-firstparty.txt") -abp("https://github.com/brave/adblock-lists/raw/master/brave-lists/brave-social.txt") - abp("https://github.com/DandelionSprout/adfilt/raw/master/LegitimateURLShortener.txt") abp("https://github.com/DandelionSprout/adfilt/raw/master/AnnoyancesList") abp("https://github.com/DandelionSprout/adfilt/raw/master/SocialShareList.txt") abp("https://github.com/DandelionSprout/adfilt/raw/master/ExtremelyCondensedList.txt") - -abp("https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt") -abp("https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters-2020.txt") -abp("https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters-2021.txt") -abp("https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters-2022.txt") -abp("https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/badware.txt") -abp("https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/privacy.txt") -abp("https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/resource-abuse.txt") -abp("https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/unbreak.txt") -abp("https://github.com/quenhus/uBlock-Origin-dev-filter/raw/main/dist/duckduckgo/global.txt") -abp("https://raw.githubusercontent.com/curbengh/urlhaus-filter/master/urlhaus-filter-online.txt") -abp("https://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus&showintro=1&mimetype=plaintext") diff --git a/qutebrowser/aliases.py b/qutebrowser/aliases.py index 17b1e46..e7acace 100644 --- a/qutebrowser/aliases.py +++ b/qutebrowser/aliases.py @@ -2,7 +2,11 @@ a=c.aliases a['re'] = 'restart' a['mpv'] = 'spawn -mdv mpv --ytdl-raw-options=sub-lang=en' a['css-reload'] = 'set content.user_stylesheets user.css' -a['scss-reload'] = 'spawn -u /bin/sh -c "sass $QUTE_CONFIG_DIR/user.{s,}css"' +a['scss-reload'] = 'spawn -u /bin/bash -c "sassc $QUTE_CONFIG_DIR/user.{s,}css"' a['remove-sticky'] = 'jseval -q document.querySelectorAll("*").forEach(e=>{["sticky","fixed"].includes(getComputedStyle(e).position)&&e.parentNode.removeChild(e)})' a['toggle-dark'] = 'reload;;jseval -q const meta=document.createElement("meta");meta.name="color-scheme";document.head.appendChild(meta).content="dark";;stop' a['shutup'] = 'jseval -q document.head.appendChild(document.createElement("style")).innerHTML="@import url(https://rickyromero.com/shutup/updates/shutup.css)"' +a['monolith-save'] = 'spawn kitty fish -c "monolith {url} -o' + +a['ao3-first'] = 'jseval -q window.location.href=document.getElementsByTagName(\'option\')[0].value' +a['ao3-latest'] = 'jseval -q c=document.getElementsByTagName(\'option\'); window.location.href = c[c.length-1].value' diff --git a/qutebrowser/bindings.py b/qutebrowser/bindings.py index 46c4416..15706a3 100644 --- a/qutebrowser/bindings.py +++ b/qutebrowser/bindings.py @@ -3,8 +3,8 @@ bind = { '': 'close', '': 'spawn -u readability', '': 'tab-close', - '': 'jseval -q c=document.getElementsByTagName(\'option\'); window.location.href = c[c.length-1].value', - '': 'jseval -q window.location.href=document.getElementsByTagName(\'option\')[0].value', + '': 'ao3-first', + '': 'ao3-latest', '' : 'config-cycle hints.chars qwerasdf asdfghjkl', ',': 'hint links run mpv {hint-url}', ';a': 'hint links run ' + kitdl + ' dl {hint-url}"', @@ -19,7 +19,7 @@ bind = { 'sc': 'toggle-dark', 'sd': "spawn fish -c 'dl; open (ls | rofi -dmenu -b -i || exit 0)'", 'sg': 'debug-dump-page ~/Downloads/dump.html', - 'sm': 'spawn kitty fish -c "monolith {url} -o ~/Downloads/{url:domain}.html"', + 'sm': 'monolith-save ~/Downloads/dump.html"', 'sq': 'spawn -u qr', 'sr': 'remove-sticky', 'st': 'config-cycle -p content.proxy socks://localhost:9050/ system', diff --git a/qutebrowser/config.py b/qutebrowser/config.py index 349555d..7140e05 100644 --- a/qutebrowser/config.py +++ b/qutebrowser/config.py @@ -6,12 +6,10 @@ config.source('bindings.py') config.source('javascript.py') config.source('redirects.py') -import subprocess -subprocess.run(["sass", config.configdir / 'user.scss', config.configdir / 'user.css']) - c.url.start_pages = c.url.default_page = 'megafocs.herokuapp.com' config.set('content.javascript.enabled', True, c.url.start_pages) c.url.searchengines['y'] = 'farside.link/invidious/search?q={}' +c.url.searchengines['DEFAULT'] = 'kagi.com/search?q={}' c.tabs.show = 'multiple' c.confirm_quit = ['downloads'] @@ -23,9 +21,6 @@ c.colors.webpage.darkmode.enabled = True c.colors.webpage.preferred_color_scheme = 'dark' c.colors.webpage.darkmode.policy.images = 'never' -config.set('content.notifications.enabled', True, 'https://mail.tutanota.com') -config.set('content.register_protocol_handler', True, 'https://mail.tutanota.com') - import socket if socket.gethostname() == 'wheatley': c.zoom.default = 125 diff --git a/qutebrowser/javascript.py b/qutebrowser/javascript.py index 843bf31..8290061 100644 --- a/qutebrowser/javascript.py +++ b/qutebrowser/javascript.py @@ -1,7 +1,6 @@ c.content.javascript.enabled = False sites = [ 'canary.discord.com', - 'duckduckgo.com', 'mail.tutanota.com', '*.rpi.edu', 'api-3e0243bb.duosecurity.com', @@ -11,3 +10,6 @@ for site in sites: config.set('content.headers.user_agent', 'iPhone', 'docs.google.com') config.set('content.headers.user_agent', 'iPhone', 'drive.google.com') + +config.set('content.notifications.enabled', True, 'https://mail.tutanota.com') +config.set('content.register_protocol_handler', True, 'https://mail.tutanota.com') diff --git a/qutebrowser/user.scss b/qutebrowser/user.scss index ee1a6d7..0863c62 100644 --- a/qutebrowser/user.scss +++ b/qutebrowser/user.scss @@ -1,9 +1,12 @@ @import url(https://nitter.net/css/themes/twitter_dark.css); -@import url(https://necolas.github.io/normalize.css/latest/normalize.css); +@import url(http://source.netsurf-browser.org/netsurf.git/plain/resources/adblock.css); + #hnmain { zoom: 120%; - background: #212121; - td[bgcolor="#ff6600"] {background: #4b5762} + background: #212121 !important; + td[bgcolor="#ff6600"] {background: #4b5762 !important} + .title a:link, .c00, .c00 a:link {color: #FFF !important} + [action="comment"] {display:none} } #app-mount { @@ -24,20 +27,19 @@ "https://cdn.discordapp.com/attachments/773556458234052608/929383713932992512/0dKbZO5-16-9.webp" )} - body.dracula {max-width: 777pt} body>nav:nth-child(1) {position: absolute} -tbody>tr>[bgcolor="#CCCCCC"] {background: #000000} +details:not([open]) > div.selftext {display:none} +.thumbnail img.thumbnail{max-height:450px;width:auto!important;} div.doc-container div.doc div {max-width: 666pt !important; margin: auto} -.qute-readability {margin: auto !important} p#javascript-warning, [class^=nativead] {display: none} ul.work > li.download { font-size: 0; > ul { - border: none; - position: unset; - > li {font-size: small; &:not(:nth-child(2)) {display: none}} + border: none !important; + position: static !important; + > li {font-size: small; &:not(:nth-child(2)) {display: none !important}} } } @@ -53,18 +55,18 @@ $id: ads, leaderboard, player-ads, rc-row-container; @each $i in $id {##{$i} {display:none}} body { + --accent: #bd93f9; + --accent_dark: #715895; + --accent_light: #d7befb; + --background: #282a36; --bg_color: #282a36; + --bg_hover: #383a45; + --bg_panel: #232531; + --darkest_grey: #1f212c; --fg_color: #FFFFFF; --fg_faded: #8899A6; - --bg_panel: #232531; - --bg_hover: #383a45; - --more_replies_dots: var(--accent_dark); - --darkest_grey: #1f212c; - --accent: #bd93f9; - --accent_light: #d7befb; - --accent_dark: #715895; - --background: #282a36; --foreground: #3d4051; + --more_replies_dots: var(--accent_dark); --outside: #393c4d; --post: #333544; }