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

embr ๐Ÿ‰ ๐Ÿ”œ EMF20 ๐Ÿ”œ 37C3
Follow

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~

gist.github.com/liclac/44760b4

ยท Web ยท 11 ยท 80 ยท 113

(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)

@wxcafe @sindastra ye, it has data on if the train currently has an internet connection, so itโ€™s got to be local

@embr this is extremely neat. Thanks for sharing!

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

@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 It wasn't meant to be but... ๐Ÿคทโ€โ™€๏ธ

@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/ ?

@embr
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 you can't ask that question on the internet !!! ๐Ÿ™ˆ
@embr also the right answer is still MIT/BSD in most cases ๐Ÿฅ

@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 the main project i contribute to prefers 2-clause bsd everywhere. the nice parts are that it's understandable to most humans and doesn't rely on US contract law to be useful, but it doesn't do as much as a lot of people would like.

i also like the unlicense because it carries a strong political message, but sometimes that can be a bit awkward, i guess.
@embr ... strong as in the implications are pretty fucking cool.
@embr i should mention as well: license compatibility is a thing a lot of people have to care about but a lot of people don't understand. it's really easy to run into issues with this because it can even be invalid to mix code under different versions of the same license.

in general, the less complex the license terms, the more likely it is other open source projects will be able to build on your code. this is something i care about a lot!

@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

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.