tCopy blog posts to plain text - adamsgaard.dk - my academic webpage | |
git clone git://src.adamsgaard.dk/adamsgaard.dk | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 39b67632c08b13f1b892ec47b8d4dae9de55497b | |
parent 82efdb7738215834fcabf6ea0b13c73521f117b7 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Mon, 24 Feb 2020 13:47:16 +0100 | |
Copy blog posts to plain text | |
Diffstat: | |
M Makefile | 18 ++++++++++++++++++ | |
M common/pagebegin.html | 1 + | |
R pages/ideas.txt -> ideas.txt | 0 | |
A pages/001-new-homepage.txt | 43 ++++++++++++++++++++++++++++++ | |
A pages/002-scholarref.txt | 227 +++++++++++++++++++++++++++++… | |
M pages/003-changelog.html | 2 -- | |
A pages/003-changelog.txt | 16 ++++++++++++++++ | |
M templates/contact.gph/header.gph | 2 +- | |
M templates/index.gph/footer.gph | 2 +- | |
M templates/index.gph/header.gph | 6 +++--- | |
M templates/index.gph/item.gph | 2 +- | |
A templates/media.gph/footer.gph | 0 | |
A templates/media.gph/header.gph | 52 +++++++++++++++++++++++++++++… | |
A templates/media.gph/item.gph | 0 | |
14 files changed, 363 insertions(+), 8 deletions(-) | |
--- | |
diff --git a/Makefile b/Makefile | |
t@@ -2,20 +2,38 @@ default: generate | |
output = output/ | |
+# w3m -dump -T text/html | |
generate: | |
mkdir -p $(output) | |
saait `ls -1r pages/*.cfg` | |
+ for f in pages/[0-9][0-9][0-9]*.txt; do \ | |
+ title="$$(sed -n 's/^title.*=//p' "$${f%%.txt}.cfg")"; \ | |
+ out="$$(printf '%s' "$$f" | sed 's/[0-9][0-9][0-9]-//')"; \ | |
+ out="$(output)$${out##pages}"; \ | |
+ printf '--- %s ---\n\n' "$$title" > "$$out"; \ | |
+ cat "$$f" >> "$$out"; \ | |
+ done | |
+ sed -i 's,|\([A-Za-z-]*\)\.html|server|port,|/\1.txt|server|port,' $(o… | |
cp style.css print.css $(output)/ | |
view: | |
$(BROWSER) $(output)/index.html | |
+converthtml: | |
+ for f in pages/*.html; do \ | |
+ title="$$(sed -n 's/^title.*=//p' "$${f%%.html}.cfg")"; \ | |
+ out="$$(printf '%s' "$$f" | sed 's/[0-9][0-9][0-9]-//;s/\.html… | |
+ printf '--- %s ---\n\n' "$$title" > "$$out"; \ | |
+ w3m -dump -T text/html -o display_link_number=1 "$$f" >> "$$ou… | |
+ done | |
+ | |
deploy: generate | |
rsync -rav --progress \ | |
papers video img $(output)/ \ | |
adamsgaard.dk:/var/www/domains/adamsgaard.dk/ | |
rsync -rav --progress \ | |
$(output)/ \ | |
+ pages/*.txt \ | |
adamsgaard.dk:/var/gopher/ | |
clean: | |
diff --git a/common/pagebegin.html b/common/pagebegin.html | |
t@@ -42,6 +42,7 @@ | |
<a href="https://src.adamsgaard.dk" title="Sof… | |
<a href="https://andersdamsgaard.com" title="P… | |
<a href="files/" title="Public files" class="b… | |
+ <a href="gopher://adamsgaard.dk" title="Gopher… | |
</td> | |
</tr> | |
</table> | |
diff --git a/pages/ideas.txt b/ideas.txt | |
diff --git a/pages/001-new-homepage.txt b/pages/001-new-homepage.txt | |
t@@ -0,0 +1,43 @@ | |
+I have had my own webpage since 2002 (a-d-c.dk, cs.au.dk/~adc, | |
+adamsgaard.dk). I use a webpage as a place to keep my contact | |
+information, software, notes, and research. The previous iteration | |
+was inspired by the 2015 April 1st retro-version of of gentoo.org, | |
+bringing back memories of the computing of yesteryear. | |
+ | |
+The previous backend was a Debian GNU/Linux virtual machine, first | |
+running at home and then in the cloud. It dynamically served the | |
+pages with Apache and PHP. However, PHP is notoriously insecure, | |
+as evident by the extensive list of vulnerabilities[0]. Apache | |
+is not much better[1]. | |
+ | |
+This weekend I finally made the long-overdue transition to a static | |
+web page, which improves security and performance. The backend is | |
+an OpenBSD instance at a cloud provider. There's a plethora of | |
+free static hosting providers available, but I prefer running and | |
+maintaining a server myself. The SSL certificate is provided by | |
+Let's Encrypt. The html front end is generated using Hiltjo | |
+Posthuma's saait[2] and stagit[3]. | |
+ | |
+I am keeping the retro theme, but all CSS is reduced to a bare | |
+minimum. The page is entirely free of cookies, javascript, and | |
+tracking. It is also 100% compatible with terminal browsers. | |
+ | |
+I moved all of my personal software projects to my own git server | |
+at https://src.adamsgaard.dk. I do not trust corporations like | |
+Github (Microsoft), Gitlab, Sourceforce, etc., to always act in the | |
+users' best interest. However, for the time being I will continue | |
+to contribute to other software projects on these platforms.</p> | |
+My git server has a web interface which provides an overview of | |
+projects, commits, and files. Git access is possible through the | |
+git (read only), and ssh (r/w) protocols. | |
+ | |
+Please let me know if you encounter any problems with the new | |
+infrastructure. | |
+ | |
+ | |
+References: | |
+ | |
+[0] https://www.cvedetails.com/vulnerability-list.php?vendor_id=74&product_id=… | |
+[1] https://www.cvedetails.com/vulnerability-list/vendor_id-45/Apache.html | |
+[2] https://git.codemadness.nl/saait | |
+[3] https://git.codemadness.nl/stagit | |
diff --git a/pages/002-scholarref.txt b/pages/002-scholarref.txt | |
t@@ -0,0 +1,227 @@ | |
+-- Rationale -- | |
+During the writing phase of an academic paper, common tasks include | |
+downloading PDFs of publications and getting their references into | |
+your bibliography. However, I am not a fan of navigating the slow, | |
+bloated, tracker-filled, and distracting webpages of academic | |
+journals and publication aggregators. For some reason, many | |
+publishers decided that clicking the "Download PDF" link should | |
+redirect the user to an unusable in-browser PDF viewer instead of | |
+providing the PDF file directly. While the majority of journal | |
+webpages provide formatted citations for their publications, these | |
+are inconsistent in style and content. | |
+ | |
+For these reasons, I constructed a set of shell tools called | |
+"scholarref" that allow me to perform most of the tasks without | |
+having to open a web browser. As the title of this post indicates, | |
+the goal of the toolset is to provide as much functionality a person | |
+might need during scientific writing without leaving the command | |
+line. The tools are under continuous development[0]. At present | |
+I avoid roughly 90% of visits to journal webpages. I hope to get | |
+to 100% someday. | |
+ | |
+The "scholarref" design goals are the following: | |
+ | |
+ - Written as POSIX shell scripts with minimal external | |
+ dependencies: Ensures maximum flexibility and portability. | |
+ | |
+ - Aim for simplicity: | |
+ Fewer lines of code make the programs easier to understand, | |
+ maintain, and debug. | |
+ | |
+ - Each tool should do one thing, and do it well: | |
+ Let the users piece the components together to fit their | |
+ workflow. | |
+ | |
+ - Return references in BibTeX format. | |
+ | |
+DISCLAIMER: The functionality provided by these programs depends | |
+on communication with third party webpages, which may or may not | |
+be permitted by law and the terms of service upheld by the third | |
+parties. What is demonstrated here are examples only. Use of the | |
+tools is entirely your own responsibility. | |
+ | |
+ | |
+-- Installation -- | |
+ | |
+ $ git clone git://src.adamsgaard.dk/scholarref | |
+ $ cd scholarref | |
+ # make install | |
+ | |
+The `make install` command may require superuser priviledges to | |
+install the tools to /usr/local. Prefix with doas(1) or sudo(1), | |
+whatever is appropriate for the target system. | |
+ | |
+ | |
+-- The scholarref toolset -- | |
+ | |
+The core functionality is provided by the scripts getdoi, getref, | |
+and shdl. All programs accept input as command-line arguments or | |
+from standard input (stdin). The programs come with several OPTIONS, | |
+and it is encouraged to explore the help text (invoke with option | |
+-h). The -t option may be of particular interest, since it tunnels | |
+all communication through Tor via torsocks(1) (if available on the | |
+system). | |
+ | |
+- getdoi - | |
+This tool accepts either names of PDF files or arbitrary search | |
+queries. If a PDF file name is supplied, getdoi scans the PDF text | |
+in order to find the first occuring DOI entry, which typically is | |
+the DOI of the publication itself. If an arbitrary query is supplied, | |
+the CrossRef API[1] is used to find the DOI of the closest publication | |
+match. You can supply author names, parts of the title, ORCID, | |
+journal name, etc. Examples: | |
+ | |
+ $ getdoi damsgaard2018.pdf | |
+ 10.1029/2018ms001299 | |
+ $ getdoi 'damsgaard sergienko adcroft advances modeling earth systems' | |
+ 10.1029/2018ms001299 | |
+ | |
+The -o option will open the resultant DOI in the system web browser. | |
+ | |
+- getref - | |
+The getref tool fetches the BibTeX citation for a given DOI from | |
+doi.org. By default, the journal names and author first names are | |
+abbreviated, which is what most journals want. I have taken | |
+abbreviations from the Caltech Library list of Journal Title | |
+Abbreviations[2]. The getref ruleset of journal-title abbreviations | |
+is incomplete, and is expanded on a per-need basis. If desired, | |
+the abbreviation functionality can be disabled. See `getref -h` | |
+for details. | |
+ | |
+ $ getref 10.1029/2018ms001299 | |
+ @article{Damsgaard2018, | |
+ doi = {10.1029/2018ms001299}, | |
+ year = 2018, | |
+ publisher = {American Geophysical Union ({AGU})}, | |
+ volume = {10}, | |
+ number = {9}, | |
+ pages = {2228--2244}, | |
+ author = {A. Damsgaard and A. Adcroft and O. Sergienko}, | |
+ title = {Application of Discrete Element Methods to Approximat… | |
+ journal = {J. Adv. Mod. Earth Sys.} | |
+ } | |
+ | |
+Do not abbreviate journal title with -j option: | |
+ | |
+ $ getref -j 10.1029/2018ms001299 | |
+ @article{Damsgaard2018, | |
+ doi = {10.1029/2018ms001299}, | |
+ year = 2018, | |
+ publisher = {American Geophysical Union ({AGU})}, | |
+ volume = {10}, | |
+ number = {9}, | |
+ pages = {2228--2244}, | |
+ author = {A. Damsgaard and A. Adcroft and O. Sergienko}, | |
+ title = {Application of Discrete Element Methods to Approximat… | |
+ journal = {Journal of Advances in Modeling Earth Systems} | |
+ } | |
+ | |
+ | |
+- shdl - | |
+This tool takes a DOI as input and attempts to download the | |
+corresponding publication as a PDF through sci-hub[3]. Unfortunately, | |
+the sci-hub web interface often puts up captias to restrict automated | |
+downloads. If that's the case, shdl opens the tor browser (if | |
+installed) or the system web browser in order to manually complete | |
+the download. Output PDF files are saved in the present working | |
+directory. | |
+ | |
+ | |
+-- Usage examples -- | |
+ | |
+The scholarref tools are meant to be chained together. For example, | |
+if you want a BibTeX reference a search query, simply use UNIX pipes | |
+to send the getdoi output as input to getref: | |
+ | |
+ $ getdoi 'damsgaard egholm ice flow dynamics' | getref | |
+ @article{Damsgaard2016, | |
+ doi = {10.1002/2016gl071579}, | |
+ year = 2016, | |
+ publisher = {American Geophysical Union ({AGU})}, | |
+ volume = {43}, | |
+ number = {23}, | |
+ pages = {12,165--12,173}, | |
+ author = {A. Damsgaard and D. L. Egholm and L. H. Beem and S. … | |
+ title = {Ice flow dynamics forced by water pressure variations… | |
+ journal = {Geophys. Res. Lett.} | |
+ } | |
+ | |
+The scholarref program itself is an aggregation of the getdoi and | |
+getref commands. If called with the -a option, the reference is | |
+directly inserted into the system bibliography. The full path to | |
+the bibliography file (.bib) is assumed to be set in the $BIB | |
+environment variable, for instance defined in the user ~/.profile. | |
+ | |
+ $ echo $BIB | |
+ /home/ad/articles/own/BIBnew.bib | |
+ $ scholarref -a 'damsgaard egholm ice flow dynamics' | |
+ Citation Damsgaard2016 added to /home/ad/articles/own/BIBnew.bib | |
+ | |
+ | |
+-- Integrating into your favorite $EDITOR -- | |
+ | |
+The scholarref tool is particularly useful if called from within a | |
+text editor. Below I demonstrate how keyboard bindings can be bound | |
+in various editors to provide scholarref functionality. | |
+ | |
+- vi - | |
+My editor of choice is the plain, old, and simple (n)vi(1). I have | |
+the following binding in my ~/.exrc, including a trailing space: | |
+ | |
+ map qr :r !scholarref | |
+ | |
+The rest of my editor configuration can be found under my dotfiles | |
+source code repository[4]. | |
+ | |
+- vim - | |
+You can add the following bindings to ~/.vimrc or ~/.vim/vimrc in | |
+order to get scholarref functionality within vim(1): | |
+ | |
+ " insert reference into current buffer | |
+ nnoremap <leader>r :r !scholarref<space> | |
+ " append reference into $BIB file | |
+ nnoremap <leader>R :r !scholarref --add<space> | |
+ | |
+- vis - | |
+The vis(1) editor[5] is an interesting combination of modal editing | |
+and structural regular expressions from the plan9 editor sam(1)[6]. | |
+Add the following binding to ~/.config/vis/visrc.lua: | |
+ | |
+ vis:map(vis.modes.NORMAL, leader..'r', '< scholarref ') | |
+ | |
+- emacs - | |
+Don't know, figure it out yourself. | |
+ | |
+ | |
+-- Integrating into your pdf viewer -- | |
+ | |
+My PDF viewer of choice is zathura(1)[7], which has a minimal | |
+graphical user interface and is keyboard-centric. The following | |
+configuration calls getdoi on the currently open file if I press | |
+Ctrl-i. The resultant DOI is copied to the clipboard. Similarly, | |
+Ctrl-s tries to extract the DOI in the same manner, but fetches the | |
+accompanying reference and adds it directly to the bibliography. | |
+ | |
+ map <C-i> feedkeys ":exec getdoi --notify --clip '$FILE'<Return>" | |
+ map <C-s> feedkeys ":exec scholarref --add '$FILE'<Return>" | |
+ | |
+My full zathura configuration is available here: [8] | |
+ | |
+ | |
+-- Questions/bugs/feedback/improvements -- | |
+ | |
+Please get in touch if you encounter any. Improvement suggestions | |
+are best sent as patches by e-mail. | |
+ | |
+ | |
+References: | |
+ | |
+[0] https://src.adamsgaard.dk/scholarref/log.html | |
+[1] http://api.crossref.org | |
+[2] https://www.library.caltech.edu/journal-title-abbreviations | |
+[3] https://sci-hub.tw | |
+[4] https://src.adamsgaard.dk/dotfiles/file/.exrc.html | |
+[5] https://github.com/martanne/vis | |
+[6] https://sam.cat-v.org/ | |
+[7] https://pwmt.org/projects/zathura | |
+[8] https://src.adamsgaard.dk/dotfiles/file/.config/zathura/zathurarc.html | |
diff --git a/pages/003-changelog.html b/pages/003-changelog.html | |
t@@ -1,5 +1,3 @@ | |
-<h2>Appearance on The Changelog</h2> | |
- | |
<p>I recently had the chance to talk with | |
<a href="https://adamstacoviak.com/">Adam Stacoviak</a> and | |
<a href="https://twitter.com/jerodsanto">Jerod Santo</a> on their tech | |
diff --git a/pages/003-changelog.txt b/pages/003-changelog.txt | |
t@@ -0,0 +1,16 @@ | |
+I recently had the chance to talk with Adam Stacoviak[1] and Jerod | |
+Santo[2] on their tech podcast The Changelog"[3]. We discussed how | |
+open source software plays an important role in climate science, | |
+my scholarref[4] tools, and my (un)healthy scepticism of Github | |
+and social networks. | |
+ | |
+Listen here... [5] | |
+ | |
+ | |
+References: | |
+ | |
+[1] https://adamstacoviak.com/ | |
+[2] https://twitter.com/jerodsanto | |
+[3] https://changelog.com/podcast | |
+[4] file:///home/ad/code/adamsgaard.dk/pages/scholarref.html | |
+[5] https://changelog.com/podcast/378 | |
diff --git a/templates/contact.gph/header.gph b/templates/contact.gph/header.gph | |
t@@ -1,4 +1,4 @@ | |
-CONTACT | |
+--- Contact --- | |
Anders Damsgaard | |
[email protected] | |
diff --git a/templates/index.gph/footer.gph b/templates/index.gph/footer.gph | |
t@@ -1,2 +1,2 @@ | |
-[0|Atom feed|/atom.xml|${siteurl}|70] | |
+[0|Atom feed|/atom.xml|server|port] | |
diff --git a/templates/index.gph/header.gph b/templates/index.gph/header.gph | |
t@@ -2,12 +2,12 @@ Welcome to... | |
/\ _ _| _ _ _' _ _ _ |_ _ _|_ _ | _ | |
/--\| |(_|(/_| _\ (_|(_)|_)| |(/_| | |(_)|(/_ | |
_| | | |
-[i||Err||] | |
[1|Publications|/research.gph|server|port] | |
-[h|Media|URL:${siteurl}/media.html|https://adamsgaard.dk|70] | |
+[1|Media|/media.gph|server|port] | |
[1|Contact|/contact.gph|server|port] | |
[h|Code|URL:https://src.adamsgaard.dk|https://src.adamsgaard.dk|70] | |
[9|CV|/pub/cv.pdf|server|port] | |
-[h|Photography|URL:https://andersdamsgaard.com|https://andersdamsgaard.com|70] | |
+[h|Photography|URL:https://andersdamsgaard.com|andersdamsgaard.com|70] | |
+[h|WWW mirror|URL:${siteurl}|${siteurl}|70] | |
--- Posts --- | |
diff --git a/templates/index.gph/item.gph b/templates/index.gph/item.gph | |
t@@ -1 +1 @@ | |
-[h|${created} ${title}|URL:${siteurl}/${filename}|${siteurl}|70] | |
+[0|${created} ${title}|${filename}|server|port] | |
diff --git a/templates/media.gph/footer.gph b/templates/media.gph/footer.gph | |
diff --git a/templates/media.gph/header.gph b/templates/media.gph/header.gph | |
t@@ -0,0 +1,52 @@ | |
+--- Interviews and presentations --- | |
+ | |
+A brief introduction to my research | |
+[9|video (ogv) 3.8 MB|/video/auff_interview_en.ogv|server|port] | |
+[9|video (webm) 4.4 MB|/video/auff_interview_en.webm|server|port] | |
+ | |
+Keynote presentation at the CSDMS general meeting 2016 | |
+[9|video (ogv) 46.2 MB|/video/csdms2016.ogv|server|port] | |
+[9|video (webm) 50.2 MB|/video/csdms2016.webm|server|port] | |
+ | |
+ | |
+--- Simulations using my software --- | |
+ | |
+2D shear simulation of granular diffusion and segregation | |
+[9|video (ogv) 8.4 MB|/video/diffusion.ogv|server|port] | |
+[9|video (webm) 12.8 MB|/video/diffusion.webm|server|port] | |
+ | |
+Elastic and plastic deformation of sea ice under compression | |
+[9|video (ogv) 272 KB|/video/seaice-ridging.ogv|server|port] | |
+[9|video (webm) 343 KB|/video/seaice-ridging.webm|server|port] | |
+ | |
+Subglacial channel mechanics under different effective stresses | |
+[9|video (ogv) 815 KB|/video/channel-shape.ogv|server|port] | |
+[9|video (webm) 1.4 MB|/video/channel-shape.webm|server|port] | |
+ | |
+Internal stress dynamics in sediment around subglacial channels | |
+[9|video (ogv) 738 KB|/video/channel-stress.ogv|server|port] | |
+[9|video (webm) 767 KB|/video/channel-stress.webm|server|port] | |
+ | |
+Elastic wave propagation in 3D lattice | |
+[9|video (ogv) 457 KB|/video/elastic-wave-lem.ogv|server|port] | |
+[9|video (webm) 481 KB|/video/elastic-wave-lem.webm|server|port] | |
+ | |
+Force chains during simple shear | |
+[9|video (ogv) 471 KB|/video/force-chains.ogv|server|port] | |
+[9|video (webm) 1.1 MB|/video/force-chains.webm|server|port] | |
+ | |
+Closeup of granular jamming in sea ice | |
+[9|video (ogv) 775 KB|/video/seaice-jamming-closeup.ogv|server|port] | |
+[9|video (webm) 803 KB|/video/seaice-jamming-closeup.webm|server|port] | |
+ | |
+Granular gamming of sea ice with different grain size distributions | |
+[9|video (ogv) 1.2 MB|/video/seaice-gsd.ogv|server|port] | |
+[9|video (webm) 926 KB|/video/seaice-gsd.webm|server|port] | |
+ | |
+Granular jamming of sea ice with varying friction and cohesion | |
+[9|video (ogv) 949 KB|/video/seaice-friction-cohesion.ogv|server|port] | |
+[9|video (webm) 915 KB|/video/seaice-friction-cohesion.webm|server|port] | |
+ | |
+Stick/slip under stress-controlled shear with variable water pressure | |
+[9|video (ogv) 1.7 MB|/video/stick-slip.ogv|server|port] | |
+[9|video (webm) 2.9 MB|/video/stick-slip.webm|server|port] | |
diff --git a/templates/media.gph/item.gph b/templates/media.gph/item.gph |