Did you know: `jq` can do string interpolation? If your source data is a JSON file, it's a surprisingly competent template engine!

embr 🐉

in other news, DE ICE trains have an API, I now have a fish snippet that formats it for my status bar if it detects that I'm on an ICE train's WiFi~


(uses Font Awesome for the icons, I find it much easier to get working in awesomewm as a fallback font than getting an emoji font to cooperate in it)

(Also I can show my battery level with the different battery icons!)

@embr I would guess it checks where the request on their network (train Wi-Fi) is coming from to know what train you are in, and then return the relevant data? Because I can't explain it otherwise.

@embr PS If that's the case then you should totally capture the raw data so that we can emulate the response and build an app around it. :thonking:

@sindastra @embr it resolves to a local ip while on ICE wifi, so handled by the train

@sindastra @embr (and the portal works even when the train loses outside internet connection)

@embr this is extremely neat. Thanks for sharing!

@embr wow, wonders if something similar works on the uk eurostar trains based on the ice3

@geekylou I'm taking the eurostar back, I'm gonna find out

@embr this looks cool... is this about fish, the shell, or is there another tool called fish I missed?

@xpac the shell! I prefer it to bash/zsh because it takes its own spin on the language, which is more usable and has much fewer semantic pitfalls

I'm stuck on a delayed ICE Train, so I turned this into a script that tells me how delayed it is from my status bar.

And you can use it too! github.com/liclac/ambient

@sindastra is this a Hitman reference, because I’m reading it in That Voice

@embr I’ve spent most of my afternoon on an SJ X2000 and now I’m disappointed that SJ don’t expose an API like that on their in-train Wi-Fi. 😭

@embr also, it’s such a cool idea to have it in your status bar. Nice hack!

Someone pointed out that I forgot to put a license in here

I usually default to MIT for historical reasons, but what are people’s thoughts on FOSS licenses?

@embr I like MPL because it's a nice middle ground between GPL and MIT where you can link my shit to whatever you want, but you can't make your fork of it closed source and most importantly the license document is fairly readable for non-lawyers

@embr use the strongest copyleft you can and keep software free. People having to copyleft their own stuff to use it is a feature, not a bug.

@qyliss strongly agree

what *are* the strongest copyleft licenses out there though? I just want "do whatever, just don't hold me liable" for this tbh, it's a handful of curl commands I reverse engineered out of a webpage on a train

@embr @qyliss lots of big companies avoid Affero GPL like the plague. So that's a benefit to me. 🙂

@embr the strongest copylefts are the AGPL and GPL. If all you wasn’t here is a disclaimer of liability, though, that’s the opposite. You probably want 0-clause BSD or CC0. But I’d urge you to consider at least the MPL. It takes almost no effort to comply with, and you still get freedom protections on your code.

@embr Make it all as proprietary as possible and sue sue sue! 😜 Not being serious of course. But jokes aside, why not write your own license? Or modify an existing one to your needs? Have you tried choosealicense.com/ or something like creativecommons.org/ ?

My Eurostar scraping is extremely cursed

Going to try and get something out of Thameslink and hopefully other GTR trains

@karina that'd be amazing!

Super happy with the response dump too, I'm gonna wire them up along with my own and make unit tests happen

@embr what would be super neat is if I could get to wherever the on-board displays get their data from

otherwise all I've got so far is bandwidth usage info

@embr Ok nvm I found endpoints with things that are actually useful!!

@embr it's technically not "free software" because it doesn't allow people to profit off of your labor, but nowadays i use the cooperative software license eunichx.us/c/

free for non-commercial use, with an exception allowing co-ops.

@embr I don't know if it is a good sign if you can announce/toot more features here 🤔 🤣

@embr I politely ask you to not write scripts in bash/fish/…. Write POSIX compatible scripts, please.

@embr had a look at Eurostar: it isn't smart enough to know which train you are on - you have to tell it, and it uses websockets. Also seems broken for me, the map dosen't update.

@embr Yes 😟 I'm going to be in London soon so giving up. I couldn't get at the websocket data from the debugging tools in chrome or firefox, not sure whats going on there.

I ported the ICE API stuff to powerline, but it needs fixing to run the web requests in a background thread to make it performant. (and it needs a popup alarm to wanr you when there is 10 mins before your destination station).

@jasper I’m tempted to write a background daemon of some description tbh, I could hack something together with Go pretty easily if shell scripts aren’t cutting it

@embr This is really cool—thank you for sharing! 😍

Can I ask you how you found out that the API exists and which endpoints it has?

@winniehell I just opened the network inspector on the page that opens when you get on the wifi :P

@embr oh, wow, that was unexpectedly simple. 😅

thank you! 😃

@embr i wonder, what are your conditions for using, sharing, derivations? github per se only demands the repos to be forkable on github, but do you want it to be (re-)usable outside of github?

@zaehnchen oh, of course, I knew I’d forgotten something - a license file

remind me to pop one in after work!

@embr i have no idea when you work but i guess sunday is okay for a reminder^^

but as it is a gist i find it very hard to put in a license file. there are ways, but other than license headers within the file most ways are quite ugly. i asked github on how they think licensing should be done for gists, maybe they have an idea.

@zaehnchen tell me if you find out! for now, I licensed the whole repository further down in the thread under The Unlicense

Sign in to participate in the conversation

queer.af, your cosy queer space queer.af is a mastodon instance for those who are queer or queer-adjacent who would like a more pleasant social media experience.