Compare commits

..

3 Commits

Author SHA1 Message Date
692abca1db address 2022-02-18 00:09:18 +01:00
cf8d9f0026 nice mount system 2022-02-18 00:08:41 +01:00
9d34ea87cd mktex 2022-02-14 08:17:39 +01:00
3 changed files with 127 additions and 0 deletions

5
address Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
khard email "$@" | grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"
s="$@"
[ "$#" -gt 0 ] && notmuch address "$@" | grep -i "$s"

82
interractive_mount Executable file
View File

@ -0,0 +1,82 @@
#!/bin/sh
function usage () {
echo "Usage:"
echo "$0 <action>"
}
# If no display found, full text interface. use dmenu and dunstify else.
if [ -z "$DISPLAY" ] ; then
interface=text
function notify () {
echo "$1\n$2"
}
function ask () {
echo "Text interface not implemented. use X :(" >/dev/stderr
exit 1
#TODO
i=0
while read l ; do
echo "$i) $l"
((i++))
done
echo -n "Your choice: "
read choice
if [ "$choice" -le "$i" ] && [ "$choice" -ge 0 ] ; then
echo $i
fi
}
else
interface=x
function notify () {
dunstify "$1" "$2"
}
function ask () {
dmenu
}
fi
if [ "$1" = "mount" ] ; then
action=mount
elif [ "$1" = umount ] || [ "$1" = unmount ] ; then
action=umount
else
usage
exit 1
fi
mounted=""
umounted=""
mounted_nb=0
umounted_nb=0
# List mounted and unmounted disks
while read disk size mountpoint ; do
# Filters. Add yours
[[ "$disk" = /dev/sda* ]] && continue
[ "$disk" = /dev/mapper/cryptroot ] && continue
# Selection
if [ -z "$mountpoint" ] ; then
umounted="$umounted$disk $size\n"
((umounted_nb++))
else
mounted="$mounted$disk $size $mountpoint\n"
((mounted_nb++))
fi
done <<< $(lsblk -prno NAME,SIZE,MOUNTPOINTS)
# Prompt user for disk action
if [ "$action" = "mount" ] ; then
read disk size <<< $(echo -en $umounted | dmenu -i -l "$umounted_nb" -p 'Mount: ')
if [ -b "$disk" ] ; then
notify "Mounting $disk" "$(udisksctl mount -b "$disk" 2>&1)"
fi
elif [ "$action" = "umount" ] ; then
read disk size mountpoint <<< $(echo -en $mounted | dmenu -i -l "$mounted_nb" -p 'Unmount: ')
if [ -b "$disk" ] ; then
notify "Unmounting $disk" "$(udisksctl unmount -b "$disk" 2>&1)"
fi
fi

40
mktex Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
# Author: Romain Deville (ty <3)
# Generate latex file two times to get page numbering and glossary right
if [[ $# -eq 1 ]] && ! [[ $1 == 'bib' ]]
then
if [[ $1 == 'clean' ]]
then
bash -c "rm -f *.aux *.bbl *.blg *.log *.out *.idx *.ilg *.ind *.toc *.fls *.fdb_latexmk
*synctex.gz *.d"
elif [[ $1 == 'veryclean' ]]
then
bash -c "rm -f *.aux *.bbl *.blg *.log *.out *.idx *.ilg *.ind *.toc *.fls *.fdb_latexmk
*synctex.gz *.d *.pdf"
fi
else
grep -lFm 1 'begin{document}' *.tex | while read f ; do
pdflatex_cmd="pdflatex -file-line-error -halt-on-error '$f'"
latex_file_without_ext="${f:0:-4}"
bash -c "$pdflatex_cmd" 2>/dev/null
[[ $? -eq 1 ]] && read
# Generate glossary
if [ -n "$(grep -E '\\usepackage.*{glossaries}' "$f") " ] ; then
makeglossaries "$latex_file_without_ext"
[[ $? -eq 1 ]] && read
fi
# Generate bib
if [ -n "$(grep -E '^[[:space:]]*\\bibliograph[yi]' "$f")" ] ; then
bibtex ${f%%.tex*}.aux
[[ $? -eq 1 ]] && read
fi
# get all right
bash -c "$pdflatex_cmd" 2>/dev/null
[[ $? -eq 1 ]] && read
"$pdflatex_cmd" 2>/dev/null
[[ $? -eq 1 ]] && read
done
fi