Agregar un par nuevos, y actualizar cambios minimos
This commit is contained in:
parent
429a4839f1
commit
339cb3de0b
2
ae
2
ae
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
cd ~/.local/bin || exit
|
||||
fd -c always -t f -d 1 | fzf +m --cycle --preview-window=right:90%:wrap --preview='bat --color=always {}' --height='45%' | xargs -r "$EDITOR"
|
||||
fd -c always -t f -d 1 --strip-cwd-prefix | fzf +m --cycle --preview-window=right:90%:wrap --preview='bat --color=always {}' --height='45%' | xargs -r "$EDITOR"
|
||||
|
|
138
lfview
138
lfview
|
@ -1,7 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -C -f -u
|
||||
IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}"
|
||||
IFS="$(printf '%b_' '\n')"
|
||||
IFS="${IFS%_}"
|
||||
|
||||
# ANSI color codes are supported.
|
||||
# STDIN is disabled, so interactive scripts won't work properly
|
||||
|
@ -16,91 +17,96 @@ IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}"
|
|||
# 2 | plain text | Display the plain content of the file
|
||||
|
||||
# Script arguments
|
||||
FILE_PATH="${1}" # Full path of the highlighted file
|
||||
FILE_PATH="${1}" # Full path of the highlighted file
|
||||
FILE_EXTENSION="${FILE_PATH##*.}"
|
||||
FILE_EXTENSION_LOWER=$(echo "${FILE_EXTENSION}" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# Settings
|
||||
HIGHLIGHT_SIZE_MAX=262143 # 256KiB
|
||||
HIGHLIGHT_SIZE_MAX=262143 # 256KiB
|
||||
HIGHLIGHT_TABWIDTH=8
|
||||
HIGHLIGHT_STYLE='pablo'
|
||||
|
||||
handle_extension() {
|
||||
case "${FILE_EXTENSION_LOWER}" in
|
||||
# Archive
|
||||
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
|
||||
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
|
||||
unzip -l -- "${FILE_PATH}"
|
||||
tar --list --file "${FILE_PATH}"
|
||||
exit 1;;
|
||||
rar)
|
||||
# Avoid password prompt by providing empty password
|
||||
unrar lt -p- -- "${FILE_PATH}"
|
||||
exit 1;;
|
||||
7z)
|
||||
# Avoid password prompt by providing empty password
|
||||
7z l -p -- "${FILE_PATH}"
|
||||
exit 1;;
|
||||
case "${FILE_EXTENSION_LOWER}" in
|
||||
# Archive
|
||||
a | ace | alz | arc | arj | bz | bz2 | cab | cpio | deb | gz | jar | lha | lz | lzh | lzma | lzo | \
|
||||
rpm | rz | t7z | tar | tbz | tbz2 | tgz | tlz | txz | tZ | tzo | war | xpi | xz | Z | zip)
|
||||
unzip -l -- "${FILE_PATH}"
|
||||
tar --list --file "${FILE_PATH}"
|
||||
exit 1
|
||||
;;
|
||||
rar)
|
||||
# Avoid password prompt by providing empty password
|
||||
unrar lt -p- -- "${FILE_PATH}"
|
||||
exit 1
|
||||
;;
|
||||
7z)
|
||||
# Avoid password prompt by providing empty password
|
||||
7z l -p -- "${FILE_PATH}"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
# PDF
|
||||
pdf)
|
||||
# Preview as text conversion
|
||||
pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" -
|
||||
exiftool "${FILE_PATH}"
|
||||
exit 1;;
|
||||
# PDF
|
||||
pdf)
|
||||
# Preview as text conversion
|
||||
pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" -
|
||||
exiftool "${FILE_PATH}"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
# BitTorrent
|
||||
torrent)
|
||||
transmission-show -- "${FILE_PATH}"
|
||||
exit 1;;
|
||||
# BitTorrent
|
||||
torrent)
|
||||
transmission-show -- "${FILE_PATH}"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
# HTML
|
||||
htm|html|xhtml)
|
||||
# Preview as text conversion
|
||||
lynx -dump -- "${FILE_PATH}"
|
||||
elinks -dump "${FILE_PATH}"
|
||||
;; # Continue with next handler on failure
|
||||
# HTML
|
||||
htm | html | xhtml)
|
||||
# Preview as text conversion
|
||||
lynx -dump -nonumbers -nolist -- "${FILE_PATH}"
|
||||
elinks -dump 1 -no-references -no-numbering <"${FILE_PATH}"
|
||||
;; # Continue with next handler on failure
|
||||
|
||||
# JSON
|
||||
json)
|
||||
jq --color-output . "${FILE_PATH}" && exit 5
|
||||
python -m json.tool -- "${FILE_PATH}" && exit 5
|
||||
;;
|
||||
|
||||
conf) bat "${FILE_PATH}" && exit 0 ;;
|
||||
esac
|
||||
# JSON
|
||||
json)
|
||||
jq --color-output . "${FILE_PATH}" && exit 5
|
||||
python -m json.tool -- "${FILE_PATH}" && exit 5
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
handle_mime() {
|
||||
local mimetype="${1}"
|
||||
case "${mimetype}" in
|
||||
text/html) lynx -dump "${FILE_PATH}" ;;
|
||||
text/troff) man ./ "${FILE_PATH}" | col -b ;;
|
||||
text/* | */xml)
|
||||
if [ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]; then
|
||||
exit 2
|
||||
fi
|
||||
if [ "$( tput colors )" -ge 256 ]; then
|
||||
local highlight_format='xterm256'
|
||||
else
|
||||
local highlight_format='ansi'
|
||||
fi
|
||||
highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \
|
||||
--style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}"
|
||||
exit 2;;
|
||||
application/zip) unzip -l -- "${FILE_PATH}" ;;
|
||||
image/*) mediainfo "${FILE_PATH}" || exit 1;;
|
||||
video/* | audio/*|application/octet-stream) mediainfo "${FILE_PATH}" || exit 1;;
|
||||
*/pdf) pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - ;;
|
||||
esac
|
||||
local mimetype="${1}"
|
||||
case "${mimetype}" in
|
||||
text/html) lynx -dump "${FILE_PATH}" ;;
|
||||
text/troff) man ./ "${FILE_PATH}" | col -b ;;
|
||||
text/* | */xml)
|
||||
if [ "$(stat --printf='%s' -- "${FILE_PATH}")" -gt "${HIGHLIGHT_SIZE_MAX}" ]; then
|
||||
exit 2
|
||||
fi
|
||||
# if [ "$(tput colors)" -ge 256 ]; then
|
||||
# local highlight_format='xterm256'
|
||||
# else
|
||||
# local highlight_format='ansi'
|
||||
# fi
|
||||
bat --color always --style plain --paging never --wrap character -- "${FILE_PATH}"
|
||||
# highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \
|
||||
# --style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}"
|
||||
exit 2
|
||||
;;
|
||||
application/zip) unzip -l -- "${FILE_PATH}" ;;
|
||||
image/*) exiftool "${FILE_PATH}" || exit 1 ;;
|
||||
video/* | audio/* | application/octet-stream) mediainfo "${FILE_PATH}" || exit 1 ;;
|
||||
*/pdf) pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - ;;
|
||||
esac
|
||||
}
|
||||
|
||||
handle_fallback() {
|
||||
echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}"
|
||||
exit 1
|
||||
echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )"
|
||||
MIMETYPE="$(file --dereference --brief --mime-type -- "${FILE_PATH}")"
|
||||
handle_extension
|
||||
handle_mime "${MIMETYPE}"
|
||||
handle_fallback
|
||||
|
|
10
linkhandler
10
linkhandler
|
@ -13,11 +13,13 @@ case "$1" in
|
|||
setsid -f mpv -quiet "$1" >/dev/null 2>&1
|
||||
;;
|
||||
*png | *jpg | *jpe | *jpeg | *gif)
|
||||
curl -sL "$1" >"/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -N "flota" -bpa "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 &
|
||||
# curl -sL "$1" >"/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && nsxiv -pa "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
|
||||
nsxiv-url "$1" &
|
||||
;;
|
||||
*pdf | *cbz | *cbr)
|
||||
curl -sL "$1" >"/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
|
||||
;;
|
||||
*)
|
||||
if [ -f "$1" ]; then
|
||||
"$TERMINAL" -e "$EDITOR" "$1"
|
||||
else setsid -f "$BROWSER" "$1" >/dev/null 2>&1; fi
|
||||
[ -f "$1" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$1" >/dev/null 2>&1 || setsid -f "$BROWSER" "$1" >/dev/null 2>&1
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
exec "/mnt/wd1tb/catacombs/code/lua-language-server/bin/lua-language-server" "$@"
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
|
||||
tmp="/tmp/nsxiv_rifle_$$"
|
||||
|
||||
listfiles() {
|
||||
find -L "///${1%/*}" -maxdepth 1 -type f -print |
|
||||
grep -iE '\.(jpe?g|png|gif|webp|tiff|bmp)$' |
|
||||
sort | tee "$tmp"
|
||||
}
|
||||
|
||||
is_img() {
|
||||
case "${1##*.}" in
|
||||
"jpg" | "jpeg" | "png" | "gif" | "webp" | "tiff" | "bmp") return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
open_img() {
|
||||
is_img "$1" || exit 1
|
||||
trap 'rm -f $tmp' EXIT
|
||||
count="$(listfiles "$1" | grep -nF "$1")"
|
||||
if [ -n "$count" ]; then
|
||||
nsxiv -aipn "${count%%:*}" -- <"$tmp"
|
||||
else
|
||||
nsxiv -apq -- "$@" # fallback
|
||||
fi
|
||||
}
|
||||
|
||||
[ "$1" = '--' ] && shift
|
||||
case "$1" in
|
||||
"")
|
||||
echo "Usage: ${0##*/} PICTURES" >&2
|
||||
exit 1
|
||||
;;
|
||||
/*) open_img "$1" ;;
|
||||
"~"/*) open_img "$HOME/${1#"~"/}" ;;
|
||||
*) open_img "$PWD/$1" ;;
|
||||
esac
|
28
pantallazo
28
pantallazo
|
@ -9,18 +9,18 @@ notify() {
|
|||
}
|
||||
|
||||
case "$(printf "Seleccion\\nVentana\\nPantalla\\nCopiar seleccion\\nCopiar ventana\\nCopiar pantalla" | rofi -dmenu -p "Captura de")" in
|
||||
"Seleccion") maim -us "$file" && notify ;;
|
||||
"Ventana") maim -ui "$(printf "%d\n" $vent)" "$file" && notify ;;
|
||||
"Pantalla")
|
||||
conectados=$(xrandr | awk '( $2 == "connected" ) { count++ } END { print count }')
|
||||
if [ "$conectados" = 1 ]; then
|
||||
maim -u "$file" && notify
|
||||
elif [ "$conectados" = 2 ]; then
|
||||
moni="$(xrandr | awk '( $2 == "connected" ) { print $1 }' | rofi -dmenu -p "Pantalla")"
|
||||
maim -u "$moni" "$file" && notify
|
||||
fi
|
||||
;;
|
||||
"Copiar seleccion") maim -us | xclip -selection clipboard -t image/png && notify ;;
|
||||
"Copiar ventana") maim -ui "$(printf "%d\n" "$vent")" | xclip -selection clipboard -t image/png && notify ;;
|
||||
"Copiar pantalla") maim -u | xclip -selection clipboard -t image/png && notify ;;
|
||||
"Seleccion") maim -us "$file" && notify ;;
|
||||
"Ventana") maim -ui "$(printf "%d\n" $vent)" "$file" && notify ;;
|
||||
"Pantalla")
|
||||
conectados=$(xrandr | awk '( $2 == "connected" ) { count++ } END { print count }')
|
||||
if [ "$conectados" = 1 ]; then
|
||||
maim -u "$file" && notify
|
||||
elif [ "$conectados" = 2 ]; then
|
||||
moni="$(xrandr | awk '( $2 == "connected" ) { print $1 }' | rofi -dmenu -p "Pantalla")"
|
||||
maim -u "$file" "$moni" && notify
|
||||
fi
|
||||
;;
|
||||
"Copiar seleccion") maim -us | xclip -selection clipboard -t image/png && notify ;;
|
||||
"Copiar ventana") maim -ui "$(printf "%d\n" "$vent")" | xclip -selection clipboard -t image/png && notify ;;
|
||||
"Copiar pantalla") maim -u | xclip -selection clipboard -t image/png && notify ;;
|
||||
esac
|
||||
|
|
6
ref
6
ref
|
@ -4,7 +4,7 @@ MAINDIR="$HOME/img/ref"
|
|||
|
||||
MENU="$(printf "Pixel Art\\nText Art\\nWeb" | rofi -dmenu -p "Referencias para")"
|
||||
case $MENU in
|
||||
'Pixel Art') sxiv-rifle "$MAINDIR/pixelart" >/dev/null 2>&1 ;;
|
||||
'Web') sxiv-rifle "$MAINDIR/web" >/dev/null 2>&1 ;;
|
||||
'Text Art') sxiv-rifle "$MAINDIR/textart" >/dev/null 2>&1;;
|
||||
'Pixel Art') nsxiv "$MAINDIR/pixelart" >/dev/null 2>&1 ;;
|
||||
'Web') nsxiv "$MAINDIR/web" >/dev/null 2>&1 ;;
|
||||
'Text Art') nsxiv "$MAINDIR/textart" >/dev/null 2>&1 ;;
|
||||
esac
|
||||
|
|
2
ytp
2
ytp
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
# Description: download all videos from a playlist in a separate directory.
|
||||
|
||||
youtube-dl -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' "$@"
|
||||
yt-dlp -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' "$@"
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
|
||||
archive="$(readlink -f "$*")" &&
|
||||
directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" &&
|
||||
mkdir -p "$directory" &&
|
||||
cd "$directory" || exit
|
||||
|
||||
[ "$archive" = "" ] && printf "Give archive to extract as argument.\\n" && exit
|
||||
|
||||
if [ -f "$archive" ]; then
|
||||
case "$archive" in
|
||||
*.tar.bz2 | *.tbz2) tar xvjf "$archive" ;;
|
||||
*.tar.xz | *.txz) tar -xvJf "$archive" ;;
|
||||
*.tar.gz | *.tgz) tar xvzf "$archive" ;;
|
||||
*.tar.zst) tar --zstd -xvf "$archive" ;;
|
||||
*.tar.lz) tar --lzip -xvf "$archive" ;;
|
||||
*.lzma) unlzma "$archive" ;;
|
||||
*.bz2) bunzip2 "$archive" ;;
|
||||
*.rar) unrar x -ad "$archive" ;;
|
||||
*.gz) gunzip "$archive" ;;
|
||||
*.tar) tar xvf "$archive" ;;
|
||||
*.zip | *.ZIP | *.cbz) unzip "$archive" ;;
|
||||
*.zstd) unzstd "$archive" ;;
|
||||
*.Z) uncompress "$archive" ;;
|
||||
*.7z) 7z x "$archive" ;;
|
||||
*.xz) unxz "$archive" ;;
|
||||
*.deb | *.ar) ar -x "$archive" ;;
|
||||
*.rpm) 7z x "$archive" ;;
|
||||
*.exe) cabextract "$archive" ;;
|
||||
*) printf "extract: '%s' - unknown archive method\\n" "$archive" ;;
|
||||
esac
|
||||
else
|
||||
printf "File \"%s\" not found.\\n" "$archive"
|
||||
fi
|
Loading…
Reference in New Issue