Log in
Seblog.nl

Seblog.nl

Vorig jaar was mijn (niet uitgesproken) goede voornemen op het gebied van code om meer te leren over Git, want dat leek iedereen die ik pro vond te gebruiken. En dat is gelukt! Ik snap hoe Git werkt, zowel via hun desktop-app als via de CLI, en ik doe dingen met commits, branches, repo's en gister is er zelfs een pull request van me gemerged.

Dit jaar wordt mijn (bij dezen uitgesproken) goede voornemen om te gaan unit-testen. Of in ieder geval iets van tests in mijn programmeren in te bouwen, cuz that's how the pro's do it! Op dit moment maak ik gewoon steeds allemaal wijzigingen en hoop ik dat het werkt – wat vaak niet het geval is op het eerste moment. Op naar een jaar meer secuur werken!

Another take on uploading screenshots to a Micropub Media Endpoint

Over the last months I’m on IRC more often. I like the simplicity of sending plain-text messages, but from time to time I like to send a picture as well. The best way to do that on IRC is to upload the file somewhere else and send a link. Uploading files can be a hassle though.

I must admit that this problem is somewhat born because I already found a solution for it elsewhere. I followed Aaron’s recipe for creating a folder that uploads images, but for the times I needed it, I found it tedious to drag my screenshots to that folder. So here’s my alteration of it.

My workflow is nearly the same, but I choose the type ‘Voorziening’ (what’s that in English?), which makes it available in the right-click-menu. I can just select a file, right-click, and go to Voorzieningen > Upload to Media Endpoint.

I let it accept images, but you can go for documents in general as well, and the rest of the workflow is the same as Aaron’s. (Make sure to pass the input to the shell script as arguments!) The only thing is that it will receive a list of files, so I changed the shell script to:

for f in "$@"
do
    curl -i -F "file=@$f" -H "Authorization: Bearer xxx" https://example.com/media-endpoint | grep Location: | sed -En 's/^Location: (.+)/\1/p' | tr -d '\r\n' | pbcopy
done

Note that this uploads multiple files and only saves the last url to the clipboard. I just select one file per upload, so that will be fine.

Na de bakker, de AH en nogmaals de AH omdat huisgenoot M. haar auto deukte, hebben we alles nu wel. De rest van het jaar blijf ik thuis.

Oké, ik moet nu echt op zoek gaan naar oliebollen, anders worden mijn huisgenoten boos. Waar haal je die dingen nog op dit uur?

Met de kerstdagen praat ik meer dan ik typ en merk ik dat ik bepaalde dingen niet kan uitdrukken. Wat is de vocale variant van 🎉?

Meer laden