commit 2437798d3976b4be74d039b747cb07e3c3acc41c
parent 3dea0c3d6bec2b10b159829bd24a747e35c7b562
Author: somename123 <m040601@users.noreply.github.com>
Date: Sun, 26 Jan 2020 17:23:52 +0000
Add files via upload
Diffstat:
9 files changed, 349 insertions(+), 0 deletions(-)
diff --git a/mybins/bukuaddxsel.sh b/mybins/bukuaddxsel.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+xsel | buku -a
diff --git a/mybins/elinksalbumview b/mybins/elinksalbumview
@@ -0,0 +1,2 @@
+curl -s $1 | grep -P "(?<=href=\"//)i.imgur.com.{12}" --color -o | sed "s/^/http:\/\//" | tr '\n' ' '
+
diff --git a/mybins/elinksmediaswitch b/mybins/elinksmediaswitch
@@ -0,0 +1,21 @@
+#!/bin/sh
+# If $1 contains youtube, mpv it, if imgur gallery, extract filenames and
+# view in feh. If gfycat, extract filenames with sed and view in mpv.
+# elinks https://github.com/alex-wellbelove/cli-media-viewer
+
+if [[ $1 =~ "youtu" ]]; then
+ mpv --hwdec=vaapi --vo=opengl --ytdl-format="bestvideo[height<=?640]+bestaudio/best" "$1"
+elif [[ $1 =~ "gifv" ]]; then
+ urxvt -e mpv "$1"
+elif [[ $1 =~ "imgur.com/a/" ]]; then
+ urxvt -e feh `elinksalbumview $1` -Z -F --draw-filename
+elif [[ $1 =~ "imgur.com/gallery/" ]]; then
+ urxvt -e feh `elinksalbumview $1` -Z -F --draw-filename
+elif [[ $1 =~ "imgur" ]]; then
+ urxvt -e feh -. `fehparser $1`
+elif [[ $1 =~ "gfycat" ]]; then
+ urxvt -e mpv `echo $1 |sed -e 's/gfycat/zippy.gfycat/g'`.webm
+else
+ urxvt -e elinks "$1"
+fi
+
diff --git a/mybins/elinksremoty.sh b/mybins/elinksremoty.sh
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+elinks -remote "$1"
diff --git a/mybins/fzf-preview.sh b/mybins/fzf-preview.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+
+REVERSE="\x1b[7m"
+RESET="\x1b[m"
+
+if [ -z "$1" ]; then
+ echo "usage: $0 FILENAME[:LINENO][:IGNORED]"
+ exit 1
+fi
+
+IFS=':' read -r -a INPUT <<< "$1"
+FILE=${INPUT[0]}
+CENTER=${INPUT[1]}
+
+if [[ $1 =~ ^[A-Z]:\\ ]]; then
+ FILE=$FILE:${INPUT[1]}
+ CENTER=${INPUT[2]}
+fi
+
+if [ ! -r "$FILE" ]; then
+ echo "File not found ${FILE}"
+ exit 1
+fi
+
+if [[ "$(file --dereference --mime "$FILE")" =~ binary ]]; then
+ echo "$1 is a binary file"
+ exit 0
+fi
+
+if [ -z "$CENTER" ]; then
+ CENTER=0
+fi
+
+if [ -z "$LINES" ]; then
+ if [ -r /dev/tty ]; then
+ LINES=$(stty size < /dev/tty | awk '{print $1}')
+ else
+ LINES=40
+ fi
+fi
+
+FIRST=$(($CENTER-$LINES/3))
+FIRST=$(($FIRST < 1 ? 1 : $FIRST))
+LAST=$((${FIRST}+${LINES}-1))
+
+DEFAULT_COMMAND="bat --style=numbers --color=always {} || highlight -O ansi -l {} || coderay {} || rougify {} || cat {}"
+CMD=${FZF_PREVIEW_COMMAND:-$DEFAULT_COMMAND}
+CMD=${CMD//{\}/$(printf %q "$FILE")}
+
+eval "$CMD" 2> /dev/null | awk "NR >= $FIRST && NR <= $LAST { \
+ if (NR == $CENTER) \
+ { gsub(/\x1b[[0-9;]*m/, \"&$REVERSE\"); printf(\"$REVERSE%s\n$RESET\", \$0); } \
+ else printf(\"$RESET%s\n\", \$0); \
+ }"
diff --git a/mybins/fzf-urlview b/mybins/fzf-urlview
@@ -0,0 +1,72 @@
+#!/usr/bin/env bash
+# via fzf wiki
+# https://github.com/D630/bin/
+#
+# Simple replacement for urlview using fzf in X.
+#
+# Usage:
+#
+# $ furlview FILE1 ... FILEn
+# $ foo | furlview
+# $ furlview < FILE
+# $ furlview <<< "foo"
+# $ furlview <<URIS
+## foo
+## URIS
+#
+# FILE is regular or piped, that is also <(foo)
+
+function __x_web_browser {
+ setsidw x-web-browser "$1";
+};
+
+function __fzf {
+ fzf --tac -e -i -m;
+};
+
+function __ugrep {
+ grep-urls;
+};
+
+function __select {
+ __ugrep |
+ __fzf;
+};
+
+function __is_file [[ -p $1 || -f $1 ]];
+
+if
+ __is_file /dev/stdin;
+then
+ mapfile -t furls < <(__select);
+else
+ (($#)) || {
+ printf %s\\n aaarg? 1>&2;
+ exit 1;
+ };
+ mapfile -t furls < <(
+ for a; do
+ if
+ __is_file "$a";
+ then
+ cat -- "$a";
+ else
+ printf 'File %s is neather a regular file nor a named pipe, that is executable' "$a" 1>&2;
+ exit 1;
+ fi;
+ done |
+ __select;
+ );
+fi;
+
+case $DISPLAY in
+ ('')
+ ! :;;
+ (*)
+ for u in "${furls[@]}"; do
+ __x_web_browser "$u" &
+ done;
+ wait;;
+esac;
+
+# vim: set ft=sh :
diff --git a/mybins/myreadability b/mybins/myreadability
@@ -0,0 +1,4 @@
+#!/usr/bin/python3
+# from readability.readability import main
+from readability.readability import main
+main()
diff --git a/mybins/rofi-web-search.sh b/mybins/rofi-web-search.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+# rofi-scripts/web-search.sh at master ยท miroslavvidovic/rofi-scripts
+# https://github.com/miroslavvidovic/rofi-scripts/blob/master/web-search.sh
+
+
+
+
+# -----------------------------------------------------------------------------
+# Info:
+# author: Miroslav Vidovic
+# file: web-search.sh
+# created: 24.02.2017.-08:59:54
+# revision: ---
+# version: 1.0
+# -----------------------------------------------------------------------------
+# Requirements:
+# rofi
+# Description:
+# Use rofi to search the web.
+# Usage:
+# web-search.sh
+# -----------------------------------------------------------------------------
+# Script:
+
+declare -A URLS
+
+URLS=(
+ ["google"]="https://www.google.com/search?q="
+ ["bing"]="https://www.bing.com/search?q="
+ ["yahoo"]="https://search.yahoo.com/search?p="
+ ["duckduckgo"]="https://www.duckduckgo.com/?q="
+ ["yandex"]="https://yandex.ru/yandsearch?text="
+ ["github"]="https://github.com/search?q="
+ ["goodreads"]="https://www.goodreads.com/search?q="
+ ["stackoverflow"]="http://stackoverflow.com/search?q="
+ ["symbolhound"]="http://symbolhound.com/?q="
+ ["searchcode"]="https://searchcode.com/?q="
+ ["openhub"]="https://www.openhub.net/p?ref=homepage&query="
+ ["superuser"]="http://superuser.com/search?q="
+ ["askubuntu"]="http://askubuntu.com/search?q="
+ ["imdb"]="http://www.imdb.com/find?ref_=nv_sr_fn&q="
+ ["rottentomatoes"]="https://www.rottentomatoes.com/search/?search="
+ ["piratebay"]="https://thepiratebay.org/search/"
+ ["youtube"]="https://www.youtube.com/results?search_query="
+ ["vimawesome"]="http://vimawesome.com/?q="
+)
+
+# List for rofi
+gen_list() {
+ for i in "${!URLS[@]}"
+ do
+ echo "$i"
+ done
+}
+
+main() {
+ # Pass the list to rofi
+ platform=$( (gen_list) | rofi -dmenu -matching fuzzy -only-match -location 0 -p "Search > " )
+
+ query=$( (echo ) | rofi -dmenu -matching fuzzy -location 0 -p "Query > " )
+ if [[ -n "$query" ]]; then
+ url=${URLS[$platform]}$query
+ xdg-open "$url"
+ else
+ rofi -show -e "No query provided."
+ fi
+}
+
+main
+
+exit 0
diff --git a/mybins/urlview-factory-url_handler.sh b/mybins/urlview-factory-url_handler.sh
@@ -0,0 +1,120 @@
+#! /bin/bash
+
+# Copyright (c) 1998 Martin Schulze <joey@debian.org>
+# Slightly modified by Luis Francisco Gonzalez <luisgh@debian.org>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+###########################################################################
+# Configurable section
+###########################################################################
+#
+# Any entry in the lists of programs that urlview handler will try out will
+# be made of /path/to/program + ':' + TAG where TAG is one of
+# XW: XWindows program
+# XT: Launch with an xterm if possible or as VT if not
+# VT: Launch in the same terminal
+
+# The lists of programs to be executed are
+https_prgs="/usr/X11R6/bin/netscape:XW /usr/bin/lynx:XT"
+http_prgs="/usr/bin/lynx:XT /usr/X11R6/bin/netscape:XW"
+mailto_prgs="/usr/bin/mutt:VT /usr/bin/elm:VT /usr/bin/pine:VT /usr/bin/mail:VT"
+gopher_prgs="/usr/bin/lynx:XT /usr/bin/gopher:XT"
+ftp_prgs="/usr/bin/lynx:XT /usr/bin/ncftp:XT"
+
+# Program used as an xterm (if it doesn't support -T you'll need to change
+# the command line in getprg)
+XTERM=/usr/X11R6/bin/xterm
+
+
+###########################################################################
+# Change bellow this at your own risk
+###########################################################################
+function getprg()
+{
+ local ele tag prog
+
+ for ele in $*
+ do
+ tag=${ele##*:}
+ prog=${ele%%:*}
+ if [ -x $prog ]; then
+ case $tag in
+ XW)
+ [ -n "$DISPLAY" ] && echo "X:$prog" && return 0
+ ;;
+ XT)
+ [ -n "$DISPLAY" ] && [ -x "$XTERM" ] && \
+ echo "X:$XTERM -e $prog" && return 0
+ echo "$prog" && return 0
+ ;;
+ VT)
+ echo "$prog" && return 0
+ ;;
+ esac
+ fi
+ done
+}
+
+url="$1"; shift
+
+type="${url%%:*}"
+
+if [ "$url" = "$type" ]; then
+ type="${url%%.*}"
+ case "$type" in
+ www|web)
+ type=http
+ ;;
+ esac
+ url="$type://$url"
+fi
+
+case $type in
+https)
+ prg=`getprg $https_prgs`
+ ;;
+http)
+ prg=`getprg $http_prgs`
+ ;;
+ftp)
+ prg=`getprg $ftp_prgs`
+ ;;
+mailto)
+ prg=`getprg $mailto_prgs`
+ url="${url#mailto:}"
+ ;;
+gopher)
+ prg=`getprg $gopher_prgs`
+ ;;
+*)
+ echo "Unknown URL type. Please report URL and viewer to:"
+ echo "joey@debian.org."
+ echo -n "Press enter to continue."; read x
+ exit
+ ;;
+esac
+
+if [ -n "$prg" ]; then
+ if [ "${prg%:*}" = "X" ]; then
+ ${prg#*:} "$url" 2>/dev/null &
+ else
+ $prg "$url"
+ fi
+fi
+
+
+
+