From 3b0142cedcde39e4c2097ecd916a870a3ced5ec6 Mon Sep 17 00:00:00 2001 From: Vito Graffagnino Date: Tue, 8 Sep 2020 18:10:49 +0100 Subject: Added the relevent parts of the .config directory. Alss add ssh config --- .w3m/bookmark.html | 260 ++++++++++++++++++++++++++++++++++++++ .w3m/bufinfo | 1 + .w3m/cgi-bin/fzf_surfraw.cgi | 42 ++++++ .w3m/cgi-bin/fzf_surfraw_tmux.cgi | 40 ++++++ .w3m/cgi-bin/magnet.py | 23 ++++ .w3m/cgi-bin/treat_as_url.cgi | 36 ++++++ .w3m/config | 154 ++++++++++++++++++++++ .w3m/cookie | 4 + .w3m/keymap | 73 +++++++++++ .w3m/mailcap | 0 .w3m/menu | 33 +++++ .w3m/urimethodmap | 2 + 12 files changed, 668 insertions(+) create mode 100644 .w3m/bookmark.html create mode 100755 .w3m/bufinfo create mode 100755 .w3m/cgi-bin/fzf_surfraw.cgi create mode 100755 .w3m/cgi-bin/fzf_surfraw_tmux.cgi create mode 100755 .w3m/cgi-bin/magnet.py create mode 100755 .w3m/cgi-bin/treat_as_url.cgi create mode 100755 .w3m/config create mode 100644 .w3m/cookie create mode 100755 .w3m/keymap create mode 100755 .w3m/mailcap create mode 100644 .w3m/menu create mode 100755 .w3m/urimethodmap (limited to '.w3m') diff --git a/.w3m/bookmark.html b/.w3m/bookmark.html new file mode 100644 index 0000000..4c4f290 --- /dev/null +++ b/.w3m/bookmark.html @@ -0,0 +1,260 @@ +Bookmarks + +

Bookmarks

+

UoH

+ +

Astronomy

+ +

Linux

+ +

WebOS

+ +

S/W Development

+

Python

+ +

Perl

+ +

Ruby

+ +

Go

+ +

Haskell

+ +

IRC

+ +

Miscellaneous

+ +

Tor

+ + + diff --git a/.w3m/bufinfo b/.w3m/bufinfo new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/.w3m/bufinfo @@ -0,0 +1 @@ + diff --git a/.w3m/cgi-bin/fzf_surfraw.cgi b/.w3m/cgi-bin/fzf_surfraw.cgi new file mode 100755 index 0000000..00921cc --- /dev/null +++ b/.w3m/cgi-bin/fzf_surfraw.cgi @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +### _ _ _ _ +### __ _ ___ | |_| |__ | | ___| |_ _ _ +### / _` |/ _ \| __| '_ \| |/ _ \ __| | | | +###| (_| | (_) | |_| |_) | | __/ |_| |_| | +### \__, |\___/ \__|_.__/|_|\___|\__|\__,_| +### |___/ +### https://www.youtube.com/user/gotbletu +### https://twitter.com/gotbletu +### https://github.com/gotbletu +### gotbletu@gmail.com +### +### Author : gotbletu +### Name : fzf_surfraw.cgi +### Version : 0.2 +### Date : 2020-04-27 +### Description : interactive surfraw smart prefix search engine (mainly use within w3m web browser) +### Depends On : surfraw fzf xsel gawk coreutils grep procps-ng +### Video Demo : https://youtu.be/p5NZb8f8AHA +### References : https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m + +### Setup +# vim ~/.w3m/keymap +# keymap xs COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; GOTO /usr/lib/w3m/cgi-bin/goto_clipboard_primary.cgi" +# keymap XS COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; TAB_GOTO /usr/lib/w3m/cgi-bin/goto_clipboard_primary.cgi" +# keymap xs COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; GOTO /usr/lib/w3m/cgi-bin/goto_clipboard.cgi" +# keymap XS COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; TAB_GOTO /usr/lib/w3m/cgi-bin/goto_clipboard.cgi" + +clear + +# select your elvi +PREFIX=$(surfraw -elvi | grep -v 'LOCAL\|GLOBAL'| fzf -e | awk '{print $1}') + +# exit script if no elvi is selected (e.g hit ESC) +if [ "$PREFIX" = "" ]; then exit; fi + +# get user input +read -r -e -p " $PREFIX >> Enter Your Search Keyword: " INPUT + +# print proper url and copy to primary clipboard (aka highlighted clipboard) and tmux clipboard +surfraw -browser=echo "$PREFIX" "$INPUT" | xsel -p +# pidof tmux >/dev/null && tmux set-buffer "$(surfraw -browser=echo "$PREFIX" "$INPUT")" diff --git a/.w3m/cgi-bin/fzf_surfraw_tmux.cgi b/.w3m/cgi-bin/fzf_surfraw_tmux.cgi new file mode 100755 index 0000000..7813c7c --- /dev/null +++ b/.w3m/cgi-bin/fzf_surfraw_tmux.cgi @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +### _ _ _ _ +### __ _ ___ | |_| |__ | | ___| |_ _ _ +### / _` |/ _ \| __| '_ \| |/ _ \ __| | | | +###| (_| | (_) | |_| |_) | | __/ |_| |_| | +### \__, |\___/ \__|_.__/|_|\___|\__|\__,_| +### |___/ +### https://www.youtube.com/user/gotbletu +### https://twitter.com/gotbletu +### https://github.com/gotbletu +### gotbletu@gmail.com +### +### Author : gotbletu +### Name : fzf_surfraw_tmux.cgi +### Version : 0.2 +### Date : 2020-04-27 +### Description : interactive surfraw smart prefix search engine (mainly use within w3m web browser) +### Depends On : surfraw fzf tmux gawk coreutils grep procps-ng +### Video Demo : https://youtu.be/p5NZb8f8AHA +### References : https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m + +### Setup +# vim ~/.w3m/keymap +# keymap xs COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw_tmux.cgi ; GOTO /usr/lib/w3m/cgi-bin/goto_tmux_clipboard.cgi" +# keymap XS COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw_tmux.cgi ; TAB_GOTO /usr/lib/w3m/cgi-bin/goto_tmux_clipboard.cgi" + +clear + +# select your elvi +PREFIX=$(surfraw -elvi | grep -v 'LOCAL\|GLOBAL'| fzf -e | awk '{print $1}') + +# exit script if no elvi is selected (e.g hit ESC) +if [ "$PREFIX" = "" ]; then exit; fi + +# get user input +read -r -e -p " $PREFIX >> Enter Your Search Keyword: " INPUT + +# print proper url and copy to primary clipboard (aka highlighted clipboard) and tmux clipboard +# surfraw -browser=echo "$PREFIX" "$INPUT" | xsel -p +pidof tmux >/dev/null && tmux set-buffer "$(surfraw -browser=echo "$PREFIX" "$INPUT")" diff --git a/.w3m/cgi-bin/magnet.py b/.w3m/cgi-bin/magnet.py new file mode 100755 index 0000000..72b51d4 --- /dev/null +++ b/.w3m/cgi-bin/magnet.py @@ -0,0 +1,23 @@ +#!/usr/bin/python2 +# coding=utf-8 + +import sys +import os +import subprocess + +uri = os.environ.get('QUERY_STRING') +referer = os.environ.get('HTTP_REFERER') + +if not uri: + print + print "Error: No URI" + sys.exit() + +cmd_list = ("transmission-remote", "-a", uri) + +subprocess.call(cmd_list) + +if referer: + print "HTTP/1.1 303 See Other" + print "Location: %s" % referer + diff --git a/.w3m/cgi-bin/treat_as_url.cgi b/.w3m/cgi-bin/treat_as_url.cgi new file mode 100755 index 0000000..98307ce --- /dev/null +++ b/.w3m/cgi-bin/treat_as_url.cgi @@ -0,0 +1,36 @@ +#!/bin/bash - +#=============================================================================== +# +# FILE: treat_as_url.sh +# +# USAGE: ./treat_as_url.sh +# +# DESCRIPTION: Make w3m treat all plain text urls as real clickable urls +# +# OPTIONS: --- +# REQUIREMENTS: This script has to be located in the root path /usr/lib/w3m/cgi-bin/treat_as_url.cgi +# BUGS: --- +# NOTES: Install: +# chmod +x treat_as_url.cgi +# sudo cp treat_as_url.cgi /usr/lib/w3m/cgi-bin +# +# Newsboat: +# vim ~/.newsboat/config +# pager "w3m /usr/lib/w3m/cgi-bin/treat_as_url.cgi %f" +# +# w3m mark regular files: +# w3m /usr/lib/w3m/cgi-bin/treat_as_url.cgi filename.txt +# +# w3m mark url: +# w3m /usr/lib/w3m/cgi-bin/treat_as_url.cgi +# +# AUTHOR: Hola Mundo (https://www.youtube.com/channel/UCK9HlJ89Bzf7VwwMnv1w) +# Reference: http://w3m.sourceforge.net/MANUAL#LocalCGI +# ORGANIZATION: +# CREATED: 19/10/18 15:05:30 +# REVISION: --- +#=============================================================================== + +printf "%s\r\n" "W3m-control: PREV"; +printf "%s\r\n" "W3m-control: MARK_URL"; + diff --git a/.w3m/config b/.w3m/config new file mode 100755 index 0000000..e93235f --- /dev/null +++ b/.w3m/config @@ -0,0 +1,154 @@ +tabstop 8 +indent_incr 4 +pixel_per_char 7 +pixel_per_line 38 +frame 0 +target_self 0 +open_tab_blank 0 +open_tab_dl_list 0 +display_link 1 +display_link_number 1 +decode_url 0 +display_lineinfo 1 +ext_dirlist 1 +dirlist_cmd file:///$LIB/dirlist.cgi +use_dictcommand 0 +dictcommand file:///$LIB/w3mdict.cgi +multicol 0 +alt_entity 0 +graphic_char 0 +display_borders 1 +fold_textarea 0 +display_ins_del 1 +ignore_null_img_alt 1 +view_unseenobject 0 +display_image 1 +pseudo_inlines 1 +auto_image 1 +max_load_image 4 +ext_image_viewer 1 +image_scale 70 +imgdisplay w3mimgdisplay +image_map_list 1 +fold_line 0 +show_lnum 1 +show_srch_str 1 +label_topline 0 +nextpage_topline 1 +color 1 +basic_color terminal +anchor_color blue +image_color green +form_color red +mark_color cyan +bg_color terminal +active_style 0 +active_color cyan +visited_anchor 0 +visited_color magenta +pagerline 10000 +use_history 1 +history 100 +save_hist 1 +confirm_qq 1 +close_tab_back 0 +mark 0 +emacs_like_lineedit 0 +vi_prec_num 0 +mark_all_pages 0 +wrap_search 0 +ignorecase_search 1 +use_mouse 1 +reverse_mouse 0 +relative_wheel_scroll 0 +relative_wheel_scroll_ratio 30 +fixed_wheel_scroll_count 5 +clear_buffer 1 +decode_cte 0 +auto_uncompress 0 +preserve_timestamp 1 +keymap_file keymap +document_root +personal_document_root +cgi_bin ~/.w3m/cgi-bin +index_file +mime_types ~/.mime.types, /etc/mime.types +mailcap ~/.w3m/mailcap, /etc/w3m/mailcap +urimethodmap ~/.w3m/urimethodmap, /etc/w3m/urimethodmap +editor /usr/bin/vi +mailto_options 1 +mailer /usr/bin/mail +extbrowser ${BROWSER} +extbrowser2 bash -c 'transmission-remote -a "$0" && notify-send -t 3000 -i emblem-downloads "Adding Torrent" "$0" ' +extbrowser3 bash -c 'echo -n "$0" | xclip -selection clipboard && notify-send -t 3000 -i edit-copy "W3M URL Yank To Clipboard" "$0"' +extbrowser4 bash -c 'TS_SOCKET=/tmp/ytdl ts youtube-dl "$0" && notify-send -t 3000 -i package-x-generic "youtube-dl: Downloading" "$0" ' +extbrowser5 bash -c 'TS_SOCKET=/tmp/w3m ts /usr/bin/aria2c -j 1 -c -d $HOME/Downloads "$0" && notify-send -t 3000 -i package-x-generic "Aria2c: Downloading" "$0" ' +extbrowser6 bash -c 'TS_SOCKET=/tmp/mpv ts /usr/bin/mpv -ytdl -slang=en --ontop --force-window --autofit=500x200 --geometry=-15-50 "$0" && notify-send -t 3000 -i video-x-generic "MPV Queue" "$0"' +extbrowser7 +extbrowser8 bash -c '/bin/zathura "$0" && notify-send -t 500 -i package-x-generic "zathura: Launching"' +extbrowser9 bash -c 'export CUPS_SERVER="star-server.herts.ac.uk" && /bin/zathura "$0" && notify-send -t 500 -i package-x-generic "zathura: Launching"' +bgextviewer 1 +use_lessopen 0 +passwd_file ~/.w3m/passwd +disable_secret_security_check 0 +ftppasswd +ftppass_hostnamegen 1 +pre_form_file ~/.w3m/pre_form +siteconf_file ~/.w3m/siteconf +user_agent Mozilla/5.0 (Linux i686; U; w3m 0.5.3; en) +no_referer 0 +accept_language en;q=1.0 +accept_encoding gzip, compress, bzip, bzip2, deflate +accept_media text/html, text/*;q=0.5, image/* +argv_is_url 1 +retry_http 1 +default_url 1 +follow_redirection 10 +meta_refresh 0 +dns_order 0 +nntpserver news +nntpmode +max_news 50 +use_proxy 1 +http_proxy +https_proxy +ftp_proxy +no_proxy +noproxy_netaddr 1 +no_cache 0 +ssl_forbid_method 2, 3 +ssl_verify_server 1 +ssl_cert_file +ssl_key_file +ssl_ca_path +ssl_ca_file +use_cookie 1 +show_cookie 0 +accept_cookie 1 +accept_bad_cookie 0 +cookie_reject_domains +cookie_accept_domains +cookie_avoid_wrong_number_of_dots +display_charset UTF-8 +document_charset UTF-8 +auto_detect 2 +system_charset UTF-8 +follow_locale 1 +ext_halfdump 0 +use_wide 1 +use_combining 1 +east_asian_width 0 +use_language_tag 1 +ucs_conv 1 +pre_conv 0 +search_conv 1 +fix_width_conv 1 +use_gb12345_map 0 +use_jisx0201 0 +use_jisc6226 0 +use_jisx0201k 0 +use_jisx0212 0 +use_jisx0213 0 +strict_iso2022 1 +gb18030_as_ucs 0 +simple_preserve_space 0 diff --git a/.w3m/cookie b/.w3m/cookie new file mode 100644 index 0000000..024c782 --- /dev/null +++ b/.w3m/cookie @@ -0,0 +1,4 @@ +https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fusers%2Fvitograffagninoxyz%2Femails%2F124595954%2Fconfirm_verification%2F906a783599a30fbd6ef5ac9f7d599a322b9545b7 logged_in no 1630866545 .github.com / 15 0 +https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fusers%2Fvitograffagninoxyz%2Femails%2F124595954%2Fconfirm_verification%2F906a783599a30fbd6ef5ac9f7d599a322b9545b7 _octo GH1.1.989484477.1599330545 1630866545 .github.com / 15 0 +https://www.youtube.com/user/gotbletu VISITOR_INFO1_LIVE mDlKXk58i1U 1614872715 .youtube.com / 15 0 +https://eztv.io/search/the%20boys __cfduid dc876c22511fa549eab362853c2ad9cbb1599315805 1601907805 .eztv.io / 15 0 diff --git a/.w3m/keymap b/.w3m/keymap new file mode 100755 index 0000000..1f0ade4 --- /dev/null +++ b/.w3m/keymap @@ -0,0 +1,73 @@ + # External Commands {{{ + # EXTERN_LINK = under cursor + # EXTERN = current page + + # open current url (default: Shift+M) + # e.g. 2+Shift+M + #keymap e EXTERN + keymap e EXTERN_LINK ~/bin/scripts/urlportal.sh + + # open url under cursor (default: Esc+Shift+M) + # e.g. 2+Esc+Shift+M + keymap f EXTERN_LINK + + # yank url to clipboard + keymap yy EXTERN_LINK '(echo -n %s | xsel -b)' + keymap YY EXTERN '(echo -n %s | xsel -b)' + # yank url to tmux clipboard + keymap ys EXTERN_LINK 'tmux set-buffer' + keymap YS EXTERN 'tmux set-buffer' + + # open gui browser + keymap xw EXTERN_LINK '$BROWSER' + keymap XW EXTERN '$BROWSER' + keymap xn EXTERN_LINK '$BROWSER_PRIVATE' + keymap XN EXTERN '$BROWSER_PRIVATE' + + # queue download file (task-spooler) + keymap xd EXTERN_LINK 'TS_SOCKET=/tmp/w3m tsp aria2c -j 1 -x 2 -c -d ~/Downloads' + keymap xD EXTERN_LINK 'TS_SOCKET=/tmp/w3m tsp wget -c -P ~/Downloads' + + # queue external media player (task-spooler) e.g youtube, video links + keymap xm EXTERN_LINK 'tsp mpv --ontop --no-border --force-window --autofit=500x280 --geometry=-15-53' + keymap XM EXTERN 'tsp mpv --ontop --no-border --force-window --autofit=500x280 --geometry=-15-53' + + # open external image viewer + keymap xi EXTERN_LINK 'sxiv -g 900x600-15+60 %s &' + keymap xI EXTERN_LINK 'w3m -o display_image=1 -o imgdisplay=w3mimgdisplay' + keymap xg EXTERN_LINK 'mpv --loop --quiet --ontop --no-border --force-window --autofit=900x600 --geometry=-15+60' + keymap xz EXTERN_LINK 'zathura' + + # add torrent or magnetlinks + keymap xt EXTERN_LINK 'transmission-remote --add' + + # basic task-spooler view, cat, clear + keymap ts SHELL 'watch TS_SOCKET=/tmp/w3m tsp' + keymap TS SHELL 'clear && TS_SOCKET=/tmp/w3m tsp -c' + keymap tc SHELL 'clear && TS_SOCKET=/tmp/w3m tsp -C' + + # for x sessions + keymap xs COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; GOTO /usr/lib/w3m/cgi-bin/goto_clipboard_primary.cgi" + keymap XS COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; TAB_GOTO /usr/lib/w3m/cgi-bin/goto_clipboard_primary.cgi" + # keymap xs COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; GOTO /usr/lib/w3m/cgi-bin/goto_clipboard.cgi" + # keymap XS COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; TAB_GOTO /usr/lib/w3m/cgi-bin/goto_clipboard.cgi" + + # for tmux users or headless server + # keymap xs COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw_tmux.cgi ; GOTO /usr/lib/w3m/cgi-bin/goto_tmux_clipboard.cgi" + # keymap XS COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw_tmux.cgi ; TAB_GOTO /usr/lib/w3m/cgi-bin/goto_tmux_clipboard.cgi" + + # View these user-defined commands + keymap \\\? COMMAND "HELP; SEARCH User-Defined; CENTER_V" + keymap \\\m COMMAND "SHELL 'man w3m'" + + keymap \\\t COMMAND "SET_OPTION display_borders=toggle ; RESHAPE" + keymap \\\i COMMAND "SET_OPTION display_image=toggle ; RELOAD" + keymap \\\e COMMAND "SET_OPTION user_agent='' ; RELOAD" + keymap \\\a COMMAND "SET_OPTION user_agent='Opera/9.80 (S60; SymbOS; Opera Mobi/SYB-1107071606; U; en) Presto/2.8.149 Version/11.10' ; RELOAD" + keymap t COMMAND "TAB_GOTO https://duckduckgo.com/lite/; NEXT_LINK; GOTO_LINK" + keymap sg COMMAND "TAB_GOTO https://google.com/; GOTO_LINE 6; NEXT_LINK; GOTO_LINK" + keymap s1 COMMAND "TAB_GOTO https://1337x.to/; GOTO_LINE 6; NEXT_LINK; GOTO_LINK" + keymap sx COMMAND "TAB_GOTO https://stackexchange.com/; GOTO_LINE 7; NEXT_LINK; GOTO_LINK" + + # }}} + diff --git a/.w3m/mailcap b/.w3m/mailcap new file mode 100755 index 0000000..e69de29 diff --git a/.w3m/menu b/.w3m/menu new file mode 100644 index 0000000..c40fe54 --- /dev/null +++ b/.w3m/menu @@ -0,0 +1,33 @@ +menu Main + popup "Buffer ops >(b)" Buffer "b" + popup "Links ops >(l)" Link "lL" + nop "---------------" + popup "Bookmarks >(B)" Bookmark "B" + func "Help >(h)" HELP "hH" + func "Options >(o)" OPTIONS "oO" + nop "---------------" + func "Quit >(o)" OPTIONS "qQ" +end + +menu Buffer + popup "Buffer selection (s)" Select "s" + func "URL new tab (o)" TAB_GOTO "oO" + func "View source (v)" VIEW "vV" + func "Edit source (e)" EDIT "eE" + func "Save source (S)" SAVE "S" + func "Reload (r)" RELOAD "rR" +end + +menu Link + func "Go Link (a)" GOTO_LINK "a" + func "Save Link (A)" SAVE_LINK "A" + func "View Image (i)" VIEW_IMAGE "i" + func "Save Image (I)" SAVE_IMAGE "I" + func "View Frame (f)" FRAME "fF" +end + +menu Bookmark + func "Read bookmark (b)" BOOKMARK "bB" + func "Add page to bookmark (a)" BOOKMARK "aA" +end + diff --git a/.w3m/urimethodmap b/.w3m/urimethodmap new file mode 100755 index 0000000..ad443c2 --- /dev/null +++ b/.w3m/urimethodmap @@ -0,0 +1,2 @@ +magnet: file:/cgi-bin/magnet.py?%s + -- cgit v1.2.3