dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit a3e1c471f53fd81318b41763fd73a0a57ee1cdeb
parent 3572e5492d9514e7945b7e7d92ce0095688420e8
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Fri, 27 Dec 2019 11:35:21 +0100

Merge branch 'master' of src.adamsgaard.dk:src/dotfiles

Diffstat:
M.config/rss2email.cfg | 8++++++++
M.local/bin/linkhandler | 10+++++++---
M.local/bin/sendtext | 6++++++
A.local/share/awk/mmd | 108+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.w3m/bookmark.html | 2++
5 files changed, 131 insertions(+), 3 deletions(-)

diff --git a/.config/rss2email.cfg b/.config/rss2email.cfg @@ -497,3 +497,11 @@ user-agent = rss2email 3.11 on obsd-nl url = https://www.youtube.com/feeds/videos.xml?channel_id=UCRev1D_EDHyzhW8_voY0Z_g user-agent = rss2email 3.11 on obsd-nl +[feed.tech_Solene_Rapenne] +url = https://dataswamp.org/~solene/rss.xml +user-agent = rss2email 3.11 on obsd-nl + +[feed.photo_Photrio-BW_Film_Paper_Chemistry] +url = https://www.photrio.com/forum/forums/b-w-film-paper-chemistry.85/index.rss +user-agent = rss2email 3.11 on obsd-nl + diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler @@ -25,14 +25,18 @@ handle_url() { action="undefined" case "$url" in *.png|*.PNG|*.jpg|*.JPG|*.jpeg|*.JPEG|*.tif|*.TIF|*.bmp|*.BMP|*.pdf|*.PDF) - notify-send "linkhandler" "download + xdg-open" + notify-send "${0##*/}" "download + xdg-open" action="xdg-open" ;; *youtube.com*|*youtu.be*) - notify-send "linkhandler" "youtube-dl" + notify-send "${0##*/}" "youtube-dl" action="youtube-dl" ;; *smbc-comics.com*|*xkcd.com*|*jspowerhour.com*) - notify-send "linkhandler" "comic" + notify-send "${0##*/}" "comic" action="comic" ;; + 10.[0-9]*\/*) + url="https://doi.org/$url" + notify-send "${0##*/}" "open as doi" + action="open" ;; *) action="$(printf "open\nopen (tbb)\nxclip\nducksearch\nmap\nbookmark\ndownload\nhtml to pdf\nsci-hub\nscholarref\nmpv\nxdg-open\nyoutube-dl\nyoutube-dl-music\ndefine" | \ dmenu -i -p "$(echo "$url" | sed 's/.*:\/\///' | cut -c-80)")";; diff --git a/.local/bin/sendtext b/.local/bin/sendtext @@ -88,6 +88,12 @@ for r in "$@"; do simon) r="$(pass Telephone/simon)" ;; + niels) + r="$(pass Telephone/niels)" + ;; + annegrethe) + r="$(pass Telephone/annegrethe)" + ;; esac send_twilio_text "$r" done diff --git a/.local/share/awk/mmd b/.local/share/awk/mmd @@ -0,0 +1,108 @@ +# usage: awk -f markdown-to-html.awk file.md > file.html +# script originally by Solene Rapenne +# https://dataswamp.org/~solene/2019-08-26-minimal-markdown.html + +BEGIN { + in_code=0 + in_list_unordered=0 + in_list_ordered=0 + in_paragraph=0 +} + +{ + # escape < > characters + gsub(/</,"\<",$0); + gsub(/>/,"\>",$0); + + # close code blocks + if(! match($0,/^ /)) { + if(in_code) { + in_code=0 + printf "</code></pre>\n" + } + } + + # close unordered list + if(! match($0,/^- /)) { + if(in_list_unordered) { + in_list_unordered=0 + printf "</ul>\n" + } + } + + # close ordered list + if(! match($0,/^[0-9]+\. /)) { + if(in_list_ordered) { + in_list_ordered=0 + printf "</ol>\n" + } + } + + # display titles + if(match($0,/^#/)) { + if(match($0,/^(#+)/)) { + printf "<h%i>%s</h%i>\n", RLENGTH, substr($0,index($0,$2)), RLENGTH + } + + # display code blocks + } else if(match($0,/^ /)) { + if(in_code==0) { + in_code=1 + printf "<pre><code>" + print substr($0,5) + } else { + print substr($0,5) + } + + # display unordered lists + } else if(match($0,/^- /)) { + if(in_list_unordered==0) { + in_list_unordered=1 + printf "<ul>\n" + printf "<li>%s</li>\n", substr($0,3) + } else { + printf "<li>%s</li>\n", substr($0,3) + } + + # display ordered lists + } else if(match($0,/^[0-9]+\. /)) { + n=index($0," ")+1 + if(in_list_ordered==0) { + in_list_ordered=1 + printf "<ol>\n" + printf "<li>%s</li>\n", substr($0,n) + } else { + printf "<li>%s</li>\n", substr($0,n) + } + + # close p if current line is empty + } else { + if(length($0) == 0 && in_paragraph == 1 && in_code != 0) { + in_paragraph=0 + printf "</p>" + } # we are still in a paragraph + if(length($0) != 0 && in_paragraph == 1) { + print + } # open a p tag if previous line is empty + if(length(previous_line)==0 && in_paragraph==0) { + in_paragraph=1 + printf "<p>%s\n", $0 + } + } + previous_line = $0 +} + +END { + if(in_code==1) { + printf "</code></pre>\n" + } + if(in_list_unordered==1) { + printf "</ul>\n" + } + if(in_list_ordered==1) { + printf "</ol>\n" + } + if(in_paragraph==1) { + printf "</p>\n" + } +} diff --git a/.w3m/bookmark.html b/.w3m/bookmark.html @@ -0,0 +1 @@ +../code/adamsgaard.dk/output/bookmark.html+ \ No newline at end of file