504 Commits

Author SHA1 Message Date
Emre AKYÜZ
8b4e8f59bb
Update getbib 2023-05-01 11:24:00 +03:00
Emre AKYÜZ
62e2856882
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.
2023-04-26 09:48:08 +03:00
Luke Smith
77fd62b9f3
Merge branch 'master' of github.com:LukeSmithxyz/voidrice 2023-04-20 09:21:17 -04:00
Luke Smith
65378ab944
sb-price improvements 2023-04-20 08:48:34 -04:00
Luke Smith
b719590427
use built-ins, close #1297 2023-04-20 08:47:39 -04:00
snailed
d4ff2ebaf3
fix shellcheck (#1301)
Shellcheck wines when printf doesn't get an argument
2023-04-12 12:11:29 +00:00
RealAestan
a94ee62680
dmenuunicode: don't use variables in the printf format string (#1284)
It works but the good practice is to use `printf "..%s.." "$foo"`
see https://www.shellcheck.net/wiki/SC2059
2023-04-03 14:07:54 +00:00
Luke Smith
5a6c56d565
efficiency and fail tweaks 2023-03-31 09:44:59 -04:00
Luke Smith
fd964d54b6
customizable wttr/rate urls, sb-price improvements 2023-03-20 09:50:18 -04:00
Luke Smith
37930fdf57
use stig over tremc by default 2023-03-01 13:38:22 -05:00
appeasementPolitik
2e5226545b
maimpick: hide cursor when selecting area (#1282)
Normally when making a screenshot of an area there's still a bit of the cursor that can be seen, this hides it.
2023-02-22 22:21:55 +00:00
Luke Smith
d292d927f1
use android name in fsname 2023-02-21 10:27:08 -05:00
iStagnant
89f8506d85 Made mounter not show already mounted android devices in the mounting prompt 2023-02-20 23:16:20 +02:00
Jameson
27c00576c2
update tutorialvids (#1276)
remove duplicate status bar and align
2023-02-20 12:01:52 +00:00
Luke Smith
762eadd9d1
fix #1275 2023-02-17 12:12:10 -05:00
Luke Smith
ad6ecdb3fc
Merge branch 'master' of github.com:LukeSmithxyz/voidrice 2023-02-17 11:01:19 -05:00
Luke Smith
b04d4c9ac8
mounter improvements, old scripts removed
now checks fstab for info, also one less android prompt
2023-02-17 11:01:07 -05:00
sudo-Tiz
8dce96b986
add dwmblock tutorial video to tutorialvids script (#1274) 2023-02-17 15:32:44 +00:00
Luke Smith
185ac25e52
mount drives with user's ownership 2023-02-17 10:17:35 -05:00
Stagnant
335c1bc8af
Fixed android device not mounting to root owned directories (#1273) 2023-02-17 14:31:44 +00:00
Luke Smith
12167f3dda
fix #1268, use sudo -A, var rename 2023-02-13 08:12:40 -05:00
Luke Smith
de4b34cd32
read file only once 2023-02-12 09:00:23 -05:00
HelionSmoker
d8f386d512
Switch to kebab-case for file name 2023-02-12 13:33:34 +02:00
HelionSmoker
fe198c960f
Rewrite sb-forecast 2023-02-12 12:24:10 +02:00
Luke Smith
88477d8497
use bash procsub 2023-02-09 11:52:47 -05:00
Luca Bilke
457539c043 remove complexity 2023-02-09 17:11:16 +01:00
Luca Bilke
ec1914e0b9 fix broken trap 2023-02-09 15:39:31 +01:00
snailed
cc53f7be1c
Clean up remapd
I found a much better way of doing this, without a potentially too short sleep. This script waits for an input to be added, and then waits for a usb device to be bound. The remaps script can be run as soon as the USB device is bound. These changes should improve the reliability of the script and maybe even decrease latency.
2023-02-09 09:23:22 +00:00
HelionSmoker
54c46c523b
Shortcuts: show almost-all files (#1263) 2023-02-08 20:07:47 +00:00
Luke Smith
b35102679a
actually make the script a script 2023-02-08 13:35:57 -05:00
Luke Smith
6d75bbdf8c
remaps run by remapd automatically on startup 2023-02-06 20:45:11 -05:00
Luke Smith
136456e4fa
add comment, remove remaps from displayselect 2023-02-06 18:19:09 -05:00
Luke Smith
37d26eccd8
Merge branch 'master' of https://github.com/ssnailed/voidrice into ssnailed-master 2023-02-06 18:11:39 -05:00
Luke Smith
624effaa18
Merge branch 'master' of github.com:LukeSmithxyz/voidrice 2023-02-06 17:05:32 -05:00
Luke Smith
98ea4e0080
fix #1260, more principled volume format 2023-02-06 17:05:16 -05:00
snailed
53a66c6254
Create remapd
This script will automatically run remaps when it detects a line in dmesg that contains "input:"
2023-02-06 21:15:02 +00:00
PrivateLalle
81456798ae
Fix mouse issue in firefox, add avif icon and add DK & SE to dopplar (#1259)
* Fix mouse issue in firefox, add avif icon and add DK & SE to dopplar

* Update sb-doppler

* Scandinavian countries listed

---------

Co-authored-by: Victor Risgaard <victor@risgaard.xyz>
2023-02-06 18:28:08 +00:00
Luke Smith
070c613050
silent if file absent 2023-02-02 14:15:32 -05:00
Luke Smith
c923467663
add arkenfox updater wrapper 2023-02-02 12:05:33 -05:00
Luke Smith
9c74ccb955 reduce find depth for speed. shellcheck. 2023-01-28 12:03:25 -05:00
appeasementPolitik
96f65d12de
Don't stop mounter script on ls error (#1255)
* Don't stop mounter script on ls error

If no decrypted LUKS drives are found, the script errors with `ls: cannot access '/dev/disk/by-id/dm-uuid-CRYPT-LUKS2-*': No such file or directory` and stops, this makes sure the error doesn't stop the script.

* True was on wrong line
2023-01-28 15:25:47 +00:00
Sergei Kozyrev
f5ac77e719
check if kb_choice is empty in sb-kbselect (#1243) 2023-01-28 00:06:49 +00:00
Luke Smith
2ca01a2886 usb/android/luks (un)mount scripts
to replace dmenumount and dmenuumount
2023-01-27 17:32:33 -05:00
Rokosun
1ccf88c099
Various bug fixes and improvements for sd script
* Programs that show ~/ or / instead of the actual working directory are now ignored by the script (except for zsh & lf where its correct). This will fix bugs where sd opens your home folder instead of the current working directory.
* This also removes the need for manually excluding all programs that don't show the correct cwd.
* git (and its sub-processes) will show the root of a repository instead of the actual cwd, so they're ignored too.
2023-01-20 19:44:36 +00:00
Luke Smith
c8aa0495eb record script changes 2023-01-15 08:30:21 -05:00
Luke Smith
9385a569fe Merge branch 'master' of github.com:LukeSmithxyz/voidrice 2023-01-15 08:23:54 -05:00
Luke Smith
5c52bd6339 tweaks 2023-01-15 08:23:06 -05:00
Jameson
5c262da7c3
Fix markdown compiling (#1247) 2023-01-15 05:27:46 +00:00
Jameson
588aeb9a1e
Use wpctl to change volume (#1248) 2023-01-15 05:26:57 +00:00
Luke Smith
fa600f8ca7 fix #1233 and improve and cleanup mount scripts 2022-11-16 11:56:11 -05:00