init lab bin
This commit is contained in:
3
dim
Executable file
3
dim
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
sudo tee /sys/class/backlight/acpi_video0/brightness <<< $1
|
||||||
|
|
||||||
3
dimk
Executable file
3
dimk
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
sudo tee /sys/class/leds/smc::kbd_backlight/brightness <<< $1
|
||||||
|
|
||||||
3
dimr
Executable file
3
dimr
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
redshift -l 38:-122 -t 5500:3500 -g 0.8 -v
|
||||||
|
|
||||||
10
hdmi.sh
Executable file
10
hdmi.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#setup external hdmi display if connected, else ensure the display is off
|
||||||
|
intern=eDP1
|
||||||
|
extern=HDMI1
|
||||||
|
|
||||||
|
if xrandr | grep "$extern connected"; then
|
||||||
|
xrandr --output "$intern" --auto --output "$extern" --auto --right-of "$intern"
|
||||||
|
else
|
||||||
|
xrandr --output "$intern" --auto --output "$extern" --off
|
||||||
|
fi
|
||||||
9
mv2figs.sh
Executable file
9
mv2figs.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#mv2figs: used by the <cmd-z> screenshot shortcut set in .config/i3/config
|
||||||
|
|
||||||
|
#default image location
|
||||||
|
blobFolder=$HOME/figures
|
||||||
|
|
||||||
|
mv $1 $blobFolder/$1
|
||||||
|
|
||||||
|
echo "<figure><img src=\""$(basename $blobFolder)/$1"\" width=\"500px\"><figcaption></figcaption></figure>" | xclip -selection clipboard
|
||||||
41
nj
Executable file
41
nj
Executable file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
defTitle=journal
|
||||||
|
defDir=notes
|
||||||
|
defTemplate=$HOME/bin/nj-note.md
|
||||||
|
defApp=nano #nano,vim,gvim,emacs,atom,subl
|
||||||
|
|
||||||
|
title=$1
|
||||||
|
basedir=$2
|
||||||
|
mdtemplate=$3
|
||||||
|
app=$EDITOR
|
||||||
|
|
||||||
|
if [[ -z $title ]]; then
|
||||||
|
title=$defTitle
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $basedir ]]; then
|
||||||
|
basedir=$HOME/$defDir
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $mdtemplate ]]; then
|
||||||
|
mdtemplate=$defTemplate
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $app ]]; then
|
||||||
|
app=$defApp
|
||||||
|
fi
|
||||||
|
|
||||||
|
#basedir=if [[ -z $var 2:-$HOME/$defDir}
|
||||||
|
|
||||||
|
fn=$basedir/$(date +"%Y-%m-%d")-$title.md
|
||||||
|
|
||||||
|
if [[ -e $fn ]]
|
||||||
|
then
|
||||||
|
echo "opening $fn"
|
||||||
|
$app $fn
|
||||||
|
else
|
||||||
|
echo "creating $fn"
|
||||||
|
cat $mdtemplate | sed -E "s|(date: ).+|\1$(date --iso-8601='seconds') |" >> $fn
|
||||||
|
$app $fn
|
||||||
|
fi
|
||||||
|
|
||||||
8
nj-note.md
Normal file
8
nj-note.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
author: James B. Ackman
|
||||||
|
date: 2018-10-26T07:17:26-07:00
|
||||||
|
tags: journal, home
|
||||||
|
layout: post
|
||||||
|
categories: pri
|
||||||
|
---
|
||||||
|
|
||||||
135
pubmed2bibtex.xsl
Normal file
135
pubmed2bibtex.xsl
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<xsl:stylesheet version = "1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
- This Extensible Stylesheet Language Transformation file translates XML files
|
||||||
|
- as provided by PubMed into BibTeX files.
|
||||||
|
-
|
||||||
|
- This file was written by Thomas Fischer <fischer@unix-ag.uni-kl.de>
|
||||||
|
- It is released under the GNU Public License version 2 or later.
|
||||||
|
-
|
||||||
|
- To run test this transformation file, run e.g.
|
||||||
|
- wget 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=21351276&retmode=xml' -O - | xsltproc pubmed2bibtex.xsl -
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- stylesheet updated by James Ackman <james.ackman@gmail.com> 2018-11-05T22:49:52-08:00 -->
|
||||||
|
|
||||||
|
<xsl:output method="text" omit-xml-declaration="yes" indent="no" encoding="UTF-8"/>
|
||||||
|
<xsl:strip-space elements="*"/>
|
||||||
|
|
||||||
|
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
|
||||||
|
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- START HERE -->
|
||||||
|
<xsl:template match="/">
|
||||||
|
<!-- process each entry -->
|
||||||
|
<xsl:apply-templates select="PubmedArticleSet/PubmedArticle"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="PubmedArticle">
|
||||||
|
<!-- assuming that there are only journal references -->
|
||||||
|
<xsl:text>@article{</xsl:text>
|
||||||
|
<xsl:value-of select="MedlineCitation/Article/AuthorList/Author/LastName"/>
|
||||||
|
<xsl:value-of select="MedlineCitation/Article/Journal/JournalIssue/PubDate/Year"/>
|
||||||
|
<!-- <xsl:text>_</xsl:text><xsl:value-of select="MedlineCitation/PMID" /> -->
|
||||||
|
<xsl:apply-templates select="MedlineCitation/Article"/>
|
||||||
|
<xsl:apply-templates select="MedlineCitation/KeywordList"/>
|
||||||
|
<!-- <xsl:apply-templates select="MedlineCitation/MeshHeadingList"/> -->
|
||||||
|
<xsl:apply-templates select="PubmedData/ArticleIdList/ArticleId"/>
|
||||||
|
<xsl:text>,
|
||||||
|
url = {https://www.ncbi.nlm.nih.gov/pubmed/</xsl:text><xsl:value-of select="MedlineCitation/PMID"/><xsl:text>},
|
||||||
|
file = {}</xsl:text>
|
||||||
|
<xsl:if test="string-length(MedlineCitation/MedlineJournalInfo/NlmUniqueID) > 0"><xsl:text>,
|
||||||
|
nlmuniqueid = {</xsl:text><xsl:value-of select="MedlineCitation/MedlineJournalInfo/NlmUniqueID" /><xsl:text>}</xsl:text></xsl:if>
|
||||||
|
<xsl:text>
|
||||||
|
}
|
||||||
|
|
||||||
|
</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<xsl:template match="ArticleId">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="@IdType='doi'">
|
||||||
|
<xsl:text>,
|
||||||
|
doi = {</xsl:text><xsl:value-of select="." /><xsl:text>}</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>,
|
||||||
|
</xsl:text><xsl:value-of select="@IdType" /><xsl:text> = {</xsl:text><xsl:value-of select="." /><xsl:text>}</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<xsl:template match="Article">
|
||||||
|
<xsl:text>,
|
||||||
|
title = {</xsl:text><xsl:value-of select="ArticleTitle" /><xsl:text>}</xsl:text>
|
||||||
|
<xsl:apply-templates select="AuthorList" />
|
||||||
|
<xsl:apply-templates select="Journal" />
|
||||||
|
<xsl:text>,
|
||||||
|
pages = {</xsl:text><xsl:value-of select="Pagination/MedlinePgn" /><xsl:text>}</xsl:text>
|
||||||
|
<xsl:if test="string-length(Abstract/AbstractText) > 0"><xsl:text>,
|
||||||
|
abstract = {</xsl:text><xsl:value-of select="Abstract/AbstractText" /><xsl:text>}</xsl:text></xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<xsl:template match="Journal">
|
||||||
|
<!-- going for the journal title's abbreviation with MedlineTA instead of ISOAbbreviation, looks better -->
|
||||||
|
<xsl:text>,
|
||||||
|
journal = {</xsl:text><xsl:value-of select="/PubmedArticleSet/PubmedArticle/MedlineCitation/MedlineJournalInfo/MedlineTA" /><xsl:text>}</xsl:text>
|
||||||
|
<xsl:if test="string-length(JournalIssue/ISSN) > 0"><xsl:text>,
|
||||||
|
issn = {</xsl:text><xsl:value-of select="ISSN" /><xsl:text>}</xsl:text></xsl:if>
|
||||||
|
<xsl:if test="string-length(JournalIssue/Volume) > 0"><xsl:text>,
|
||||||
|
volume = {</xsl:text><xsl:value-of select="JournalIssue/Volume" /><xsl:text>}</xsl:text></xsl:if>
|
||||||
|
<xsl:if test="string-length(JournalIssue/Issue) > 0"><xsl:text>,
|
||||||
|
number = {</xsl:text><xsl:value-of select="JournalIssue/Issue" /><xsl:text>}</xsl:text></xsl:if>
|
||||||
|
<xsl:if test="string-length(JournalIssue/PubDate/Year) > 0"><xsl:text>,
|
||||||
|
year = {</xsl:text><xsl:value-of select="JournalIssue/PubDate/Year" /><xsl:text>}</xsl:text></xsl:if>
|
||||||
|
<xsl:if test="string-length(JournalIssue/PubDate/Month) > 0"><xsl:text>,
|
||||||
|
month = {</xsl:text><xsl:value-of select="JournalIssue/PubDate/Month" /><xsl:text>}</xsl:text></xsl:if>
|
||||||
|
<!-- month = {</xsl:text><xsl:value-of select="translate(JournalIssue/PubDate/Month, $uppercase, $smallcase)" /><xsl:text>}</xsl:text></xsl:if> -->
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<xsl:template match="AuthorList">
|
||||||
|
<xsl:text>,
|
||||||
|
author = {</xsl:text>
|
||||||
|
<xsl:apply-templates select="Author"/>
|
||||||
|
<xsl:if test="@CompleteYN = 'N'"><xsl:text> and others</xsl:text></xsl:if>
|
||||||
|
<xsl:text>}</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="Author">
|
||||||
|
<xsl:if test="position() > 1"><xsl:text> and </xsl:text></xsl:if>
|
||||||
|
<xsl:apply-templates select="LastName"/><xsl:text>, </xsl:text>
|
||||||
|
<xsl:apply-templates select="ForeName"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<xsl:template match="KeywordList">
|
||||||
|
<xsl:text>,
|
||||||
|
keywords = {</xsl:text>
|
||||||
|
<xsl:for-each select="Keyword">
|
||||||
|
<xsl:value-of select="."/><xsl:text>; </xsl:text>
|
||||||
|
</xsl:for-each>
|
||||||
|
<xsl:for-each select="/PubmedArticleSet/PubmedArticle/MedlineCitation/MeshHeadingList/MeshHeading">
|
||||||
|
<xsl:value-of select="DescriptorName"/><xsl:text>; </xsl:text>
|
||||||
|
</xsl:for-each>
|
||||||
|
<xsl:text>}</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<xsl:template match="MeshHeadingList">
|
||||||
|
<xsl:text>,
|
||||||
|
mesh = {</xsl:text>
|
||||||
|
<xsl:for-each select="MeshHeading">
|
||||||
|
<xsl:value-of select="DescriptorName"/><xsl:text>; </xsl:text>
|
||||||
|
</xsl:for-each>
|
||||||
|
<xsl:text>}</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
-->
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
||||||
22
reveal.sh
Executable file
22
reveal.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#installation: place in home directory and make this file executable `chmod u=rwX,go= reveal.sh`
|
||||||
|
#usage example: `./reveal.sh neuroanatomy1.md`
|
||||||
|
|
||||||
|
appPath="$HOME/projects/dev/reveal.js"
|
||||||
|
|
||||||
|
if [[ ! -d $appPath ]]; then
|
||||||
|
echo "reveal.js not found"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
cd $appPath
|
||||||
|
fi
|
||||||
|
|
||||||
|
fn=$1 #markdown document to render e.g. neuroanatomy1.md
|
||||||
|
if [[ ! -e $fn ]]; then
|
||||||
|
ln -s $fn $(basename $fn)
|
||||||
|
fi
|
||||||
|
|
||||||
|
#add markdown filename to reveal placeholder start file
|
||||||
|
sed -i -E "s|(<section data-markdown=\")[A-Za-z0-9\.-]*(\" )|\1$fn\2|" index.html
|
||||||
|
npm start
|
||||||
|
|
||||||
69
sdoi.sh
Executable file
69
sdoi.sh
Executable file
@@ -0,0 +1,69 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#sdoi - search for doi and append bibtex entry to db
|
||||||
|
# usage:
|
||||||
|
# sdoi.sh 'doi.string'
|
||||||
|
|
||||||
|
#Setup defaults
|
||||||
|
styleSheet="$HOME/bin/pubmed2bibtex.xsl"
|
||||||
|
bibdFileOut="$HOME/projects/bibd/OMEGA.bib"
|
||||||
|
pdfPathOut="$HOME/projects/bibd/papers"
|
||||||
|
relPath=$(basename $pdfPathOut)
|
||||||
|
doi=$1
|
||||||
|
fn=$2
|
||||||
|
|
||||||
|
set -e #exit if an error
|
||||||
|
|
||||||
|
uid=$(curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=$doi&field=doi&retmode=xml" | grep -E "<Id>[0-9]+</Id>" | sed -E "s#<Id>([0-9]+)</Id>#\1#")
|
||||||
|
|
||||||
|
if [ -z "$uid" ]; then
|
||||||
|
echo "pubmed id not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#request pubmed xml and transform into bibtex
|
||||||
|
curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=$uid&retmode=xml" > $uid.xml
|
||||||
|
xsltproc --novalid $styleSheet $uid.xml > $uid.bib
|
||||||
|
|
||||||
|
#decide whether to process and move an associated pdf or just exit
|
||||||
|
if [ -z "$fn" ]; then
|
||||||
|
|
||||||
|
if [[ -z $(rg $uid $bibdFileOut) ]]; then
|
||||||
|
#import bibtex
|
||||||
|
echo "importing $uid.bib"
|
||||||
|
cat $uid.bib >> $bibdFileOut
|
||||||
|
else
|
||||||
|
echo "$uid already found in $bibdFileOut, exiting"
|
||||||
|
fi
|
||||||
|
#clean up
|
||||||
|
rm $uid.xml $uid.bib
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
else
|
||||||
|
#extract some strings to make a nice filename for the pdf
|
||||||
|
key="LastName";
|
||||||
|
author=$(grep $key --max-count=1 $uid.xml | sed -E "s#\W*<$key>(.+)</$key>\W*#\1#")
|
||||||
|
|
||||||
|
key="MedlineTA";
|
||||||
|
journal=$(grep $key --max-count=1 $uid.xml | sed -E "s#\W*<$key>(.+)</$key>\W*#\1#" | tr -d " ")
|
||||||
|
|
||||||
|
key1="PubDate";
|
||||||
|
key2="Year"; year=$(awk "/<$key1>/,/<\/$key1>/" $uid.xml | grep $key2 | sed -E "s#\W*<$key2>(.+)</$key2>\W*#\1#")
|
||||||
|
|
||||||
|
fn2=${author}_${journal}$year-$uid.pdf
|
||||||
|
|
||||||
|
#move pdf file to papers repository, add file name to bibtex file field
|
||||||
|
mv $fn $pdfPathOut/$fn2
|
||||||
|
echo "moved to $pdfPathOut/$fn2"
|
||||||
|
sed -i -E "s|(\W*file = \{).*(\}.*)|\1$relPath/$fn2\2|" $uid.bib
|
||||||
|
|
||||||
|
if [[ -z $(rg $uid $bibdFileOut) ]]; then
|
||||||
|
#import bibtex
|
||||||
|
echo "importing $uid.bib"
|
||||||
|
cat $uid.bib >> $bibdFileOut
|
||||||
|
else
|
||||||
|
echo "$uid already found in $bibdFileOut, exiting"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#clean up
|
||||||
|
rm $uid.xml $uid.bib
|
||||||
|
fi
|
||||||
26
shrinkpdf.sh
Executable file
26
shrinkpdf.sh
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#shrinkpdf - resize pdf to smaller size. Warning: if no second file name is provided, the default behavior is to overwrite the original pdf
|
||||||
|
# usage:
|
||||||
|
# shrinkpdf.sh large.pdf
|
||||||
|
# shrinkpdf.sh large.pdf small.pdf
|
||||||
|
# dependencies:
|
||||||
|
# ps2pdf from Ghostscript
|
||||||
|
# mktemp from GNU Coreutils
|
||||||
|
|
||||||
|
#Setup defaults
|
||||||
|
fn=$1
|
||||||
|
fn2=$2
|
||||||
|
set -e #exit if an error
|
||||||
|
|
||||||
|
#decide whether to use a provided new file name or too write over the original filename
|
||||||
|
if [ -z "$fn2" ]; then
|
||||||
|
#clean up
|
||||||
|
tmpName=$(mktemp $fn.XXXXXXX)
|
||||||
|
ps2pdf $fn $tmpName
|
||||||
|
#echo $tmpName
|
||||||
|
rm $fn
|
||||||
|
mv $tmpName $fn
|
||||||
|
chmod u=rw,go=r $fn
|
||||||
|
else
|
||||||
|
ps2pdf $fn $fn2
|
||||||
|
fi
|
||||||
54
spmid.sh
Executable file
54
spmid.sh
Executable file
@@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#spmid - search for pubmed id and append bibtex entry to db
|
||||||
|
# usage:
|
||||||
|
# spmid.sh '12345678'
|
||||||
|
# spmid.sh '12345678' download.pdf
|
||||||
|
|
||||||
|
#Setup defaults
|
||||||
|
styleSheet="$HOME/bin/pubmed2bibtex.xsl"
|
||||||
|
bibdFileOut="$HOME/projects/bibd/OMEGA.bib"
|
||||||
|
pdfPathOut="$HOME/projects/bibd/papers"
|
||||||
|
relPath=$(basename $pdfPathOut)
|
||||||
|
uid=$1
|
||||||
|
fn=$2
|
||||||
|
|
||||||
|
set -e #exit if an error
|
||||||
|
|
||||||
|
#request pubmed xml and transform into bibtex
|
||||||
|
curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=$uid&retmode=xml" > $uid.xml
|
||||||
|
xsltproc --novalid $styleSheet $uid.xml > $uid.bib
|
||||||
|
|
||||||
|
#decide whether to process and move an associated pdf or just exit
|
||||||
|
if [ -z "$fn" ]; then
|
||||||
|
#clean up
|
||||||
|
rm $uid.xml $uid.bib
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
#extract some strings to make a nice filename for the pdf
|
||||||
|
key="LastName";
|
||||||
|
author=$(grep $key --max-count=1 $uid.xml | sed -E "s#\W*<$key>(.+)</$key>\W*#\1#")
|
||||||
|
|
||||||
|
key="MedlineTA";
|
||||||
|
journal=$(grep $key --max-count=1 $uid.xml | sed -E "s#\W*<$key>(.+)</$key>\W*#\1#" | tr -d " ")
|
||||||
|
|
||||||
|
key1="PubDate";
|
||||||
|
key2="Year"; year=$(awk "/<$key1>/,/<\/$key1>/" $uid.xml | grep $key2 | sed -E "s#\W*<$key2>(.+)</$key2>\W*#\1#")
|
||||||
|
|
||||||
|
fn2=${author}_${journal}$year-$uid.pdf
|
||||||
|
|
||||||
|
#move pdf file to papers repository, add file name to bibtex file field
|
||||||
|
mv $fn $pdfPathOut/$fn2
|
||||||
|
echo "moved to $pdfPathOut/$fn2"
|
||||||
|
sed -i -E "s|(\W*file = \{).*(\}.*)|\1$relPath/$fn2\2|" $uid.bib
|
||||||
|
|
||||||
|
if [[ -z $(rg $uid $bibdFileOut) ]]; then
|
||||||
|
#import bibtex
|
||||||
|
echo "importing $uid.bib"
|
||||||
|
cat $uid.bib >> $bibdFileOut
|
||||||
|
else
|
||||||
|
echo "$uid already found in $bibdFileOut, exiting"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#clean up
|
||||||
|
rm $uid.xml $uid.bib
|
||||||
|
fi
|
||||||
44
spubmed.sh
Executable file
44
spubmed.sh
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#spubmed.sh - search for pubmed for author, journal, year
|
||||||
|
# usage:
|
||||||
|
# spubmed.sh 'kaas' 'trends+neurosci' '1995'
|
||||||
|
# spubmed.sh 'rakic' 'j+comp+neurol' '1972'
|
||||||
|
|
||||||
|
#Setup defaults
|
||||||
|
styleSheet="$HOME/bin/pubmed2bibtex.xsl"
|
||||||
|
bibdFileOut="$HOME/projects/bibd/OMEGA.bib"
|
||||||
|
pdfPathOut="$HOME/projects/bibd/papers"
|
||||||
|
relPath=$(basename $pdfPathOut)
|
||||||
|
author=$1
|
||||||
|
journal=$2
|
||||||
|
year=$3
|
||||||
|
|
||||||
|
set -e #exit if an error
|
||||||
|
|
||||||
|
uid=$(curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=$author[au]+AND+$journal[ta]+AND+$year[dp]&retmode=xml" | grep -E "<Id>[0-9]+</Id>" | sed -E "s#<Id>([0-9]+)</Id>#\1#")
|
||||||
|
|
||||||
|
if [ -z "$uid" ]; then
|
||||||
|
echo "pubmed id not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $(echo $uid | wc -w) -gt 1 ]]; then
|
||||||
|
echo 'more than one pmid found, going to pubmed'
|
||||||
|
exturl="https://www.ncbi.nlm.nih.gov/pubmed/?term=$author[au]+AND+$journal[ta]+AND+$year[dp]"
|
||||||
|
xdg-open $exturl
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $uid | xclip -selection clipboard
|
||||||
|
echo $uid
|
||||||
|
|
||||||
|
# #request pubmed xml and transform into bibtex
|
||||||
|
# curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=$uid&retmode=xml" > $uid.xml
|
||||||
|
# xsltproc --novalid $styleSheet $uid.xml > $uid.bib
|
||||||
|
#
|
||||||
|
# #import bibtex
|
||||||
|
# echo "importing $uid.bib"
|
||||||
|
# cat $uid.bib >> $bibdFileOut
|
||||||
|
#
|
||||||
|
# #clean up
|
||||||
|
# rm $uid.xml $uid.bib
|
||||||
22
woola
Executable file
22
woola
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#helper startup script for woola
|
||||||
|
appPath="$HOME/projects/dev/woola"
|
||||||
|
configFile=$HOME/.config/woola/config.js
|
||||||
|
|
||||||
|
if [[ -e $configFile ]] && [[ ! -e config.js ]]; then
|
||||||
|
ln -s $configFile config.js
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -d css ]]; then
|
||||||
|
ln -s $HOME/projects/dev/libcss css
|
||||||
|
fi
|
||||||
|
|
||||||
|
#if [[ ! -d js ]]; then
|
||||||
|
# ln -s $appPath/js js
|
||||||
|
#fi
|
||||||
|
|
||||||
|
#if [[ ! -d figures ]]; then
|
||||||
|
# ln -s $HOME/figures figures
|
||||||
|
#fi
|
||||||
|
node $appPath/lib/index.js
|
||||||
|
|
||||||
Reference in New Issue
Block a user