camping summer

This commit is contained in:
ackman678
2021-09-18 15:46:10 -07:00
parent 3cb839de7a
commit 2c2f3bdf77
6 changed files with 17 additions and 37 deletions

View File

@@ -5,11 +5,13 @@
BATTERY=/sys/class/power_supply/BAT0
REM=`grep "POWER_SUPPLY_CHARGE_NOW" $BATTERY/uevent | awk -F= '{ print $2 }'`
FULL=`grep "POWER_SUPPLY_CHARGE_FULL_DESIGN" $BATTERY/uevent | awk -F= '{ print $2 }'`
# REM=`grep "POWER_SUPPLY_CHARGE_NOW" $BATTERY/uevent | awk -F= '{ print $2 }'`
# FULL=`grep "POWER_SUPPLY_CHARGE_FULL_DESIGN" $BATTERY/uevent | awk -F= '{ print $2 }'`
REM=`grep -i "charge_now" $BATTERY/uevent | awk -F= '{ print $2 }'`
FULL=`grep -i "charge_full_design" $BATTERY/uevent | awk -F= '{ print $2 }'`
PERCENT=`echo $(( $REM * 100 / $FULL ))`
if [ $PERCENT -le "33" ]; then
if [ $PERCENT -le "11" ]; then
#/usr/bin/i3-nagbar -m "Low battery"
#echo 'low battery '$PERCENT
notify-send --urgency=critical "Low battery $PERCENT%"

1
sbib
View File

@@ -22,6 +22,7 @@ if [ "$1" == "-h" ] ; then
zathura (or other fast pdf viewer)
echo
wl-copy
jq
defaults:
Set the required default file locations (csl file, bib file)

12
sdoi.sh
View File

@@ -8,7 +8,7 @@ if [ "$1" == "-h" ] ; then
sdoi.sh 'doi' download.pdf
depends:
xsltproc - xml processor, from GNOME project
xsltproc, xmllint - xml processing programs from libxml
pubmed2bibtex.xsl - xml processor stylesheet
defaults:
@@ -57,14 +57,13 @@ fetchBib_doiDotOrg() {
extract_name() {
#extract some strings to make a nice filename for the pdf
key="LastName";
author=$(grep $key --max-count=1 $tmpBib.xml | sed -E "s|\W*<$key>(.+)</$key>\W*|\1|" | tr -d " ")
author=$(xmllint --xpath "string(//$key)" $tmpBib.xml)
key="MedlineTA";
journal=$(grep $key --max-count=1 $tmpBib.xml | sed -E "s|\W*<$key>(.+)</$key>\W*|\1|" | tr -d " ")
key1="PubDate";
key2="Year"; year=$(awk "/<$key1>/,/<\/$key1>/" $tmpBib.xml | grep $key2 | sed -E "s|\W*<$key2>(.+)</$key2>\W*|\1|")
journal=$(xmllint --xpath "string(//$key)" $tmpBib.xml)
key="Year";
year=$(xmllint --xpath "string(//$key)" $tmpBib.xml)
}
append_bibfile() {
@@ -81,6 +80,7 @@ append_bibfile() {
append_pdf() {
fn2=${author}_${journal}$year-$uid.pdf
echo $fn2
#move pdf file to papers repository, add file name to bibtex url field
mv $fn $pdfPathOut/$fn2
echo "moved to $pdfPathOut/$fn2"

14
spdf.sh
View File

@@ -8,7 +8,7 @@ if [ "$1" == "-h" ] ; then
depends:
pdftotext - from ghostscript or poppler or texlive ?
xsltproc - xml processor, from GNOME project
xsltproc, xmllint - xml programs from libxml
pubmed2bibtex.xsl - xml processor stylesheet
defaults:
@@ -26,26 +26,14 @@ fn=$1
#try to extract doi from pdf and retrieve a pubmed id
#for 'DOI:' syntax
# doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -i "doi:" --max-count=1 | tr [:upper:] [:lower:] | sed -E "s|doi:(.+)|\1|")
# search for doi string between first page last page 10
doi=$(pdftotext -q -f 1 -l 10 $fn - | grep -iE "doi:? ?/?10\." --max-count=1 | tr [:upper:] [:lower:] | sed -E "s|.*doi:? ?/?(10.+)|\1|")
#for 'https://doi.org' syntax
if [ -z "$doi" ]; then
doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -iE "doi\.org/10\." --max-count=1 | tr [:upper:] [:lower:] | sed -E "s|.+doi\.org/(10.+)|\1|")
fi
# for 'https://doi.org' syntax
# if [ -z "$doi" ]; then
# doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -i "doi.org/" --max-count=1 | tr [:upper:] [:lower:] | sed -E "s|.+doi\.org\/(.+)|\1|")
# fi
#
# if [ -z "$doi" ]; then
# doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -iE "doi ?" --max-count=1 | tr [:upper:] [:lower:] | sed -E "s|doi ?(.+)|\1|")
# fi
if [ -z "$doi" ]; then
echo "doi not found"
exit 1

View File

@@ -6,9 +6,6 @@ if [ "$1" == "-h" ] ; then
spmid.sh '12345678'
spmid.sh '12345678' download.pdf
depends:
sdoi.sh
"
exit 0
fi
@@ -55,14 +52,13 @@ fetchBib_doiDotOrg() {
extract_name() {
#extract some strings to make a nice filename for the pdf
key="LastName";
author=$(grep $key --max-count=1 $tmpBib.xml | sed -E "s|\W*<$key>(.+)</$key>\W*|\1|" | tr -d " ")
author=$(xmllint --xpath "string(//$key)" $tmpBib.xml)
key="MedlineTA";
journal=$(grep $key --max-count=1 $tmpBib.xml | sed -E "s|\W*<$key>(.+)</$key>\W*|\1|" | tr -d " ")
key1="PubDate";
key2="Year"; year=$(awk "/<$key1>/,/<\/$key1>/" $tmpBib.xml | grep $key2 | sed -E "s|\W*<$key2>(.+)</$key2>\W*|\1|")
journal=$(xmllint --xpath "string(//$key)" $tmpBib.xml)
key="Year";
year=$(xmllint --xpath "string(//$key)" $tmpBib.xml)
}
append_bibfile() {

View File

@@ -7,13 +7,6 @@ if [ "$1" == "-h" ] ; then
spubmed.sh 'kaas' 'trends+neurosci' '1995'
spubmed.sh 'rakic' 'j+comp+neurol' '1972'
depends:
xsltproc - xml processor, from GNOME project
pubmed2bibtex.xsl - xml processor stylesheet
defaults:
Set the three required default file locations (xsl file, bib file, pdf directory)
"
exit 0
fi