Compare commits

...

19 Commits

Author SHA1 Message Date
Daja177
5f385da9f6
Fix rssget shebang (#1457) 2025-03-09 11:07:46 +00:00
Rokosun
8e2abf828a
Fix UI rendering issues in neovim (#1455)
Neovim started showing UI rendering issues after the latest update. Some of the Unicode characters used in the vim-airline plugin were found to be the cause, this commit aims to solve the issue by removing those characters.

Check this issue for more details - https://github.com/vim-airline/vim-airline/issues/2704
2025-03-08 09:58:26 +00:00
Alessio Artoni
70ee0fe03f
Evaluate aliases at runtime (#1456) 2025-03-06 21:47:02 +00:00
Nicholas Gorden
1e750084e5
New: create sb-ticker (#1436)
* weath: Add option to get forecast from a different location (#1327)

* weath: Add option to get forecast from a different location

* Remove retry and make max time lower because it is interactive

* Give weath 'cp' option to copy forecast as plain text for sharing

* Make weath a separate script

* shortcuts: export env vars for each shortcut (#1395)

useful if want to use shortcuts w/ different progs instead of
their default behavior (cd / $EDITOR), e.g.:

```sh
cd ~/Downloads
mv foo.mp3 $music
```

Co-authored-by: Luke Smith <luke@lukesmith.xyz>

* Update mpd to use PipeWire (#1412)

per https://wiki.archlinux.org/title/Music_Player_Daemon#Audio_configuration

* New: create sb-ticker

---------

Co-authored-by: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com>
Co-authored-by: Kipras Melnikovas <kipras@kipras.org>
Co-authored-by: Luke Smith <luke@lukesmith.xyz>
Co-authored-by: fennomaani <160141733+fennomaani@users.noreply.github.com>
2025-03-05 14:01:04 +00:00
Oleksandr Miliukhin
51baf2e6b3
rssget - search the website for RSS feeds and add them to newsboat url list using rssadd. Also gets links to feeds on some sites that don't provide those links. (#1430) 2025-03-05 10:21:41 +00:00
Emre AKYÜZ
59632a5668
Even More Improvements for Getbib (Including Prior) (#1314)
* Even More Improvements for Getbib (Including Prior)

I have used and benefited from the "getbib" script and the instructions on LaTeX from Luke for a long time. So, I have put a lot of thought into this script, since I am very interested in academia. Hope you all like this.

Justifications for Improvements

This script stands out as a highly valuable (at least in my opinion) and efficient tool for managing and fetching BibTeX entries for DOIs found in PDF files or provided directly. The robust design and comprehensive functionality make it an indispensable asset for researchers. The main reasons for its superiority are as follows:
- Exceptional time-saving: By automating the process of extracting DOIs and fetching BibTeX entries, the script drastically reduces the manual effort involved in managing citations, thereby saving users an incredible amount of time and energy.
- Outstanding versatility: The script's ability to handle various input types, including directories containing PDF files, single PDF files, and DOIs, sets it apart from other solutions. This adaptability allows users to process numerous scenarios with ease, making it the go-to tool for all their citation needs.
- Unparalleled consistency: The script ensures that DOIs are uniformly processed and normalized, improving the consistency of the entries in the BibTeX file. This feature is crucial for maintaining a clean and professional bibliography that adheres to high academic standards. It inserts an empty line between entries inside the BIB_FILE, as well as, making the author name lower case. It also removes any special characters and the first 2 numbers of the year from the first line. So it is easier to read, maintain and easier to use inside a LaTeX document. Normalizing also helps to check for duplicate entries. It prevents some weird entries escaping from getting caught as a duplicate.
- Remarkable duplicate prevention: The script's built-in functionality to check for duplicate entries before appending them to the BibTeX file demonstrates a keen attention to detail. This feature ensures that the bibliography remains free of redundancies, streamlining the citation management process.
- The use of functions and modular design in the script makes the code highly readable, maintainable, and extendable. This strong foundation allows for seamless adaptation to future changes and requirements.
- Provides users with an exceptional level of automation, versatility, and reliability.
- You can provide the DOI address even in very wrong forms and get a correct output. You can even feed it a website URL such as: https://doi.org/10.1038/s41594-023-00968-y and all of the DOI handling is done by a single "sed" command.
- Robust notification system to learn more about the errors or other types of feedback.
- The "curl" output is in red in order to separate the output and the notification better and to improve readability.

Details
BIB_FILE: The path to the BibTeX file where entries will be saved.
CORRECTION_METHOD: A very powerful sed command to extract and correct the DOI from the input even in harsher cases.
get_doi_from_pdf function: Extracts a DOI from the provided PDF file using pdfinfo and pdftotext commands.
If pdfinfo doesn't find a DOI, it uses pdftotext to extract it from the first page of the PDF.
normalize_doi function: Normalizes the DOI by converting it to lowercase.
process_doi function: Fetches the BibTeX entry for the given DOI using the Crossref with a curl command.
Prints the output of the curl command in red using ANSI escape codes.
Checks if the fetched BibTeX entry is valid and not empty.
If the fetched BibTeX entry is not in the BIB_FILE, it appends the entry to the file.
The script processes input arguments, which can be a directory, a PDF file, or a DOI:
    a) If it's a directory, the script processes all PDF files in the directory.
    b) If it's a PDF file, the script processes the single PDF file.
    c) If it's a DOI, the script processes the DOI directly.

More details on the correction method (sed command), from my prior pull request
Very Detailed Explanation (I realized that escaped backslashes do not appear. There is a backslash if you see nothing.)
(For people who wonder about it, or try to learn. It could take a tremendous amount of time to learn all of it without explanation, so it would be better to explain):

sed The sed command is a stream editor that can be used to perform basic text transformations on an input file or from a pipeline. You can see Luke uses it a lot in his videos. It can also modify files' content if you want for other purposes. That function is used a lot for bootstrapping scripts for changing config files automatically if necessary.

-n This option tells sed not to print lines by default. We'll only print lines when we specify the p command in the script.

-E This option enables the use of extended regular expressions, which allows for more readable and flexible regex patterns.

's/ This starts the sed script and defines the s command (substitute). It is used to find a regex pattern in the input and replace it with a specified string.

.* This regex pattern matches any character (except a newline) zero or more times. In this case, it matches all characters before "doi" or "DOI".

( This paranthesis opens a capturing group, which allows us to refer back to the matched text later in the script.

(DOI|doi) This regex pattern matches either "DOI" or "doi". The | symbol is used as an OR operator in regular expressions.

( This next paranthesis opens another capturing group.

(.(org))? This regex pattern matches an optional ".org". The . is an escaped period, and (org) matches the string "org". The ? following the group makes it optional. Escaping is needed for most of non-alphanumeric characters. You can test and practice them on vim, trying to use the "substitute" function to change some text.

/? This regex pattern matches an optional "/", with the ? making it optional. The prior backslash is for escaping. Again, some characters need to be escaped to be able to used in commands. Escaped means they have ** before them. Spaces may be the most escaped characters.

| This symbol, later, also acts as an OR operator, indicating that the pattern before or after it can be matched.

**:? *** This regex pattern matches an optional colon (":") followed by zero or more spaces. The ? makes the colon optional, and ***** matches zero or more spaces.

) This closes the capturing group started earlier.

) This closes the outer capturing group.

([^: ]+[^ .]) This regex pattern matches any character except colons and spaces one or more times ([^: ]+) Plus symbol here shows one or more times. If it is a star then it means zero or more times. It is then followed by a single alphanumeric character ([^ .]) Single because there are no plus or star symbol next to it. This part as a whole ensures that the last character of the matched text is alphanumeric.

.* This regex pattern matches any character (except a newline) zero or more times. In this case, it matches all remaining characters in the input line.

/ This delimiter separates the regex pattern from the replacement string in the s command. s command needs a separator that is a forward slash.

doi:\6 This is the replacement string. The text "doi:" is followed by the 6th captured group from the regex pattern, which contains the characters after "doi" or "DOI" and the colon, "/", or space(s).

/p This delimiter separates the replacement string from the p command, which tells sed to print the modified line if a substitution has been made. The substitution mentioned here is the change of ".org/" to ":". This helps turning URLs into doi addresses.

; This separates different commands within the sed script.

T This command branches to the end of the script if no substitution was made since the last input line was read or conditional branch was taken. In this case, it ensures that the q command is only executed if a matching line has been found and a substitution was made. This is one of the most important parts to get the doi address from the urls such as "https://doi.org/10.1038/s41594-023-00968-5". Because we don't always have URLs for doi addresses. In this way, this function only works when we work with URLs. So in this case it helps changing .org/ with : This makes the part of the doi address as this: "doi:" rather than this: "doi.org/".

q This command tells sed to quit processing after the first match, ensuring that only the first matching line in the file is processed. Otherwise, we would get all doi addresses in a scientific study because there are lots of doi addresses in them.

' This closes the other '

TL;DR:
Basically this whole command ensures that the output we get starts with "doi:", then it can have every type of character in it except spaces and ".org/" , then it will end with an alphanumeric character [A-Z, a-z or 0-9]. That ensures removing the trailing dots from some doi addresses that have them.

* Update getbib

* Use DASH | Remove IFs | Minimize

* minor corrections & improvements

* Improve && Minimize

* Make the duplicate matching case insensitive

* Formatting change.

* Reformat | Add custom .bib
2025-03-02 15:54:50 +00:00
Luke Smith
331acfb5ca
Merge branch 'aartoni-feat/latexmk' 2025-03-02 16:53:01 +01:00
Luke Smith
7d26250657
delete texclear 2025-03-02 16:52:56 +01:00
Luke Smith
2ca3f80dd3
Merge branch 'feat/latexmk' of github.com:aartoni/dotfiles into aartoni-feat/latexmk 2025-03-02 16:51:52 +01:00
thetubster99
15071db7fa
Remove non-working sat24 doppler provider, and add the Netherlands (#1397) 2025-03-02 15:47:31 +00:00
Emre AKYÜZ
e2d787992e
aliasrc | improve se() (#1433)
* aliasrc  |  improve se()

1. Remove external commands like find.
2. Remove extensions and path (if present) from the names in fzf.
3. Only open Nvim if there is a selection.

Do all of these without using find, sed, grep.

- First line creates an array with the files in the scripts directory.

- Second line removes path (:t) and the extensions (:r) from the scripts.

- [[ "${c}" ]] checks if this variable is non-empty.

- ${${(M)s:#*/${c}*}[1]}
(M) enables "match" mode.
:# anchors the pattern to the start of each array element.
*/${c}* matches any path containing the selected basename.
[1] selects the first matching item.

* capture sub-directories too
2025-02-28 19:11:57 +00:00
Rokosun
4606e9156a
Improve UI for move/copy in lf (#1438)
* Clear screen before move/copy

Quick fix for https://github.com/LukeSmithxyz/voidrice/pull/1437#issuecomment-2430008043

* More UI improvements
2025-02-28 19:10:40 +00:00
xsmh
e7c02d9726
Enhance locking mechanism (#1446)
This is a (subjectively) preferable behavior for locking the system.

- Pause all media players and mute audio when the system is locked. Unmute after unlocking.

Co-authored-by: Shahram <80352285+ShahramMohammed@users.noreply.github.com>
2025-02-28 15:05:56 +00:00
Alessio Artoni
53f1df79e5
Fix magick related actions in nsxiv (#1449) 2025-02-28 14:57:16 +00:00
Luke Bubar
e83e5ecef0
Update compiler to include instruction for the Rink calculator (#1452)
* Update compiler to include instruction for the Rink calculator

Added a compiler option for rink calculator files. Rink is a unit-conversion calculator written in Rust.

* Update compiler to include COBOL instructions
2025-02-28 14:56:00 +00:00
xsmh
407e9d8a84
Group multi-process program usage (#1444)
Programs like Chrome run multiple processes that take up the entire notification window. This commit solves this issue by grouping and aggregating CPU and memory usage for multi-process programs into single entries.
2025-02-28 14:29:29 +00:00
pa-d-v
85801d095f
Fix breaking height and preferred offset syntax in dunstrc since v1.12.0 (#1453) 2025-02-28 14:25:56 +00:00
Alessio Artoni
21c0122597
Removes the arkenfox-auto-update script (#1442) 2025-02-28 14:11:42 +00:00
aartoni
f1c7405012 latexmk 2024-11-09 14:49:13 +07:00
16 changed files with 294 additions and 131 deletions

View File

@ -2,8 +2,8 @@
monitor = 0
follow = keyboard
width = 370
height = 350
offset = 0x19
height = (0,350)
offset = (0,19)
padding = 2
horizontal_padding = 2
transparency = 25

10
.config/latexmk/latexmkrc Normal file
View File

@ -0,0 +1,10 @@
$bibtex_use = 1.5;
$cleanup_includes_cusdep_generated = 1;
$cleanup_includes_generated = 1;
$out_dir = "out";
$pdf_mode = 5;
$silent = 1;
# SyncTeX
push(@generated_exts, ("synctex.*"));
push(@extra_xelatex_options, '-synctex=1') ;

View File

@ -93,7 +93,8 @@ cmd delete ${{
cmd moveto ${{
set -f
dest=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" | fzf --prompt 'Move to where? ' | sed 's|~|$HOME|')
clear; tput cup $(($(tput lines)/3))
dest=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" | fzf --layout=reverse --height 40% --prompt 'Move to where? ' | sed 's|~|$HOME|')
[ -z "$dest" ] && exit
destpath=$(eval printf '%s' \"$dest\")
clear; tput cup $(($(tput lines)/3)); tput bold
@ -110,7 +111,8 @@ cmd moveto ${{
cmd copyto ${{
set -f
dest=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" | fzf --prompt 'Copy to where? ' | sed 's|~|$HOME|')
clear; tput cup $(($(tput lines)/3))
dest=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" | fzf --layout=reverse --height 40% --prompt 'Copy to where? ' | sed 's|~|$HOME|')
[ -z "$dest" ] && exit
destpath=$(eval printf '%s' \"$dest\")
clear; tput cup $(($(tput lines)/3)); tput bold

View File

@ -14,11 +14,11 @@ do
mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &
;;
"r")
magick -rotate 90 "$file" "$file" ;;
magick "$file" -rotate 90 "$file" ;;
"R")
magick -rotate -90 "$file" "$file" ;;
magick "$file" -rotate -90 "$file" ;;
"f")
magick -flop "$file" "$file" ;;
magick "$file" -flop "$file" ;;
"y")
printf "%s" "$file" | tr -d '\n' | xclip -selection clipboard &&
notify-send "$file copied to clipboard" & ;;

View File

@ -63,7 +63,8 @@ colorscheme vim
endif
let g:airline_symbols.colnr = ' C:'
let g:airline_symbols.linenr = ' L:'
let g:airline_symbols.maxlinenr = '☰ '
let g:airline_symbols.maxlinenr = ' '
let g:airline#extensions#whitespace#symbol = '!'
" Shortcutting split navigation, saving a keypress:
map <C-h> <C-w>h
@ -91,7 +92,7 @@ colorscheme vim
map <leader>p :!opout "%:p"<CR>
" Runs a script that cleans out tex build files whenever I close out of a .tex file.
autocmd VimLeave *.tex !texclear %
autocmd VimLeave *.tex !latexmk -c %
" Ensure files are read as what I want:
let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}

View File

@ -4,9 +4,9 @@
[ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d"
# Use $XINITRC variable if file exists.
[ -f "$XINITRC" ] && alias startx="startx $XINITRC"
[ -f "$XINITRC" ] && alias startx='startx $XINITRC'
[ -f "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC"
[ -f "$MBSYNCRC" ] && alias mbsync='mbsync -c $MBSYNCRC'
# sudo not required for some system commands
for command in mount umount sv pacman updatedb su shutdown poweroff reboot ; do
@ -14,9 +14,10 @@ for command in mount umount sv pacman updatedb su shutdown poweroff reboot ; do
done; unset command
se() {
choice="$(find ~/.local/bin -mindepth 1 -printf '%P\n' | fzf)"
[ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice"
}
s=("${HOME}/.local/bin/"**/*(.))
c="$(print -lnr ${s:t:r} | fzf)"
[[ "${c}" ]] && "${EDITOR}" ${${(M)s:#*/${c}*}[1]}
}
# Verbosity and settings that you pretty much just always are going to want.
alias \
@ -46,8 +47,8 @@ alias \
trem="transmission-remote" \
YT="youtube-viewer" \
sdn="shutdown -h now" \
e="$EDITOR" \
v="$EDITOR" \
e='$EDITOR' \
v='$EDITOR' \
p="pacman" \
xi="sudo xbps-install" \
xr="sudo xbps-remove -R" \
@ -57,4 +58,4 @@ alias \
alias \
lf="lfub" \
magit="nvim -c MagitOnly" \
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
ref='shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc'

View File

@ -1,23 +0,0 @@
#!/bin/sh
# A wrapper for the arkenfox-updater that runs it on all pre-existing Arkenfox
# user.js files on the machine.
# On installation of LARBS, this file is copied to /usr/local/lib/ where it is
# run by a pacman hook set up. The user should not have to run this manually.
# Search for all Firefox and Librewolf profiles using Arkenfox.
profiles="$(grep -sH "arkenfox user.js" \
/home/*/.librewolf/*.default-release/user.js \
/home/*/.mozilla/firefox/*.default-release/user.js)"
IFS='
'
# Update each found profile.
for profile in $profiles; do
userjs=${profile%%/user.js*}
user=$(stat -c '%U' "$userjs") || continue
su -l "$user" -c "arkenfox-updater -c -p $userjs -s"
done

View File

@ -6,9 +6,6 @@
# Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent
# presentations. Runs scripts based on extension or shebang.
# Note that .tex files which you wish to compile with XeLaTeX should have the
# string "xelatex" somewhere in a comment/command in the first 5 lines.
file="${1}"
ext="${file##*.}"
dir=${file%/*}
@ -20,6 +17,7 @@ case "${ext}" in
[0-9]) preconv "${file}" | refer -PS -e | groff -mandoc -T pdf > "${base}.pdf" ;;
mom|ms) preconv "${file}" | refer -PS -e | groff -T pdf -m"${ext}" > "${base}.pdf" ;;
c) cc "${file}" -o "${base}" && "./${base}" ;;
cob) cobc -x -o "$base" "$file" && "$base" ;;
cpp) g++ "${file}" -o "${base}" && "./${base}" ;;
cs) mcs "${file}" && mono "${base}.exe" ;;
go) go run "${file}" ;;
@ -33,20 +31,12 @@ case "${ext}" in
pandoc -t ms --highlight-style="kate" -s -o "${base}.pdf" "${file}" ;;
org) emacs "${file}" --batch -u "${USER}" -f org-latex-export-to-pdf ;;
py) python "${file}" ;;
rink) rink -f "${file}" ;;
[rR]md) Rscript -e "rmarkdown::render('${file}', quiet=TRUE)" ;;
rs) cargo build ;;
sass) sassc -a "${file}" "${base}.css" ;;
scad) openscad -o "${base}.stl" "${file}" ;;
sent) setsid -f sent "${file}" 2> "/dev/null" ;;
tex)
textarget="$(getcomproot "${file}" || echo "${file}")"
command="pdflatex"
head -n5 "${textarget}" | grep -qi "xelatex" && command="xelatex"
${command} --output-directory="${textarget%/*}" "${textarget%.*}" &&
grep -qi addbibresource "${textarget}" &&
biber --input-directory "${textarget%/*}" "${textarget%.*}" &&
${command} --output-directory="${textarget%/*}" "${textarget%.*}" &&
${command} --output-directory="${textarget%/*}" "${textarget%.*}"
;;
tex) latexmk ;;
*) sed -n '/^#!/s/^#!//p; q' "${file}" | xargs -r -I % "${file}" ;;
esac

View File

@ -1,14 +1,71 @@
#!/bin/sh
[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
if [ -f "$1" ]; then
# Try to get DOI from pdfinfo or pdftotext output.
doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
doi=$(pdftotext "$1" 2>/dev/null - | sed -n '/[dD][oO][iI]:/{s/.*[dD][oO][iI]:\s*\(\S\+[[:alnum:]]\).*/\1/p;q}') ||
exit 1
else
doi="$1"
fi
BIB_FILE="${HOME}/latex/uni.bib"
[ -f "${BIB_FILE}" ] || BIB_FILE="${2:-$(find "${HOME}" -path "${HOME}/.*" \
-prune -o -type "f" -name "*.bib" -print -quit)}"
# Check crossref.org for the bib citation.
curl -s "https://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n"
{ [ -f "${BIB_FILE}" ] || [ "${2}" ]; } || {
printf "%s\n" "Create a .bib file or provide as \$2." && exit "1"
}
filter() {
sed -n -E 's/.*((DOI|doi)((\.(org))?\/?|:? *))([^: ]+[^ .]).*/\6/p; T; q'
}
fpdf() {
pdf="${1}"
doi="$(pdfinfo "${pdf}" 2> "/dev/null" | filter)"
[ "${doi}" ] || doi="$(pdftotext -q -l "2" "${pdf}" - 2> "/dev/null" | filter)"
[ "${doi}" ] || printf "%s\n" "No DOI found for PDF: ${pdf}" >&2
printf "%s\n" "${doi}"
}
arrange() {
sed 's/\}, /\},\n /g
s/, /,\n /
s/ }/\n}/
s/,\s*pages=/,\n\tpages=/' |
sed '1s/^ *//
1s/[0-9]*\([0-9]\{2\}\)/\1/
1s/_//
1s/.*/\L&/
s/.*=/\L&/
s/=/ = /'
}
doi2bib() {
doi="${1#doi:}"
url="https://api.crossref.org/works/${doi}/transform/application/x-bibtex"
entry="$(curl -kLsS --no-fail "${url}" | arrange)"
red='\033[0;31m'
reset='\033[0m'
printf "${red}%s${reset}\n" "${entry}"
[ "${entry%"${entry#?}"}" != "@" ] && {
printf "%s\n" "Failed to fetch bibtex entry for DOI: ${doi}"
return "1"
}
grep -iFq "doi = {${doi}}" "${BIB_FILE}" 2> "/dev/null" && {
printf "%s\n" "Bibtex entry for DOI: ${doi} already exists in the file."
} || {
[ -s "${BIB_FILE}" ] && printf "\n" >> "${BIB_FILE}"
printf "%s\n" "${entry}" >> "${BIB_FILE}"
printf "%s\n" "Added bibtex entry for DOI: ${doi}"
}
}
[ "${1}" ] || {
printf "%s\n" "Give either a pdf file or a DOI or a directory path that has PDFs as an argument."
exit "1"
}
[ -f "${1}" ] && doi="$(fpdf "${1}")" && doi2bib "${doi}" && exit "0"
[ -d "${1}" ] && for i in "${1}"/*.pdf; do doi="$(fpdf "${i}")" && doi2bib "${doi}"; done && exit "0"
doi="$(printf "%s\n" "${1}" | filter)" && doi2bib "${doi}"

115
.local/bin/rssget Executable file
View File

@ -0,0 +1,115 @@
#!/bin/bash
# Searches the website for RSS feeds and adds them to newsboat url list. Can
# also find hidden RSS feeds on various websites, namely Youtube, Reddit,
# Vimeo, Github, Gitlab and Medium. Gets site url as $1 or (if not present)
# from X clipboard. Gets tags as $2. If it finds more than one feed, calls
# dmenu for the user to choose which one to add. I have bound it to a keyboard
# shortcut so i copy a site link and easily add its feed to the reader.
# Inspired by and based on the logic of this extension:
# https://github.com/shevabam/get-rss-feed-url-extension
# This script requires rssadd to add feeds to the list.
getlink () {
local url="$1"
feeds="$(curl -s "$url" | grep -Ex '.*type=.*(rss|rdf|atom).*' | sed 's/ //g')"
url="$(echo $url | sed 's|^\(https://[^/]*/\).*|\1|')"
for rsspath in $feeds; do
rsspath="$(echo $rsspath | sed -n "s|.*href=['\"]\([^'\"]*\)['\"].*|\1|p")"
if echo "$rsspath" | grep "http" > /dev/null; then
link="$rsspath"
elif echo "$rsspath" | grep -E "^/" > /dev/null; then
link="$url$(echo $rsspath | sed 's|^/||')"
else
link="$url$rsspath"
fi
echo $link
done
}
getRedditRss() {
echo "${1%/}.rss"
}
getYoutubeRss() {
local url="$1"
path=$(echo "$url" | sed -e 's|^http[s]*://||')
case "$path" in
*"/channel/"*) channel_id="$(echo $path | sed -r 's|.*channel/([^/]*).*|\1|')" && feed="https://www.youtube.com/feeds/videos.xml?channel_id=${channel_id}" ;;
*"/c/"*|*"/user/"*)
feed=$(wget -q "$url" -O tmp_rssget_yt \
&& sed -n 's|.*\("rssUrl":"[^"]*\).*|\1|; p' tmp_rssget_yt \
| grep rssUrl \
| sed 's|"rssUrl":"||') ;;
esac
echo "$feed"
}
getVimeoRss() {
local url="$1"
if echo "$url" | grep -q "/videos$"; then
feed_url=$(echo "$url" | sed 's/\/videos$//' | sed 's/\/$/\/rss/')
else
feed_url="${url}/videos/rss"
fi
echo "$feed_url"
}
getGithubRss () {
local url="${1%/}"
if echo $url | grep -E "github.com/[^/]*/[a-zA-Z0-9].*" >/dev/null ; then
echo "${url}/commits.atom"
echo "${url}/releases.atom"
echo "${url}/tags.atom"
elif echo $url | grep -E "github.com/[^/]*(/)" >/dev/null ; then
echo "${url}.atom"
fi
}
getGitlabRss () {
local url="${1%/}"
echo "${url}.atom"
}
getMediumRss () {
echo $1 | sed 's|/tag/|/feed/|'
}
if [ -n "$1" ] ; then
url="$1"
else
url="$(xclip -selection clipboard -o)"
[ -z "$url" ] && echo "usage: $0 url 'tag1 tag2 tag3'" && exit 1
fi
declare -a list=()
yt_regex="^(http(s)?://)?((w){3}\.)?(youtube\.com|invidio\.us|invidious\.flokinet\.to|invidious\.materialio\.us|iv\.datura\.network|invidious\.perennialte\.ch|invidious\.fdn\.fr|invidious\.private\.coffee|invidious\.protokolla\.fi|invidious\.privacyredirect\.com|yt\.artemislena\.eu|yt\.drgnz\.club|invidious\.incogniweb\.net|yewtu\.be|inv\.tux\.pizza|invidious\.reallyaweso\.me|iv\.melmac\.space|inv\.us\.projectsegfau\.lt|inv\.nadeko\.net|invidious\.darkness\.services|invidious\.jing\.rocks|invidious\.privacydev\.net|inv\.in\.projectsegfau\.lt|invidious\.drgns\.space)/(channel|user|c).+"
reddit_regex="^(http(s)?://)?((w){3}\.)?reddit\.com.*"
vimeo_regex="^(http(s)?://)?((w){3}.)?vimeo\.com.*"
if echo $url | grep -Ex "$yt_regex" >/dev/null ; then
list="$(getYoutubeRss "$url")"
elif echo $url | grep -Ex "$reddit_regex" >/dev/null ; then
list="$(getRedditRss "$url")"
# vimeo actually works with getlink
elif echo $url | grep -E "$vimeo_regex" >/dev/null ; then
list="$(getVimeoRss "$url")"
elif echo $url | grep -E "github.com" >/dev/null ; then
list="$(getGithubRss "$url")"
# gitlab also works with getlink
elif echo $url | grep -E "gitlab.com/[a-zA-Z0-9].*" >/dev/null ; then
list="$(getGitlabRss "$url")"
elif echo $url | grep -E "medium.com/tag" >/dev/null ; then
list="$(getMediumRss "$url")"
else
list="$(getlink "$url")"
fi
[ "$(echo "$list" | wc -l)" -eq 1 ] && chosen_link="$list" || chosen_link=$(printf '%s\n' "${list[@]}" | dmenu -p "Choose a feed:")
tags="$2"
ifinstalled rssadd && rssadd "$chosen_link" "$tags"
echo "$chosen_link" "$tags"

View File

@ -1,7 +1,7 @@
#!/bin/sh
case $BLOCK_BUTTON in
1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;;
1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd,%cpu | awk '{cmd[$1]+=$2} END {for (i in cmd) print i, cmd[i]}' | sort -nrk2 | head)\\n(100% per core)" ;;
2) setsid -f "$TERMINAL" -e htop ;;
3) notify-send "🖥 CPU module " "\- Shows CPU temperature.
- Click to show intensive processes.

View File

@ -182,48 +182,6 @@ US: KVAX: Jacksonville, FL
US: KJGX: Peachtree City/atlanta, GA
US: KVNX: Norman, OK
US: KVBX: Vandenberg Afb: Orcutt, CA
EU: Europe
EU: GB: Great Brittain
EU: SCAN: Scandinavia. Norway, Sweden And Denmark
EU: ALPS: The Alps
EU: NL: The Netherlands
EU: DE: Germany
EU: SP: Spain
EU: FR: France
EU: IT: Italy
EU: PL: Poland
EU: GR: Greece
EU: TU: Turkey
EU: RU: Russia
EU: BA: Bahrain
EU: BC: Botswana
EU: SE: Republic of Seychelles
EU: HU: Hungary
EU: UK: Ukraine
AF: AF: Africa
AF: WA: West Africa
AF: ZA: South Africa
AF: DZ: Algeria
AF: CE: Canary Islands
AF: NG: Nigeria
AF: TD: Chad
AF: CG: Democratic Republic of Congo
AF: EG: Egypt
AF: ET: Ethiopia
AF: CM: Cameroon
AF: IS: Israel
AF: LY: Libya
AF: MG: Madagascar
AF: MO: Morocco
AF: BW: Namibia
AF: SA: Saudi Arabia
AF: SO: Somalia
AF: SD: Sudan
AF: TZ: Tanzania
AF: TN: Tunisia
AF: ZM: Zambia
AF: KE: Kenya
AF: AO: Angola
DE: BAW: Baden-Württemberg
DE: BAY: Bavaria
DE: BBB: Berlin
@ -239,28 +197,29 @@ DE: SAC: Saxony
DE: SAA: Saxony-Anhalt
DE: SHH: Schleswig-Holstein
DE: SHH: Hamburg
DE: THU: Thuringia" | dmenu -r -i -l 50 -p "Select a radar to use as default:" | tr "[:lower:]" "[:upper:]")"
DE: THU: Thuringia
NL: The Netherlands" | dmenu -r -i -l 50 -p "Select a radar to use as default:")"
# Ensure user did not escape.
[ -z "$chosen" ] && exit 1
# Set continent code and radar code.
continentcode=${chosen%%:*}
# Set country code and radar code.
countrycode=${chosen%%:*}
radarcode=${chosen#* } radarcode=${radarcode%:*}
# Print codes to $radarloc file.
printf "%s,%s\\n" "$continentcode" "$radarcode" > "$radarloc" ;}
printf "%s,%s\\n" "$countrycode" "$radarcode" > "$radarloc" ;}
getdoppler() {
cont=$(cut -c -2 "$radarloc")
loc=$(cut -c 4- "$radarloc")
notify-send "🌦️ Doppler RADAR" "Pulling most recent Doppler RADAR for $loc."
case "$cont" in
"US") curl -sL "https://radar.weather.gov/ridge/standard/${loc}_loop.gif" > "$doppler" ;;
"EU") curl -sL "https://api.sat24.com/animated/${loc}/rainTMC/2/" > "$doppler" ;;
"AF") curl -sL "https://api.sat24.com/animated/${loc}/rain/2/" > "$doppler" ;;
"DE") loc="$(echo "$loc" | tr "[:upper:]" "[:lower:]")"
curl -sL "https://www.dwd.de/DWD/wetter/radar/radfilm_${loc}_akt.gif" > "$doppler" ;;
country=$(cut -c -2 "$radarloc")
province=$(cut -c 4- "$radarloc")
notify-send "🌦️ Doppler RADAR" "Pulling most recent Doppler RADAR for $province."
case "$country" in
"US") province="$(echo "$province" | tr "[:lower:]" "[:upper:]")"
curl -sL "https://radar.weather.gov/ridge/standard/${province}_loop.gif" > "$doppler" ;;
"DE") province="$(echo "$province" | tr "[:upper:]" "[:lower:]")"
curl -sL "https://www.dwd.de/DWD/wetter/radar/radfilm_${province}_akt.gif" > "$doppler" ;;
"NL") curl -sL "https://cdn.knmi.nl/knmi/map/general/weather-map.gif" > "$doppler" ;;
esac
}

View File

@ -1,7 +1,7 @@
#!/bin/sh
case $BLOCK_BUTTON in
1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;;
1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd,%mem | awk '{cmd[$1]+=$2} END {for (i in cmd) print i, cmd[i]}' | sort -nrk2 | head)" ;;
2) setsid -f "$TERMINAL" -e htop ;;
3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total.
- Click to show memory hogs.

50
.local/bin/statusbar/sb-ticker Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
# Usage
# sb-ticker
# Sample output
# ^DJI: 0.09%
# CL=F: -1.88%
# Description
# displays/retrieves the latest percent-change in stock market quotes listed in $XDG_CONFIG_HOME/tickers.
# defaults to S&P 500, Dow Jones Industrial, and the Nasdaq
#
# intended to be used in the statusbar, which will display the first quote price in the output
url="terminal-stocks.dev"
pricefile="${XDG_CACHE_HOME:-$HOME/.cache}/stock-prices"
tickerfile="${XDG_CONFIG_HOME:-$HOME/.config}/tickers"
[ -f "$tickerfile" ] && tickers="$(cat "$tickerfile")" || tickers="^GSPC,^DJI,^IXIC";
checkprice() {
[ -s "$pricefile" ] && [ "$(stat -c %y "$pricefile" 2>/dev/null |
cut -d':' -f1)" != "$(date '+%Y-%m-%d %H')" ]
}
getchange() {
mapfile -t changes < <(sed -e 's/ / /g' "$pricefile" | grep -oe '[m-]\+[0-9]\+\.[0-9]\+' | sed 's/[m ]/;/g')
IFS=',' read -ra TICKER <<< "$tickers"
for idx in "${!TICKER[@]}"; do
printf "%s: %s%%\n" "${TICKER[$idx]}" "${changes[$idx]//;/}"
done
}
updateprice() { curl -sfm 10 "$url/$tickers" --output "$pricefile" || rm -f "$pricefile" ; }
case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e less -Srf "$pricefile" ;;
2) notify-send -u low "Updating..." "Updating prices" ; updateme="1" ;;
3) notify-send "Current prices:" "Current stock prices:\n<b>$(getchange)</b>
LEFT MOUSE BUTTON: show price file
MIDDLE MOUSE BUTTON: update stock prices
RIGHT MOUSE BUTTON: Get stock overview" ;;
6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
[ -n "$updateme" ] && updateprice
[ -f "$pricefile" ] && getchange
checkprice && updateprice

View File

@ -13,8 +13,18 @@ wmpid(){ # This function is needed if there are multiple instances of the window
echo "${tree%%)*}"
}
lock(){
mpc pause
pauseallmpv
wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
kill -44 $(pidof dwmblocks)
slock
wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
kill -44 $(pidof dwmblocks)
}
case "$(printf "🔒 lock\n🚪 leave $WM\n♻ renew $WM\n🐻 hibernate\n🔃 reboot\n🖥shutdown\n💤 sleep\n📺 display off" | dmenu -i -p 'Action: ')" in
'🔒 lock') slock ;;
'🔒 lock') lock ;;
"🚪 leave $WM") kill -TERM "$(wmpid)" ;;
"♻️ renew $WM") kill -HUP "$(wmpid)" ;;
'🐻 hibernate') slock $ctl hibernate -i ;;

View File

@ -1,9 +0,0 @@
#!/bin/sh
# Clears the build files of a LaTeX/XeLaTeX build.
# I have vim run this file whenever I exit a .tex file.
[ "${1##*.}" = "tex" ] && {
find "$(dirname "${1}")" -regex '.*\(_minted.*\|.*\.\(4tc\|xref\|tmp\|pyc\|pyg\|pyo\|fls\|vrb\|fdb_latexmk\|bak\|swp\|aux\|log\|synctex\(busy\)\|lof\|lot\|maf\|idx\|mtc\|mtc0\|nav\|out\|snm\|toc\|bcf\|run\.xml\|synctex\.gz\|blg\|bbl\)\)' -delete
} || printf "Provide a .tex file.\n"