El git de texto plano no anda, no se que onda
This commit is contained in:
commit
2756b1b8d4
|
@ -0,0 +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"
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
|
||||
size=${2:-'10'}
|
||||
dir=$1
|
||||
|
||||
# Find current window mode
|
||||
is_tiled() {
|
||||
bspc query -T -n | grep -q '"state":"tiled"'
|
||||
}
|
||||
# If the window is floating, move it
|
||||
if ! is_tiled; then
|
||||
#only parse input if window is floating,tiled windows accept input as is
|
||||
case "$dir" in
|
||||
west) switch="-w"
|
||||
sign="-"
|
||||
;;
|
||||
east) switch="-w"
|
||||
sign="+"
|
||||
;;
|
||||
north) switch="-h"
|
||||
sign="-"
|
||||
;;
|
||||
south) switch="-h"
|
||||
sign="+"
|
||||
;;
|
||||
esac
|
||||
xdo resize ${switch} ${sign}"${size}"
|
||||
|
||||
# Otherwise, window is tiled: switch with window in given direction
|
||||
else
|
||||
case "$dir" in
|
||||
west) bspc node @west -r -"$size" || bspc node @east -r -"${size}"
|
||||
;;
|
||||
east) bspc node @west -r +"$size" || bspc node @east -r +"${size}"
|
||||
;;
|
||||
north) bspc node @south -r -"$size" || bspc node @north -r -"${size}"
|
||||
;;
|
||||
south) bspc node @south -r +"$size" || bspc node @north -r +"${size}"
|
||||
;;
|
||||
esac
|
||||
fi
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
doas mount -t nfs 192.168.0.100:/mnt/wd1/graveyard/ /mnt/vb/graveyard
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
youtube-dl --add-metadata -icx --no-cache-dir --no-call-home --audio-format mp3 --audio-quality 0 --prefer-ffmpeg --no-post-overwrites --geo-bypass -o "$HOME/mus/%(artist)s/%(album)s/%(artist)s - %(album)s - %(track_number)d %(track)s.%(ext)s" "$1"
|
||||
|
||||
echo "Buscando la tapa..."
|
||||
HTML_TEMP=$(mktemp)
|
||||
curl -s "$1" > "$HTML_TEMP"
|
||||
titulo=$(grep -Po "<title>.*</title>" "$HTML_TEMP" | sed 's/<[^>]*>//g')
|
||||
disco=${titulo% | *}
|
||||
grupo=${titulo#* | }
|
||||
sed -n '/image_/s/.*rel="image_src"\s\+href="\([^"]\+\).*/\1/p' "$HTML_TEMP" | xargs -r curl -s --create-dirs -o "$HOME/mus/${grupo}/${disco}/cover.jpg" && echo "Listo" || echo "No la encontre :("
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -z "$(pgrep -x polybar)" ]; then
|
||||
BAR="LaBarra"
|
||||
for m in $(polybar --list-monitors | cut -d":" -f1); do
|
||||
MONITOR=$m polybar --reload $BAR &
|
||||
sleep 1
|
||||
done
|
||||
else
|
||||
polybar-msg cmd restart
|
||||
fi
|
|
@ -0,0 +1,78 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# This is a modified version of the original bgedit-screen-tmux.sh script by
|
||||
# Kevin McCarthy. The license for the original script is below.
|
||||
#
|
||||
# Copyright (C) 2020 Kevin J. McCarthy <kevin@8t8.us>
|
||||
#
|
||||
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# Invoke a background edit session in a new GNU Screen or tmux window.
|
||||
#
|
||||
# This script is derived from Aaron Schrab's tmuxwait script, posted to
|
||||
# mutt-dev at
|
||||
# <http://lists.mutt.org/pipermail/mutt-dev/Week-of-Mon-20200406/000591.html>.
|
||||
#
|
||||
# If you run mutt inside screen or tmux, add to your muttrc:
|
||||
# set background_edit
|
||||
# set editor = '/path/to/bgedit-screen-tmux.sh [youreditor]'
|
||||
#
|
||||
# It may also be useful to modify something like contrib/bgedit-detectgui.sh
|
||||
# to look for the $STY or $TMUX environment variables and set those
|
||||
# configuration variables appropriately.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$#" -lt 2 ]; then
|
||||
echo "Usage: $0 EDITOR TEMPFILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
editor=$1
|
||||
shift
|
||||
|
||||
if [ -z "$STY" ] && [ -z "$TMUX" ]; then
|
||||
# Not in a terminal emulator, just launch editor as normal
|
||||
exec "$editor" "$@"
|
||||
fi
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
trap 'rm -rf "$tmpdir"' EXIT INT QUIT
|
||||
mkfifo "$tmpdir"/status
|
||||
|
||||
cat >"$tmpdir"/run <<END_SCRIPT
|
||||
#!/bin/sh
|
||||
|
||||
exitval=1
|
||||
trap 'echo \$exitval > "$tmpdir"/status' EXIT INT QUIT
|
||||
$editor "\$@"
|
||||
exitval=\$?
|
||||
END_SCRIPT
|
||||
|
||||
chmod +x "$tmpdir"/run
|
||||
|
||||
if [ -n "$STY" ]; then
|
||||
screen -X screen "$tmpdir"/run "$@"
|
||||
elif [ -n "$TMUX" ]; then
|
||||
tmux split-window "$tmpdir"/run "$@"
|
||||
else
|
||||
# How did we get here?
|
||||
echo "Not running in a terminal emulator" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -r exitval <"$tmpdir"/status
|
||||
exit "$exitval"
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
unread="$(find "$XDG_DATA_HOME"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f 2>/dev/null | wc -l)"
|
||||
echo -n "$unread"
|
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
pgrep -x mbsync > /dev/null && exit
|
||||
ping -q -c 1 1.1.1.1 > /dev/null || exit
|
||||
|
||||
DATA="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||
CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
|
||||
ICON="$HOME/img/.icn/App_Mail.svg"
|
||||
|
||||
syncandnotify() {
|
||||
acc="$(echo "$account" | sed "s/.*\///")"
|
||||
mbsync -c "$CONFIG"/isync/mbsyncrc "$acc"
|
||||
new=$(find "$DATA/mail/$acc/INBOX/new/" "$DATA/mail/$acc/Inbox/new/" "$DATA/mail/$acc/inbox/new/" -type f -newer "$CONFIG/neomutt/.mailsynclastrun" 2> /dev/null)
|
||||
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
|
||||
if [ "$newcount" -gt "0" ]; then
|
||||
for file in $new; do
|
||||
# Extract subject and sender from mail.
|
||||
from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//')
|
||||
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n-1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n')
|
||||
|
||||
if [ -n $DISPLAY ]; then
|
||||
notify-send --app-name="neomutt" -i "$ICON" "Mensaje nuevo para $acc" "$from: $subject" &
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$#" -eq "0" ]; then
|
||||
accounts="$(awk '/^Channel/ {print $2}' "$CONFIG/isync/mbsyncrc")"
|
||||
else
|
||||
for arg in "$@"; do
|
||||
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1
|
||||
done
|
||||
accounts=$*
|
||||
fi
|
||||
|
||||
for account in $accounts; do
|
||||
syncandnotify &
|
||||
done
|
||||
|
||||
wait
|
||||
notmuch new 2> /dev/null
|
||||
|
||||
touch "$CONFIG/neomutt/.mailsynclastrun"
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
for i in */; do zip -9 -r "${i%/}.cbz" "$i"; done
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
case $1 in
|
||||
on) simple-mtpfs --device 1 /mnt/cell/ ;;
|
||||
off) fusermount -u /mnt/cell/ ;;
|
||||
*) echo "Can't help you with that" ;;
|
||||
esac
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
ICON_OK="$XDG_DATA_HOME/icons/BeOS/scalable/mimetypes/gnome-mime-video.svg"
|
||||
ICON_I="$XDG_DATA_HOME/icons/BeOS/scalable/emblems/emblem-important.svg"
|
||||
|
||||
if [ -f "/tmp/blaze-pid" ]; then
|
||||
recpid="$(cat /tmp/blaze-pid)"
|
||||
# kill with SIGTERM, allowing finishing touches.
|
||||
kill -15 "$recpid"
|
||||
rm -f /tmp/blaze-pid
|
||||
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
|
||||
(
|
||||
sleep 3
|
||||
kill -9 "$recpid"
|
||||
) > /dev/null 2>&1 &
|
||||
notify-send -t 5000 -i "$ICON_OK" "Grabación Terminada"
|
||||
exit
|
||||
else
|
||||
notify-send -t 5000 -i "$ICON_I" "Grabación inactiva"
|
||||
exit 1
|
||||
fi
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
FOLDER="$HOME/.local/bin"
|
||||
FILE="$FOLDER/$1"
|
||||
|
||||
if [ -f "$FILE" ]; then
|
||||
printf "Ya existe. ENTER para editarlo o CTRL+C para cancelar"
|
||||
read -r
|
||||
$EDITOR "$FILE"
|
||||
else
|
||||
printf "#!/bin/sh\\n\\n" > "$FILE"
|
||||
chmod +x "$FILE"
|
||||
$EDITOR "$FILE"
|
||||
fi
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "╓───── m o u n t . p o i n t s"; echo "╙────────────────────────────────────── ─ ─"; lsblk -a; echo ""; echo "╓───── d i s k . u s a g e"; echo "╙────────────────────────────────────── ─ ─ "; dfc -ds;
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Sets the correct DPI for your monitor instead of the generic '100'
|
||||
# ! Make sure there is no DPI entry in your Xresources already!
|
||||
|
||||
FILE=$XDG_CONFIG_HOME/X11/xresources
|
||||
|
||||
grep 'Xft.dpi' "$FILE" && xrdb -merge "$FILE" && exit
|
||||
|
||||
INFO=/tmp/display_info
|
||||
xrandr | grep ' connected' > $INFO
|
||||
|
||||
WIDTH_MM=$(awk '{print $NF}' $INFO)
|
||||
WIDTH_IN=$(echo "${WIDTH_MM%mm}" | awk '{print $1 * 0.03937007874015748}')
|
||||
|
||||
HEIGHT_MM=$(awk '{print $(NF-2)}' $INFO)
|
||||
HEIGHT_IN=$(echo "${HEIGHT_MM%mm}" | awk '{print $1 * 0.03937007874015748}')
|
||||
|
||||
DIAGONAL_IN=$(awk -v w="$WIDTH_IN" -v h="$HEIGHT_IN" \
|
||||
'BEGIN{print sqrt(w^2 + h^2)}')
|
||||
|
||||
PX=$(cut -d ' ' -f 4 $INFO)
|
||||
|
||||
WIDTH_PX=${PX%x*}
|
||||
|
||||
TEMP_HEIGHT_PX=${PX#*x}
|
||||
HEIGHT_PX=${TEMP_HEIGHT_PX%%+*}
|
||||
|
||||
DIAGONAL_PX=$(awk -v w="$WIDTH_PX" -v h="$HEIGHT_PX" \
|
||||
'BEGIN{print sqrt(w^2 +h^2)}')
|
||||
|
||||
DPI=$(awk -v dp="$DIAGONAL_PX" -v di="$DIAGONAL_IN" \
|
||||
'BEGIN{print dp / di}')
|
||||
|
||||
echo "Xft.dpi: $DPI" >> "$FILE"
|
||||
xrdb -merge "$FILE"
|
||||
rm $INFO
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/sh
|
||||
|
||||
MAINDIR="$HOME/doc"
|
||||
ARTDIR="$MAINDIR/paginas/tilde"
|
||||
|
||||
diario() {
|
||||
cd "$MAINDIR/diario" || exit
|
||||
menuBlog=$(printf "Hoy\\nMañana\\nAyer\\nArchivo" | listar -p "Elegí")
|
||||
case $menuBlog in
|
||||
"Hoy") abrir "$(date -I)".md ;;
|
||||
"Mañana") abrir "$(date --date='tomorrow' +%F)".md ;;
|
||||
"Ayer") abrir "$(date --date='yesterday' +%F)".md ;;
|
||||
"Archivo") archivo ;;
|
||||
esac
|
||||
}
|
||||
|
||||
notas() {
|
||||
cd "$MAINDIR/notas" || exit
|
||||
menuNota=$(printf "Nueva\\nArchivo" | listar -p "Elegí")
|
||||
case $menuNota in
|
||||
"Nueva")
|
||||
nombre="$(listar -theme dprompt -p "Título: ")" 2>/dev/null
|
||||
[ -z "$nombre" ] && exit 0
|
||||
abrir "$nombre".md
|
||||
;;
|
||||
"Archivo") archivo ;;
|
||||
esac
|
||||
}
|
||||
|
||||
articulo() {
|
||||
menuArticulo=$(printf "Fuckup\\nMuert.o\\nDotfiles\\nTextArt" | listar -p "En donde?")
|
||||
case $menuArticulo in
|
||||
"Fuckup") cd "$ARTDIR/fuckup/blog" || exit ;;
|
||||
"Dotfiles") cd "$ARTDIR/club/the-dot-files" || exit ;;
|
||||
"TextArt") cd "$ARTDIR/town/textarrrgh" || exit ;;
|
||||
"Muert.o") cd "$ARTDIR/texto-plano/muert.o" || exit ;;
|
||||
esac
|
||||
[ -z "$menuArticulo" ] && exit 0
|
||||
nombre="$(listar -theme dprompt -p "Titulo: ")" 2>/dev/null
|
||||
[ -z "$nombre" ] && exit 0
|
||||
nombreForm="$(echo "$nombre" | tr ' ' '-')"
|
||||
if [ "$PWD" = "$ARTDIR/texto-plano/muert.o" ]; then
|
||||
hugo new articulos/"$nombreForm".md
|
||||
sleep 1
|
||||
abrir "$PWD/content/articulos/$nombreForm.md"
|
||||
else
|
||||
hugo new posts/"$nombreForm".md
|
||||
sleep 1
|
||||
abrir "$PWD/content/posts/$nombreForm.md"
|
||||
fi
|
||||
}
|
||||
|
||||
abrir() { ${TERMINAL:-alacritty} --class=flota -e "$EDITOR" "$@"; }
|
||||
|
||||
listar() { rofi -dmenu "$@"; }
|
||||
|
||||
archivo() {
|
||||
selarch=$(fd -d 1 -e md | sort -Mr | listar -p "Archivo")
|
||||
[ -z "$selarch" ] && exit 0
|
||||
abrir "$selarch"
|
||||
}
|
||||
|
||||
MENU="$(printf "Artículo\\nPersonal\\nNotas" | listar -p "Escribir")"
|
||||
case $MENU in
|
||||
'Personal') diario ;;
|
||||
'Artículo') articulo ;;
|
||||
'Notas') notas ;;
|
||||
esac
|
|
@ -0,0 +1,91 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Blaze - record screen and audio
|
||||
# https://github.com/cherrry9/blaze/
|
||||
# modificado por deadguy
|
||||
|
||||
ICON_NO="$XDG_DATA_HOME/icons/BeOS/scalable/actions/process-stop.svg"
|
||||
ICON_RECORD="$XDG_DATA_HOME/icons/BeOS/scalable/devices/gnome-dev-camera.svg"
|
||||
|
||||
output="$HOME/vid/Screen/$(date '+%F_%H_%M').mp4"
|
||||
fps=60
|
||||
m() { rofi -dmenu -i -no-custom "$@"; }
|
||||
|
||||
method="$(printf "Pantalla\nSelección" | m -p "Que vas a grabar?")"
|
||||
|
||||
if [ "$method" = "Pantalla" ]; then
|
||||
# get information about the display
|
||||
monitors="$(xrandr --listmonitors | awk 'NR>1 { printf $NF"\n" }')"
|
||||
|
||||
# if there's only one display, use that and skip asking
|
||||
if [ "$(printf "%b\n" "$monitors" | wc -l)" = 1 ]; then
|
||||
display="$monitors"
|
||||
else # if there are other displays ask the user which one to use
|
||||
[ ! "$display" ] && display="$(printf "%b" "$monitors" | m -p "Pantalla")"
|
||||
fi
|
||||
|
||||
set -- $(xrandr -q | grep "$display" | grep -oP '\d*x\d*\+\d*\+\d*' | tr '+x' ' ')
|
||||
|
||||
width="$1"
|
||||
height="$2"
|
||||
offX="$3"
|
||||
offY="$4"
|
||||
|
||||
sonido="$(printf "Sí\nNo" | m -p "Audio")"
|
||||
|
||||
if [ "$sonido" = "Sí" ]; then
|
||||
# find default audio device
|
||||
pacmd="$(pacmd list-sources | grep -i -B 1 output)"
|
||||
dev="$(echo "$pacmd" | grep -i '\* index' ||
|
||||
echo "$pacmd" | grep -i 'index' | head -n 1)"
|
||||
audio="-f pulse -i $(echo "$dev" | grep -o '[0-9]')"
|
||||
else
|
||||
audio=""
|
||||
fi
|
||||
|
||||
elif [ "$method" = "Selección" ]; then
|
||||
gif="$(printf "Sí\nNo" | m -p "Gif")"
|
||||
|
||||
if [ "$gif" = "Sí" ]; then
|
||||
output="$HOME/vid/Screen/$(date '+%F_%H_%M').gif"
|
||||
fps=15
|
||||
fi
|
||||
|
||||
# select an area and make each number a separate word
|
||||
set -- $(slop -f '%w %h %x %y')
|
||||
|
||||
# get information about the display
|
||||
width="$1"
|
||||
height="$2"
|
||||
offX="$3"
|
||||
offY="$4"
|
||||
|
||||
[ "$((width % 2))" = 1 ] && width="$((width + 1))"
|
||||
[ "$((height % 2))" = 1 ] && height="$((height + 1))"
|
||||
else
|
||||
notify-send -t 3000 -u critical -i "$ICON_NO" "Método inválido"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ask the user if they want to start the recording
|
||||
[ ! "$ready" ] && ready="$(printf "Sí\nNo" | m -p "Empezar")"
|
||||
|
||||
[ "$ready" = "Sí" ] && {
|
||||
notify-send -t 2000 -i "$ICON_RECORD" "Grabando"
|
||||
|
||||
ffmpeg \
|
||||
-loglevel error \
|
||||
-y \
|
||||
-thread_queue_size 4096 \
|
||||
$audio \
|
||||
-f x11grab \
|
||||
-draw_mouse 1 \
|
||||
-s "${width}x$height" \
|
||||
-r "$fps" \
|
||||
-i "$DISPLAY.0+$offX,$offY" \
|
||||
-pix_fmt yuv420p \
|
||||
-q:v 0 \
|
||||
"$output" &
|
||||
|
||||
echo $! > /tmp/blaze-pid
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
h() { git --git-dir="$HOME/.local/numbers/" --work-tree="$HOME" "$@"; }
|
||||
|
||||
case $1 in
|
||||
*) h "$@" ;;
|
||||
esac
|
|
@ -0,0 +1,181 @@
|
|||
#!/bin/bash
|
||||
|
||||
# original file at https://gitlab.com/protesilaos/cpdfd/-/blob/master/bin/bin/melonpanel
|
||||
|
||||
# Kill any running lemonbar
|
||||
pgrep -x lemonbar > /dev/null && pkill -x lemonbar
|
||||
|
||||
get_xrdb() {
|
||||
xrdb -query | awk -v pat="$1" '$0~pat {print $2}'
|
||||
}
|
||||
|
||||
background="$(get_xrdb background)"
|
||||
foreground="$(get_xrdb color7)"
|
||||
foregroundalt="$(get_xrdb color8)"
|
||||
color1="$(get_xrdb color11)"
|
||||
color2="$(get_xrdb color3)"
|
||||
color3="$(get_xrdb color9)"
|
||||
colormail="$(get_xrdb color13)"
|
||||
colorwifi="$(get_xrdb color12)"
|
||||
colorfecha="$(get_xrdb color10)"
|
||||
colorhora="$(get_xrdb color14)"
|
||||
|
||||
panel_height=22
|
||||
|
||||
fontmain='System Charcoal:style=regular:size=11'
|
||||
fontbold='System Charcoal:style=bold:size=11'
|
||||
fonticon='JetBrainsMono Nerd Font:style=regular:size=11'
|
||||
|
||||
# Panel modules
|
||||
# -------------
|
||||
#
|
||||
# NOTE all functions that are meant to pipe their output to the panel
|
||||
# will echo a majuscule (letter A-Z). This is done to easily retrieve
|
||||
# their output from the named pipe. The letter has to be unique and,
|
||||
# ideally, use common words that denote the function of the content of
|
||||
# the command such as e.g. D for Date, N for Network... Where this
|
||||
# would lead to conflicts, find a synonym or something close enough.
|
||||
#
|
||||
# The various sequences %{..} are part of lemonbar's syntax for styling
|
||||
# the output. See `man lemonbar`.
|
||||
|
||||
_mail() {
|
||||
mail_label=''
|
||||
unread="$(find "$XDG_DATA_HOME"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
|
||||
if [ "$unread" -gt 0 ]; then
|
||||
echo -n "%{F$colormail}$mail_label $unread%{F-} "
|
||||
fi
|
||||
}
|
||||
|
||||
_wifi() {
|
||||
wifi_label=''
|
||||
if [ "$(cat /sys/class/net/w*/operstate)" = up ]; then
|
||||
net="$(awk '/^\s*w/ { print int($3 * 100 / 70) }' /proc/net/wireless)"
|
||||
echo -n "%{F$colorwifi}$wifi_label $net%{F-} "
|
||||
fi
|
||||
}
|
||||
|
||||
_datetime() {
|
||||
fecha=$(date "+%a %d %R")
|
||||
echo -n "%{F$colorfecha}$fecha%{F-} "
|
||||
}
|
||||
|
||||
# Include all modules in a single infinite loop
|
||||
_modules() {
|
||||
while true; do
|
||||
echo "M" "$(_mail)"
|
||||
echo "N" "$(_wifi)"
|
||||
echo "D" "$(_datetime)"
|
||||
sleep 15s
|
||||
done
|
||||
}
|
||||
|
||||
# Piping and reading the output of the modules
|
||||
# --------------------------------------------
|
||||
|
||||
# set path to named pipe used to store process data for these operations
|
||||
panel_fifo='/tmp/panel.fifo'
|
||||
|
||||
# make sure you delete any existing named pipe
|
||||
[ -e "$panel_fifo" ] && rm "$panel_fifo"
|
||||
|
||||
# create a new named pipe
|
||||
mkfifo "$panel_fifo"
|
||||
|
||||
# pipe the output of the modules to the fifo
|
||||
_modules > "$panel_fifo" &
|
||||
bspc subscribe report > "$panel_fifo" &
|
||||
|
||||
# Read the content of the fifo file. We differentiate between modules
|
||||
# based on the majuscule (letter A-Z) they piped into melonpanel_fifo
|
||||
# (see modules above). Here we just add a shorter variable to each
|
||||
# module, which helps position it on the panel (the last printf).
|
||||
_panel() {
|
||||
|
||||
while read -r line ; do
|
||||
case $line in
|
||||
M*) mail="${line#?}" ;;
|
||||
N*) wifi="${line#?}" ;;
|
||||
D*) datetime="${line#?}" ;;
|
||||
W*)
|
||||
# bspwm's state
|
||||
wm=
|
||||
IFS=':'
|
||||
set -- ${line#?}
|
||||
while [ "$#" -gt 0 ] ; do
|
||||
item="$1"
|
||||
name="${item#?}"
|
||||
case "$item" in
|
||||
[mMfFoOuU]*)
|
||||
case "$item" in
|
||||
m*)
|
||||
# monitor
|
||||
FG="$foregroundalt" # needed to avoid invalid colour error
|
||||
on_focused_monitor=
|
||||
name=
|
||||
;;
|
||||
M*)
|
||||
# focused monitor
|
||||
FG="$foregroundalt" # needed to avoid invalid colour error
|
||||
on_focused_monitor=1
|
||||
name=
|
||||
;;
|
||||
# {Free,Occupied,Urgent} focused
|
||||
[FOU]*)
|
||||
if [ -n "$on_focused_monitor" ]; then
|
||||
FG="$color1"
|
||||
name="%{T2}${name/*/[$name]}%{T-}" # the %{Tx} specifies the bold font
|
||||
else
|
||||
FG="$color2"
|
||||
name="${name/*/ $name^}"
|
||||
fi
|
||||
;;
|
||||
# {free,occupied,urgent} unfocused
|
||||
f*)
|
||||
FG="$foreground"
|
||||
name="${name/*/ $name }"
|
||||
;;
|
||||
o*)
|
||||
FG="$color2"
|
||||
name="${name/*/ $name^}"
|
||||
;;
|
||||
u*)
|
||||
FG="$color3"
|
||||
name="${name/*/ $name!}"
|
||||
;;
|
||||
esac
|
||||
wm="${wm}%{F$FG}${name}%{F-} "
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
esac
|
||||
|
||||
_panel_layout() {
|
||||
echo "%{r} $mail $wifi $datetime $wm"
|
||||
}
|
||||
echo "%{Sf}$(_panel_layout) %{Sl}$(_panel_layout)"
|
||||
done
|
||||
}
|
||||
|
||||
# Launch the panel with the given parameters
|
||||
# ------------------------------------------
|
||||
|
||||
# NOTE the syntax for the background value. If you want transparency,
|
||||
# just replace "ff" with a lower value: "00" means no opacity. This is
|
||||
# hexadecimal notation: 0-9, a-f, A-F.
|
||||
_panel < "$panel_fifo" | lemonbar -u 2 -p -g "x${panel_height}" \
|
||||
-F "$foreground" -B "#CC${background:1}" -f "$fontmain" -f "$fontbold" -f "$fonticon" -n "LaBarra" &
|
||||
|
||||
# Hide panel when windows are in full screen mode. This does not work
|
||||
# all the time, especially with lower `sleep` values, requiring a
|
||||
# re-launch of melonpanel (pkill -x melonpanel && melonpanel). I have
|
||||
# yet to find a robust solution.
|
||||
#
|
||||
# Source of this snippet (with minor adapatations by me):
|
||||
# https://github.com/baskerville/bspwm/issues/484
|
||||
until bar_id=$(xdo id -a 'LaBarra'); do
|
||||
sleep 1s
|
||||
done
|
||||
|
||||
xdo below -t $(xdo id -n root) $bar_id &
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
LIBROS="$HOME/doc/libros"
|
||||
COMICS="$HOME/img/comics"
|
||||
|
||||
libro() {
|
||||
cd "$LIBROS" || exit
|
||||
menulibro=$(fd -e pdf -e epub | rofi -dmenu -i -p "Cual?")
|
||||
[ -z "$menulibro" ] && exit 0
|
||||
zathura "$menulibro"
|
||||
}
|
||||
|
||||
comic() {
|
||||
cd "$COMICS" || exit
|
||||
menucomic=$(fd -d 1 | rofi -dmenu -i -p "Cual?")
|
||||
[ -f "$menucomic" ] && zathura "$menucomic"
|
||||
cd "$menucomic" || exit
|
||||
menucapitulo=$(fd -e cbr -e cbz | sort -h | rofi -dmenu -i -p "Cual?")
|
||||
[ -z "$menucapitulo" ] && exit 0
|
||||
zathura "$menucapitulo"
|
||||
}
|
||||
|
||||
MENU="$(printf "Libros\\nComics" | rofi -dmenu "$@" -p "Que vas a leer?")"
|
||||
case $MENU in
|
||||
'Libros') libro ;;
|
||||
'Comics') comic ;;
|
||||
esac
|
|
@ -0,0 +1,108 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -C -f -u
|
||||
IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}"
|
||||
|
||||
# ANSI color codes are supported.
|
||||
# STDIN is disabled, so interactive scripts won't work properly
|
||||
|
||||
# This script is considered a configuration file and must be updated manually.
|
||||
|
||||
# Meanings of exit codes:
|
||||
# code | meaning | action of ranger
|
||||
# -----+------------+-------------------------------------------
|
||||
# 0 | success | Display stdout as preview
|
||||
# 1 | no preview | Display no preview at all
|
||||
# 2 | plain text | Display the plain content of the file
|
||||
|
||||
# Script arguments
|
||||
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_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;;
|
||||
|
||||
# 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;;
|
||||
|
||||
# HTML
|
||||
htm|html|xhtml)
|
||||
# Preview as text conversion
|
||||
lynx -dump -- "${FILE_PATH}"
|
||||
elinks -dump "${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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
handle_fallback() {
|
||||
echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )"
|
||||
handle_extension
|
||||
handle_mime "${MIMETYPE}"
|
||||
handle_fallback
|
||||
|
||||
exit 1
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
# used for newsboat
|
||||
|
||||
# If no url given. Opens browser. For using script as $BROWSER.
|
||||
[ -z "$1" ] && { "$BROWSER"; exit; }
|
||||
|
||||
case "$1" in
|
||||
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*)
|
||||
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 &
|
||||
;;
|
||||
*)
|
||||
if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR" "$1"
|
||||
else setsid -f "$BROWSER" "$1" >/dev/null 2>&1; fi ;;
|
||||
esac
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
file="/tmp/.minimized"
|
||||
touch "$file"
|
||||
lines=$(awk 'END{print NR}' "$file")
|
||||
icon="$HOME/img/.icn/Deskbar_Window_Visible.svg"
|
||||
|
||||
case $1 in
|
||||
hide)
|
||||
if [ "$lines" -ge 15 ]; then
|
||||
notify-send -i "$icon" "15 ventanas minimizadas" "Mejor cerrar algunas antes de esconder todavía más"
|
||||
else
|
||||
focusedNode=$(bspc query -N -n .focused)
|
||||
focusedID=$(bspc query -D -d --names)
|
||||
focusedName=$(xprop -id "$focusedNode" WM_NAME | cut -d\" -f2)
|
||||
|
||||
echo "$focusedNode $focusedID $focusedName" >> "$file"
|
||||
xdo hide "$focusedNode"
|
||||
notiflines="$((lines + 1))"
|
||||
[ "$notiflines" -gt 1 ] && notiftext="ventanas escondidas" || notiftext="ventana escondida"
|
||||
notify-send -i "$icon" "${notiflines} $notiftext." "$focusedName"
|
||||
fi
|
||||
;;
|
||||
show)
|
||||
[ -z "$file" ] && exit
|
||||
[ "$lines" -eq 1 ] && sel=$(awk '{print $2,$3}' "$file") || sel=$(awk '{print $2,$3}' "$file" | rofi -dmenu -p 'Ventanas Minimizadas')
|
||||
selectedID=$(awk -v pat="$sel" '$0~pat {print $1}' "$file")
|
||||
selectedDesktop=$(awk -v pat="$sel" '$0~pat {print $2}' "$file")
|
||||
bspc desktop -f "$selectedDesktop"
|
||||
xdo show "$selectedID"
|
||||
sed -i "/${sel}/d" "$file"
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,83 @@
|
|||
#!/bin/sh
|
||||
# Originally by https://github.com/windelicato/
|
||||
|
||||
size=${2:-'20'}
|
||||
dir=$1
|
||||
|
||||
transplanter() {
|
||||
bspc node "${dir}" -p south && bspc node -n "${dir}"
|
||||
}
|
||||
|
||||
northplanter() {
|
||||
bspc node north -p north && bspc node -n north
|
||||
}
|
||||
|
||||
rootplanter() {
|
||||
bspc node @/ -p "${dir}" && bspc node -n @/ || bspc node -s next.local && bspc node -n @/
|
||||
bspc node @/ -p cancel
|
||||
}
|
||||
|
||||
bspc config pointer_follows_focus true
|
||||
# Find current window mode
|
||||
is_floating() {
|
||||
bspc query -T -n | grep -q '"state":"floating"'
|
||||
}
|
||||
# If the window is floating, move it
|
||||
if is_floating; then
|
||||
#only parse input if window is floating,tiled windows accept input as is
|
||||
case "$dir" in
|
||||
west) switch="-x"
|
||||
sign="-"
|
||||
;;
|
||||
east) switch="-x"
|
||||
sign="+"
|
||||
;;
|
||||
north) switch="-y"
|
||||
sign="-"
|
||||
;;
|
||||
*) switch="-y"
|
||||
sign="+"
|
||||
;;
|
||||
esac
|
||||
xdo move "${switch}" "${sign}${size}"
|
||||
|
||||
# Otherwise, window is tiled: switch with window in given direction
|
||||
else
|
||||
if [ "$(bspc query -N -n .local.\!floating | wc -l)" != 2 ]; then
|
||||
case "$dir" in
|
||||
north) northplanter || rootplanter;;
|
||||
*) transplanter || rootplanter;;
|
||||
esac
|
||||
else
|
||||
case "$dir" in
|
||||
east) bspc node -s east || bspc query -N -n west.local || \
|
||||
if bspc query -N -n south.local ; then
|
||||
bspc node @/ -R 90
|
||||
else
|
||||
bspc node @/ -R 270
|
||||
fi
|
||||
;;
|
||||
west) bspc node -s west || bspc query -N -n east.local || \
|
||||
if bspc query -N -n north.local ; then
|
||||
bspc node @/ -R 90
|
||||
else
|
||||
bspc node @/ -R 270
|
||||
fi
|
||||
;;
|
||||
south) bspc node -s south || bspc query -N -n north.local || \
|
||||
if bspc query -N -n west.local ; then
|
||||
bspc node @/ -R 90
|
||||
else
|
||||
bspc node @/ -R 270
|
||||
fi
|
||||
;;
|
||||
*) bspc node -s north || bspc query -N -n south.local || \
|
||||
if bspc query -N -n west.local ; then
|
||||
bspc node @/ -R 270
|
||||
else
|
||||
bspc node @/ -R 90
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
notify-send -i "$HOME/img/.icn/App_Chat.svg" "$@"
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
file="$HOME/img/scrot/$(date +%F_%H_%M).png"
|
||||
vent=$(bspc query -N -n .focused)
|
||||
icon="$XDG_DATA_HOME/icons/BeOS/scalable/apps/applets-screenshooter.svg"
|
||||
|
||||
notify() {
|
||||
notify-send -i "$icon" "Pantalla Capturada"
|
||||
}
|
||||
|
||||
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 ;;
|
||||
esac
|
|
@ -0,0 +1,126 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# pb; a command line pastebin service helper
|
||||
# {kopimi,CC0} MMXVIII . syntax samurai
|
||||
# ▟▙
|
||||
# ▟▒░░░░░░░▜▙▜████████████████████████████████▛
|
||||
# ▜▒░░░░░░░▟▛▟▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▛
|
||||
# ▜▛
|
||||
# authors:
|
||||
# xero <https://xero.nu>
|
||||
# stark <https://git.io/stark>
|
||||
# code:
|
||||
# https://code.xero.nu/pb
|
||||
# https://git.io/pb.sh
|
||||
# greets:
|
||||
# all the ops of these great free services <3
|
||||
#
|
||||
usage () {
|
||||
cat <<EOF
|
||||
|
||||
█
|
||||
▄▀▀▄ █▐▀▄
|
||||
░ ░ ░█▐░█░█▐░█░ ░ ░
|
||||
█▐▄▀ ▀▄▄▀
|
||||
█
|
||||
|
||||
pb; a command line pastebin service helper
|
||||
|
||||
usage:
|
||||
pb <service> [file|stream]
|
||||
|
||||
services:
|
||||
0x0.st, ttm.sh, catbox.moe, clbin.com, dmca.gripe,
|
||||
dumpz.org, fiery.me, ix.io, p.iotek.org,
|
||||
pastebin.com, sprunge.us, uguu.se, w1r3.net
|
||||
|
||||
environment variables:
|
||||
UA: user-agent string (defaults to some chrome one)
|
||||
|
||||
envs for pastebin.com:
|
||||
PB_API_DEV: developer api key [required] https://pastebin.com/api#1
|
||||
PB_API_USR: user api key [optional] https://pastebin.com/api#8
|
||||
PRIVACY: paste visibility [optional] valid values: public|0, unlisted|1, private|2
|
||||
ANON: paste w/o a user key even if defined [optional]
|
||||
|
||||
examples:
|
||||
pb ix ~/.vimrc
|
||||
pb 0x0 <(ps aux)
|
||||
dmesg | pb iop
|
||||
PB_API_DEV=XXXX PRIVACY=0 pb pb /tmp/leak.txt
|
||||
UA="Mozilla/5.0 (PlayStation 4 5.55) AppleWebKit/601.2 (KHTML, like Gecko)" pb uguu /tmp/x
|
||||
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
ARG="${2:-/dev/stdin}"
|
||||
UA=${UA:="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"}
|
||||
case $1 in
|
||||
ix|ix.io)
|
||||
curl -A "$UA" -sF 'f:1=<-' http://ix.io < $ARG
|
||||
;;
|
||||
0x0|null|nullbyte|0*)
|
||||
curl -A "$UA" -sF 'file=@-' https://0x0.st < $ARG
|
||||
;;
|
||||
ttm)
|
||||
curl -A "$UA" -sF 'file=@-' https://ttm.sh < $ARG
|
||||
;;
|
||||
sprunge|sprunge.us|s*)
|
||||
curl -A "$UA" -sF 'sprunge=<-' http://sprunge.us < $ARG
|
||||
;;
|
||||
iotek|iopaste|p.iotek.org|iop*)
|
||||
curl -A "$UA" -sT- https://p.iotek.org < $ARG
|
||||
;;
|
||||
clbin|clbin.com|cl*)
|
||||
curl -A "$UA" -sF 'clbin=<-' https://clbin.com < $ARG
|
||||
;;
|
||||
uguu|uguu.se|u*)
|
||||
curl -A "$UA" -sF 'file=@-' https://uguu.se/api.php?d=upload-tool < $ARG
|
||||
;;
|
||||
lewd|lewd.se|l*)
|
||||
curl -A "$UA" -sF 'file=@-' https://lewd.se/api.php?d=upload-tool < $ARG
|
||||
;;
|
||||
fiery|fiery.me|f*)
|
||||
curl -A "$UA" -sF 'files[]=@-' https://safe.fiery.me/api/upload < $ARG | grep -Po '"url":"[A-Za-z0-9]+.*?"' | sed 's/"url":"//;s/"//'
|
||||
;;
|
||||
catbox|catbox.moe|cat*)
|
||||
curl -A "$UA" -sF 'reqtype=fileupload' -F 'fileToUpload=@-' https://catbox.moe/user/api.php < $ARG
|
||||
;;
|
||||
dmca|dmca.gripe|gripe|dm*)
|
||||
curl -A "$UA" -sF 'files[]=@-' http://dmca.gripe/api/upload < $ARG | grep -Po '"url":"[A-Za-z0-9]+.*?"' | sed 's/"url":"//;s/"//;s/[\]//g'
|
||||
;;
|
||||
dumpz|dumpz.org|du*)
|
||||
curl -A "$UA" -s --data-binary @- https://dumpz.org < $ARG | sed 's/http/&s/;s!$!/text/!'
|
||||
;;
|
||||
w1r3|wire|w1r3.net|w*)
|
||||
curl -sF 'upload=@-' https://w1r3.net < $ARG
|
||||
;;
|
||||
pb|pastebin|pastebin.com)
|
||||
[ -z ${PB_API_DEV} ] && usage
|
||||
PRIVACY="${PRIVACY:-1}"
|
||||
if [ -n "${PRIVACY}" ]; then
|
||||
case ${PRIVACY} in
|
||||
public|0)
|
||||
PRIVACY=0
|
||||
;;
|
||||
unlisted|1)
|
||||
PRIVACY=1
|
||||
;;
|
||||
private|2)
|
||||
PRIVACY=2
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
qs="api_option=paste&api_dev_key=${PB_API_DEV}&api_paste_expire_date=N&api_paste_private=${PRIVACY}&api_paste_name=`basename ${ARG}`"
|
||||
[ -n ${PB_API_USR} ] && [ -z ${ANON} ] && qs="${qs}&api_user_key=${PB_API_USR}"
|
||||
curl -A "$UA" -d "${qs}" --data-urlencode "api_paste_code=`<$ARG`" http://pastebin.com/api/api_post.php
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
# vi:syntax=sh
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
cd "$HOME/prg/petscii" || exit
|
||||
./petscii
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
MAINDIR="$HOME/doc/paginas/tilde"
|
||||
|
||||
subir() {
|
||||
if [ "$PWD" = "$MAINDIR/texto-plano/muert.o" ] || [ "$PWD" = "$MAINDIR/town/textarrrgh" ]; then
|
||||
hugo
|
||||
fi
|
||||
git add . && git commit -m "nuevo post"
|
||||
}
|
||||
|
||||
listar() { rofi -dmenu "$@"; }
|
||||
|
||||
MENU="$(printf "Fuckup\\nMuerto\\nDotfiles\\nTextArt" | listar -p "Postear en")"
|
||||
case $MENU in
|
||||
'Fuckup') cd "$MAINDIR/fuckup/blog" && subir || exit ;;
|
||||
'Muerto') cd "$MAINDIR/texto-plano/muert.o" && subir || exit ;;
|
||||
'Dotfiles') cd "$MAINDIR/club/the-dot-files" && subir || exit ;;
|
||||
'TextArt') cd "$MAINDIR/town/textarrrgh" && subir || exit ;;
|
||||
esac
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
chosen="$(printf "Apagar\\nReiniciar\\nSalir" | rofi -dmenu -p " ")"
|
||||
case $chosen in
|
||||
"Apagar") doas shutdown -h now ;;
|
||||
"Reiniciar") doas shutdown -r now ;;
|
||||
"Salir") pkill xinit ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
qodem --config ~/.config/qodem/qodemrc --dotqodem-dir ~/.config/qodem/
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
bgloc="/tmp/bg"
|
||||
dir="$HOME/img/wallpaper"
|
||||
|
||||
[ -f "$dir" ] && ln -sf "$(readlink -f "$dir")" "$bgloc"
|
||||
[ -d "$dir" ] && ln -sf "$(find "$(readlink -f "$dir")" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc"
|
||||
|
||||
feh --bg-tile "$bgloc" >/dev/null 2>&1
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
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;;
|
||||
esac
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# 1. Search for text in files using Ripgrep
|
||||
# 2. Interactively restart Ripgrep with reload action
|
||||
# 3. Open the file in Vim
|
||||
RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "
|
||||
INITIAL_QUERY="${*:-}"
|
||||
IFS=: read -ra selected < <(
|
||||
FZF_DEFAULT_COMMAND="$RG_PREFIX $(printf %q "$INITIAL_QUERY")" \
|
||||
fzf --ansi \
|
||||
--disabled --query "$INITIAL_QUERY" \
|
||||
--bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \
|
||||
--delimiter : \
|
||||
--preview 'bat --color=always {1} --highlight-line {2}' \
|
||||
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3'
|
||||
)
|
||||
[ -n "${selected[0]}" ] && vim "${selected[0]}" "+${selected[1]}"
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/sh
|
||||
# Compatible with ranger 1.6.*
|
||||
#
|
||||
# This script searches image files in a directory, opens them all with sxiv and
|
||||
# sets the first argument to the first image displayed by sxiv.
|
||||
#
|
||||
# This is supposed to be used in rifle.conf as a workaround for the fact that
|
||||
# sxiv takes no file name arguments for the first image, just the number. Copy
|
||||
# this file somewhere into your $PATH and add this at the top of rifle.conf:
|
||||
#
|
||||
# mime ^image, has sxiv, X, flag f = path/to/this/script -- "$@"
|
||||
#
|
||||
# Implementation notes: this script is quite slow because of POSIX limitations
|
||||
# and portability concerns. First calling the shell function 'abspath' is
|
||||
# quicker than calling 'realpath' because it would fork a whole process, which
|
||||
# is slow. Second, we need to append a file list to sxiv, which can only be done
|
||||
# properly in two ways: arrays (which are not POSIX) or \0 sperated
|
||||
# strings. Unfortunately, assigning \0 to a variable is not POSIX either (will
|
||||
# not work in dash and others), so we cannot store the result of listfiles to a
|
||||
# variable.
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: ${0##*/} PICTURES"
|
||||
exit
|
||||
fi
|
||||
|
||||
[ "$1" = '--' ] && shift
|
||||
|
||||
abspath () {
|
||||
case "$1" in
|
||||
/*) printf "%s\n" "$1";;
|
||||
*) printf "%s\n" "$PWD/$1";;
|
||||
esac
|
||||
}
|
||||
|
||||
listfiles () {
|
||||
find -L "$(dirname "$target")" -maxdepth 1 -type f -iregex \
|
||||
'.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z
|
||||
}
|
||||
|
||||
target="$(abspath "$1")"
|
||||
count="$(listfiles | grep -a -m 1 -ZznF "$target" | cut -d: -f1)"
|
||||
|
||||
if [ -n "$count" ]; then
|
||||
listfiles | xargs -0 sxiv -bpn "$count" --
|
||||
else
|
||||
sxiv -bpq -- "$@" # fallback
|
||||
fi
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
tag="$1"
|
||||
tagValue="$2"
|
||||
|
||||
mkdir output
|
||||
for f in *.mp3;do ffmpeg -i "$f" -c:v copy -c:a copy -metadata "$tag"="$tagValue" "output/$f.mp3";done
|
|
@ -0,0 +1,71 @@
|
|||
#!/bin/bash
|
||||
# Video demo at: http://www.youtube.com/watch?v=TyDX50_dC0M
|
||||
|
||||
# by: Rhomboid
|
||||
# http://www.reddit.com/r/commandline/comments/18yp5b/bash_script_to_update_multiple_blocklists/c8j6v5a
|
||||
|
||||
# Edit by: gotbletu
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# https://twitter.com/gotbletu
|
||||
|
||||
# Transmission does not allow multiple blocklist by default or is not simple.
|
||||
# This script merges multiple blocklist into one file.
|
||||
# Be sure to restart your bt client/daemon to use the new iplist.
|
||||
# Make sure to enable the blocklist and keep the url empty in your config file.
|
||||
# Example:
|
||||
# "blocklist-enabled": true,
|
||||
# "blocklist-url": "",
|
||||
|
||||
# Do P2P Blocklists Keep You Safe?
|
||||
# http://torrentfreak.com/do-p2p-blocklists-keep-you-safe/
|
||||
# TLDR: 75-80% safe; not 100% foolproof
|
||||
|
||||
# Some suggested blocklist:
|
||||
# http://www.iblocklist.com/lists.php
|
||||
|
||||
# Bluetack list
|
||||
# level1 # General default list.
|
||||
# level2 # Labs or researchers.
|
||||
# level3 # The paranoids list.
|
||||
# bt_bogon # Unallocated addresses.
|
||||
# bt_dshield # known hackers
|
||||
# bt_hijacked # spammers
|
||||
# bt_microsoft # bill gates
|
||||
# bt_templist # Suspected bad peers.
|
||||
# bt_spyware # Suspected spy/malware.
|
||||
|
||||
# TBG list
|
||||
# ijfqtofzixtwayqovmxn # primary threat; anti p2p company
|
||||
# ecqbsykllnadihkdirsh # General Corporate Ranges
|
||||
# ewqglwibdgjttwttrinl # Bogon by TBG; Unallocated addresses
|
||||
# tbnuqfclfkemqivekikv # Hijacked by TBG; spammers
|
||||
## jcjfaxgyyshvdbceroxf # Business ISPs
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
# blocklist to download from
|
||||
URLS=(
|
||||
http://list.iblocklist.com/?list=bt_level1
|
||||
http://list.iblocklist.com/?list=bt_level2
|
||||
http://list.iblocklist.com/?list=bt_level3
|
||||
http://list.iblocklist.com/?list=bt_bogon
|
||||
http://list.iblocklist.com/?list=bt_dshield
|
||||
http://list.iblocklist.com/?list=bt_hijacked
|
||||
http://list.iblocklist.com/?list=bt_microsoft
|
||||
http://list.iblocklist.com/?list=bt_templist
|
||||
http://list.iblocklist.com/?list=bt_spyware
|
||||
http://list.iblocklist.com/?list=ijfqtofzixtwayqovmxn
|
||||
http://list.iblocklist.com/?list=ecqbsykllnadihkdirsh
|
||||
http://list.iblocklist.com/?list=tbnuqfclfkemqivekikv
|
||||
http://list.iblocklist.com/?list=ewqglwibdgjttwttrinl
|
||||
)
|
||||
|
||||
# blocklist directory
|
||||
DIR="$HOME/.config/transmission-daemon/blocklists"
|
||||
|
||||
# remove old blocklist
|
||||
rm -f $DIR/extras*
|
||||
|
||||
# download new blocklist
|
||||
wget "${URLS[@]}" -O - | gunzip | LC_ALL=C sort -u > "$DIR/extras.txt"
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
TRANS_PID=$(pidof transmission-daemon)
|
||||
|
||||
if [ "$TRANS_PID" ]; then
|
||||
transmission-remote --add "$@"
|
||||
else
|
||||
tsd
|
||||
sleep 8
|
||||
transmission-remote --add "$@"
|
||||
fi
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
TRANS_PID=$(pidof transmission-daemon)
|
||||
|
||||
if [ "$TRANS_PID" ]; then
|
||||
echo "$(tput setaf 1) Stopping Transmission Daemon"
|
||||
killall transmission-daemon 2> /dev/null ;
|
||||
echo "$(tput setaf 3) Updating Blocklist"
|
||||
tblock
|
||||
echo "$(tput setaf 2) Restarting Transmission Daemon"
|
||||
tsd
|
||||
fi
|
||||
|
||||
if [ ! "$TRANS_PID" ]; then
|
||||
echo "$(tput setaf 3) Updating Blocklist"
|
||||
tblock
|
||||
fi
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/zsh
|
||||
|
||||
icon="$XDG_DATA_HOME/icons/Haiku/scalable/apps/transmission.svg"
|
||||
|
||||
killall transmission-daemon 2> /dev/null
|
||||
transmission-daemon --foreground --log-info 2>&1 | while read line; do
|
||||
echo $line |
|
||||
grep -v "announcer.c:\|platform.c:\|announce done (tr-dht.c:" |
|
||||
grep -v "Saved.*variant.c:" |
|
||||
while read line; do
|
||||
echo $line | grep -q "Queued for verification (verify.c:" &&
|
||||
notify-send -i "$icon" --app-name="Transmission Started" "${line#* * }"
|
||||
echo $line | grep -q "changed from .Incomplete. to .Complete." &&
|
||||
notify-send -i "$icon" --app-name="Transmission Complete" "${line#* * }"
|
||||
# echo $line | systemd-cat --identifier="TransWrap" --priority=5
|
||||
done 2>&1 > /dev/null
|
||||
done&disown
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
doas xbps-install -Su
|
||||
echo "Actualizando la lista de paquetes..."
|
||||
paclist
|
||||
echo "Listo."
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
switch=""
|
||||
titles=""
|
||||
wids="$(bspc query -N -n .window)"
|
||||
nl='
|
||||
'
|
||||
|
||||
for wid in $wids; do
|
||||
title="$(xprop -id "$wid" WM_NAME | cut -d\" -f2)"
|
||||
titles="$titles${titles:+$nl}${title}"
|
||||
switch="$switch '$(echo "${title}" | sed "s#'#\'\\\'\'#g")') bspc node -f $wid;;"
|
||||
done
|
||||
|
||||
switch="$switch *) ;;"
|
||||
|
||||
selection="$(printf '%s' "$titles" | rofi -dmenu -p " " "$@")"
|
||||
eval "case \"$selection\" in $switch esac"
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Emulate vimdiff
|
||||
#
|
||||
exec nvim -d "$@"
|
|
@ -0,0 +1,88 @@
|
|||
#!/bin/sh
|
||||
# ignore shellcheck's warnings, the script works fine
|
||||
|
||||
fzf_opts() {
|
||||
local argument_input
|
||||
|
||||
fzf -i -e -m +s \
|
||||
--query="$argument_input" \
|
||||
--select-1 \
|
||||
--cycle \
|
||||
--reverse \
|
||||
--info=inline \
|
||||
--header="TAB to (un)select. ENTER to run. ESC to quit." \
|
||||
--preview-window=bottom:45%:wrap \
|
||||
--preview 'xbps-query -R {2} ' \
|
||||
--prompt="Filter > " | awk '{print $2}'
|
||||
}
|
||||
|
||||
install() {
|
||||
local pkg
|
||||
pkg="$(xbps-query -Rs "" | sort -u | grep -v "*" | fzf_opts)"
|
||||
pkg="$(echo "$pkg" | paste -sd " ")"
|
||||
|
||||
if [ -n "$pkg" ]; then
|
||||
clear
|
||||
doas xbps-install $pkg
|
||||
fi
|
||||
}
|
||||
|
||||
remove() {
|
||||
local pkg
|
||||
pkg="$(xbps-query -l | sort -u | fzf_opts)"
|
||||
pkg="$(echo "$pkg" | paste -sd " ")"
|
||||
|
||||
if [ -n "$pkg" ]; then
|
||||
clear
|
||||
doas xbps-remove -R $pkg
|
||||
fi
|
||||
}
|
||||
|
||||
unhold() {
|
||||
local pkg
|
||||
pkg="$(xbps-query -p hold -s "" | sort -u | fzf)"
|
||||
pkg="$(echo "$pkg" | paste -sd " " | tr -d ":")"
|
||||
|
||||
if [ -n "$pkg" ]; then
|
||||
clear
|
||||
doas xbps-pkgdb -m unhold $pkg
|
||||
fi
|
||||
}
|
||||
|
||||
hold() {
|
||||
local pkg
|
||||
pkg="$(xbps-query -l | sort -u | fzf_opts)"
|
||||
pkg="$(echo "$pkg" | paste -sd " ")"
|
||||
|
||||
if [ -n "$pkg" ]; then
|
||||
clear
|
||||
doas xbps-pkgdb -m hold $pkg
|
||||
fi
|
||||
}
|
||||
|
||||
cache() {
|
||||
doas xbps-remove -Oo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
1) install ;;
|
||||
2) remove ;;
|
||||
3) hold ;;
|
||||
4) unhold ;;
|
||||
5) cache ;;
|
||||
*) cat << EOF ;;
|
||||
xui: FZF xbps ui. Run simple xbps commands to install,
|
||||
remove, hold, unhold, update packages, and clear cache.
|
||||
|
||||
Allowed options:
|
||||
1: Install Runs \`xbps-install\`
|
||||
2: Remove Runs \`xbps-remove -R\`
|
||||
3: Hold Runs \`xbps-pkgdb -m hold\`
|
||||
4: Unhold Runs \`xbps-pkgdb -m unhold\`
|
||||
5: Clear cache Runs \`xbps-remove -Oo\`
|
||||
All else Print this message
|
||||
|
||||
Enter the number of your choice to execute command.
|
||||
EOF
|
||||
|
||||
esac
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
youtube-dl --add-metadata --youtube-skip-dash-manifest -ic --no-call-home --no-cache-dir --geo-bypass -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' -o "/mnt/samsung/necropolis/vid/%(title)s.%(ext)s" "$@"
|
|
@ -0,0 +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' "$@"
|
|
@ -0,0 +1,35 @@
|
|||
#!/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" ;;
|
||||
*.tar) tar xvf "$archive" ;;
|
||||
*.lzma) unlzma "$archive" ;;
|
||||
*.bz2) bunzip2 "$archive" ;;
|
||||
*.rar) unrar x -ad "$archive" ;;
|
||||
*.gz) gunzip "$archive" ;;
|
||||
*.tar) tar xvf "$archive" ;;
|
||||
*.zip|*.ZIP) 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