I like markdown. I use Obsidian a lot, and write a lot in GitHub issues. Something useful I usually do is quote other people's words, so in markdown it would look like:
The Met office said
> it will definitely snow tonight>
> like... 100%
I found that I can use a command xclip to get/set my clipboard on Linux, and I use a lot of sed to do word replacement, so I realised I could copy the text
it will definitely snow tonight
like... 100%
and then run this command in my terminal (xclip gets/sets the clipboard, sed replaces ^ (the start of each line) with > )
xclip -selection c -o | sed "s/^/> /" | xclip -selection c
which would get my clipboard, replace the start of each line with a quote, and set the clipboard, setting the clipboard to:
it will definitely snow tonight
like... 100%
I've set aliases for these commands so I can use them quickly in my terminal as:
alias getclip='xclip -selection c -o'alias setclip='xclip -selection c'alias quote='getclip | sed "s/^/> /" | setclip'
but also I created a keyboard shortcut in Gnome, CTRL + SUPER + Q, which will quote my clipboard. I had to set the shortcut to run bash -c 'xclip -selection c -o | sed "s/^/> /" | xclip -selection c' as I don't think pipes sit well in shortcuts.
I like maps. I make maps. Mostly from worse maps or data that is not in map form. See some of mine on https://alifeee.co.uk/maps/.
One thing I've been doing for a map recently is geocoding, which is turning an address (e.g., "Showroom Cinema, Paternoster Row, Sheffield") into latitude/longitude coordinates.
$ ./geocode.sh "Showroom Cinema, Paternoster Row, Sheffield"
throttled... retrying...
throttled... retrying...
got response: { "standard" : { "stnumber" : "1", "addresst" : "Paternoster Row", "statename" : "England", "postal" : "S1", "region" : "England", "prov" : "UK", "city" : "Sheffield", "countryname" : "United Kingdom", "confidence" : "0.9" }, "longt" : "-1.46544", "alt" : {}, "elevation" : {}, "latt" : "53.37756"}
latitude longitude confidence address state city province country post code alt address alt state alt city alt province alt country alt postal
53.37756 -1.46544 0.9 Paternoster Row England Sheffield UK United Kingdom S1
The results are "ok". They're pretty good for street addresses, but I can see a lot of wrong results. I might try and use another API like OpenStreetMap's or (shudders) Google's.
I initially thought about doing this using Git Hooks, but I want to be able to edit the "logs" from my phone or via a browser, where I wouldn't be able to trigger the git hook.
So, I'm doing it in a proprietary "GitHubby" way, which would be annoying to change if I changed to, say, GitLab. But, here we are. Technology lock-in is real.
Anyway, I've been writing these notes in Obsidian. I have then been copying and pasting the content into https://dlaa.me/markdownlint/ to find problems with my Markdown formatting. It's mainly when I forget to wrap links in <> as this makes them not render as HTML links - I sort of like this as you (my automatic tool) shouldn't try and decide what is and isn't a link, but also maybe you should because you can probably recognise them pretty well with a very established regex by now.
Anyway, I found an Obsidian extension which lets you specify shell commands https://github.com/Taitava/obsidian-shellcommands that you can run via the command palette. This seems super neat - I can do ANYTHING now.
Anyway, I installed it and made a command to lint the current markdown file. I had to install npm globally because it wasn't working when being called from the Obsidian script, and then I made this command to run the lint.
I disabled MD013 which is the insane rule which wants you to have loads of line breaks per paragraph (I prefer my paragraph to be one really really long line please).
It's not perfect (the output is just in an ugly pop up window), but it is nice to run it locally.
Here is the trouble: using the npm command or using command line scripts installed globally via npm install -g ... as a user that is not you.
I am alifeee. I would like other users (e.g., www-data) to be able to use npm, so that I can, say, make a CGI script that changes a file, and then runs npm run build. I do this exact thing for https://github.com/alifeee/simple-calendar, which uses yaml files and an Eleventy website to make a simple calendar. Another one is that I want to use npm commands in scripts run with https://github.com/Taitava/obsidian-shellcommands, which does not run as my current user.
The problem is that the normal way to install nvm installs it into your user folder (i.e., /home/alifeee), so other users can't use it.
It took me way too long to figure this out (banging my head against npm-shaped walls for hours), but I have switched from running the default install script on https://github.com/nvm-sh/nvm to now doing this:
Then, I can use nvm because it's sourced in my ~/.bashrc (as before), but importantly, any user can use npm and Node by running:
## safe (same way it's done in .bashrc - check if the file exists)export NVM_DIR="/usr/alifeee/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"; nvm use 20; npm --version
## less 'safe' but works finesource /usr/alifeee/.nvm/nvm.sh && nvm use 20 && npm -v