refactor: moved to hugo

This commit is contained in:
Felipe M 2024-06-16 20:39:53 +02:00
parent 4c6912edd0
commit e77e5583c2
Signed by: fmartingr
GPG key ID: CCFBC5637D4000A8
604 changed files with 1675 additions and 2279 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View file

@ -0,0 +1,73 @@
+++
title = "December 2021"
date = 2022-01-01
+++
![The Elantris book openend in page 610 over my laptop in my parent's house desktop](image.jpg?width=640#center)
<div class="text-center">This is a pretty good summary of the month.</div>
<!--more-->
## Personal projects
- Wrote [nudge](https://github.com/fmartingr/nudge) an evening after internet went down at home. Would be a way of controlling if we have an available internet connection using multiple sources so our Home Assistant instance can reset the router using an smart outlet/ssh connection, since it seems that my [Firewalla Gold](https://firewalla.com/products/firewalla-gold) keep giving me headaches: just last month when my apartment building lost internet the local DNS resolver stopped working just because it didn't have internet, breaking some of my home services... and now after not correctly recovering when my internet connection went down for a few minutes. I just can't recommend this thing.
- Related to this I need to work on a failover solution for when the internet is down for a very long time and we're not home, maybe a 4G router of some sort? I don't know.
- Now that I'm reading way more in physical editions I'm working on some services to check stock/prices of my personal book wishlist. Following a bit of the mainsteam buzzwords I want it to be event driven hexagonal design, so far I've splitted it into 6 microservices but they would probably be more. I need to start a board of some sort to start working on this.
## Books
- Read [**Elantris**](https://www.goodreads.com/book/show/29242989-elantris)
- Read two short stories from [**Arcanum Unlimited**](https://www.goodreads.com/book/show/40552794-arcanum-ilimitado) related to the Elatris world (The Sel System): **The emperor's soul** and **The hope of Elantris**.
And... I'm all in with comics/manga/manhwa:
- Up to date with [**One Piece**](https://www.goodreads.com/series/57193-one-piece)! What an incredible journey. I've read up to the volume edited here in Spain and to the latest available chapter on the Jump! mangazine app. I can watch memes and everything one piece because I'm not going to spoil myself.
- Ongoing wit [**Hellbound**](https://www.webtoons.com/en/thriller/hellbound/list?title_no=3598). A chapter per week, sticking to the free tier for now so I can consume it slowly.
- Read [**The God's Lie (神様がうそをつく)**](https://www.goodreads.com/book/show/23689723-los-dioses-mienten)
- Read [**Canary Boats (カナリアたちの舟)**](https://www.goodreads.com/book/show/59654559-la-barca-de-los-canarios)
- Started several series:
- On volume 2 of [**Gigant**](https://www.goodreads.com/series/249469-gigant) from **Hiroya Oku**, one of my favouirte manga authors. If you like _seinen_, please give [**Gantz**](https://www.goodreads.com/series/77126-gantz) a look.
- On volume 2 of [**Platinum's End**](https://www.goodreads.com/series/169755-platinum-end) from **Takeshi Obata** and **Tsugumi Ohba**, authors of other jewels like [**Death Note**](https://www.goodreads.com/series/52807-death-note) and [**Bakuman**](https://www.goodreads.com/series/52005-bakuman) (though I still haven't read that last one).
- On volume 1 of [**Atelier of the Witch-Hat**](https://www.goodreads.com/series/212829-tongari-b-shi-no-atelier)
- On volume 1 of [**Solo Leveling**](https://www.goodreads.com/series/312408-solo-leveling-manhwa)
- On volume 1 of [**Tower of God**](https://www.goodreads.com/series/132470-tower-of-god)
## TVShows and Movies
- Finished [**Hawkeye**](https://www.tvtime.com/en/show/367146). What a fun way to end the year from Disney. If this is the base level for everything coming from the MCU into 2022 I'm all in.
- Tried but Dropped: [**The Magicians**](https://www.tvtime.com/en/show/299139). It was like watching a bunch of high schoolers doing stupid things, hope the books are better that this though I'm not sure if I would ever try.
- Started [**The Witcher: Season 2**](https://www.tvtime.com/en/show/362696). Only the first episode to check if it was a summary of some sort, and I remembered the tale vagely, maybe it is included in [The last wish](https://www.goodreads.com/book/show/40603587-the-last-wish)?
- Started [**Orphan Black**](https://www.tvtime.com/en/show/260315). Watched a few episodes a long while ago but didn't remember why I stopped it. After reading around that _Tatiana Maslany_ was going to be _She-Hulk_ I decied to start over again with it, her performance is just brilliant.
- Started [**Ranking of Kings**](https://www.tvtime.com/en/show/391625). Watched the first episode to check what the fuss is about, seems a mix between different and interesting, so I'm waiting the drop on Crunchyroll so I can continue with it.
- Watched [**Die Hard**](https://letterboxd.com/film/die-hard/). Perfect for Christmas day.
- Of course, watched [**Spider-man: No way home**](https://letterboxd.com/film/spider-man-no-way-home/). 10/10. Would remove my memories of it and watch it again.
## Games
- Ongoing with [**Hollow Knight**](https://store.steampowered.com/app/367520/Hollow_Knight/). I'm surprised my Switch is still intact after so many deaths.
[![Hollow Knight screenshot](hollow-knight.jpg?width=640#center)](hollow-knight.jpg)
## [Articles](https://t.me/fmartingr_articles)
- (Video) [Window to the World Demo](https://youtu.be/sXxcPxjwLj8)
- (Video) [Inside Japan's Abandoned Coin Lockers](https://youtu.be/sajcUVDDBU8)
- [Saying goodbye to an old friend](https://ar.al/2021/12/16/saying-goodbye-to-an-old-friend/)
- [Small technology](https://small-tech.org/videos/small-technology/)
- [My first web0 website!](https://elliott.computer/pages/web0.html)
- [Japan's paper culture](https://www.jetpens.com/blog/Japan-s-Paper-Culture/pt/998)
- [For the love of the web](https://blog.jim-nielsen.com/2021/for-the-love-of-the-web/)

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 MiB

View file

@ -0,0 +1,96 @@
+++
title = "January 2022"
date = 2022-02-01
+++
![A picture of me resting a book called Press Reset on my legs while looking at the horizon.](image.jpg?width=640#center)
<div class="text-center">We had amazing holidays this year.</div>
<!--more-->
## Personal projects
- I have been working a lot on my notion boards nowadays. Not that I'm better planning what do I do with my time, having everything laying around on different services. So I made simple boards to keep track of stuff. It seems like a stupid thing but sometimes I actually forgot about books, films, games, etc. So having everything there is very helpful to sort out what to read, watch or play next.
![My notion board for games organisation](notion-games-board.png?width=640#center)
- I re-enabled [fmartingr/switch-games-json](https://github.com/fmartingr/switch-games-json) only to find out that I don't need it anymore! Started this project because of the funny way screenshots on a Nintendo Switch are stored, and turns out you can just connect it through USB to a computer and use the Android File Transfer to get them perfectly sorted in folders with game names.
- I worked a bit on [**bazaar**](https://code.fmartingr.dev/fmartingr/bazaar). A simple service to extract product information from websites.
- I've started to work on a way to automate some field updating in Notion that I'm calling **AutoNotion** for now. Ideally this will receive a set of configuration files in _yaml_ and will allow to make simple updates to database items when some fields change, are missing, etc. Initially this would react to events but sadly it will have to work either doing polling or running on a cronjob caching database information.
- Forked [**go-shiori/shiori**](https://github.com/fmartingr/shiori) since the main one seems unmaintained. I like the simplicity of the project but it is a bookmark manager conceived as an alternative of a read-later service without features for the last. Since I want it to be more like Pocket the plan was to fork it and made it my own but I've written to the original author in case I can be the project's new maintainer.
- Released _0.2.0_ of [**fmartingr/games-screenshot-manager**](https://github.com/fmartingr/games-screenshot-manager) after giving it some love it clearly deserved, just bits of improvements here and there in preparation for future features.
## Books
- Read [**El libro hueco**](https://www.goodreads.com/book/show/59955909-el-libro-hueco). After playing the game I strongly needed to understand everything behind the game. This compendium was amazing for that.
- Started reading [**Press Reset**](https://www.goodreads.com/book/show/55277893-press-reset)
- Started reading [**The Final Empire**](https://www.goodreads.com/book/show/58921971-el-imperio-final)
- Read [**1984**](https://www.goodreads.com/book/show/57126185-1984) On my backlog for a long time, and it don't dissapoint at all. Just amazing.
- Read [**Marvel's Must-Have: Avengers Dissasembled**](https://www.goodreads.com/book/show/55477870-los-vengadores)
- Read [**Marvel's Must-Have: Universe Spiderman**](https://www.goodreads.com/book/show/55437417-spiderman)
- Read [**Spiderman Life Story**](https://www.goodreads.com/book/show/58101976-spiderman)
- Ongoing:
- [**One Piece**](https://www.goodreads.com/series/57193-one-piece)
- [**Hellbound**](https://www.webtoons.com/en/thriller/hellbound/list?title_no=3598)
- [**Solo Leveling**](https://www.goodreads.com/series/312408-solo-leveling-manhwa)
- [**Tower of God**](https://www.goodreads.com/series/132470-tower-of-god)
- [**Tokyo Revengers**](https://www.goodreads.com/series/256393-tokyo-revengers)
## TVShows and Movies
- Finished [**Money Heist**](https://www.netflix.com/title/80192098) mostly because the Player 2 wanted to watch it. Honestly this final part has been the worst of all series. I would have stopped watching after the first heist.
- Finished [**Orphan Black**](https://www.tvtime.com/en/show/260315). _Tatiana Maslany_ is just amazing.
- Finished [**The Witcher: Season 2**](https://www.tvtime.com/en/show/362696). Ended up watching everything on a rainy weekend, I'm now even more hyped to read the entire book series, if only I had time for it at the moment...
- Up to date with [**The book of Boba Fett**](https://www.disneyplus.com/series/the-book-of-boba-fett/57TL7zLNu2wf). I'm not digging it much, except for episode five which I loved for obvious reasons.
- Also watched a few things from [Nebula](https://nebula.app/) and [CuriosityStream](https://curiositystream.com/) this month now than I am detoxifying from YouTube. This are some interesting channels that come to mind:
- [Not Just Bikes](https://nebula.app/notjustbikes)
- [LowSpecGamer](https://nebula.app/lowspecgamer)
- [Extra Credits](https://nebula.app/extracredits)
- [Story Mode](https://nebula.app/storymode)
- [Minute Body](https://nebula.app/minutebody)
- [Kento Bento](https://nebula.app/kentobento)
## Games
- Finished [**Hollow Knight**](https://www.nintendo.es/Juegos/Programas-descargables-Nintendo-Switch/Hollow-Knight-1125772.html). My relationship with Hollow Knight can be easily represented by [this comic](https://cluelesshero.com/post/655919454629330944/325-toxic-relationship-help-i-just-cant-get-out).
![Clueless Hero: Toxic Relationship](hollow-knight.png)
- Started [**Turing Complete**](https://store.steampowered.com/app/1444480/Turing_Complete/) on my backlog for a while, only to play some kind of different puzzle game. If only I were better at it...
- Continuing with [**Please, dont touch anythng!**](https://store.steampowered.com/app/354240/Please_Dont_Touch_Anything/). We managed to get a lot of new endings thanks to notes we had from previous runs. Only five endings to finish it!
- Started [**Pokemon Legends: Arceus**](https://www.nintendo.es/Juegos/Nintendo-Switch/Leyendas-Pokemon-Arceus-1930510.html). This is the right way to evolve the Pokemon franchise.
## [Articles](https://t.me/fmartingr_articles)
- [Web3 is centralized](https://blog.wesleyac.com/posts/web3-centralized)
- [Why might you run your own DNS server](https://jvns.ca/blog/2022/01/05/why-might-you-run-your-own-dns-server-/)
- [Computers as I use to love them](https://tonsky.me/blog/syncthing/)
- [Threema Multi-Device: An Architectural Overview](https://threema.ch/en/blog/posts/md-architectural-overview)
- [The right to delete: how faker.js exposed the fragile nature of open source culture, again](https://www.thegingerviking.com/the-right-to-delete-fakerjs-fragile-nature-open-source/)
- [XMPP: the secure communication protocol that respects privacy](https://notes.nicfab.it/post/xmpp/xmpp/)
- [Steam Deck Developer Kit Impressions](https://boilingsteam.com/steam-deck-developer-kit-impressions/)
- [Scuttlebutt, A Decentralized Alternative To Facebook](https://www.inthemesh.com/archive/secure-scuttlebutt-facebook-alternative/)
- [Ask HN: What do you think of the Wordle guy not monetizing it?](https://news.ycombinator.com/item?id=29916899)
- [The curious case of teh RasPi in our network](https://blog.haschek.at/2019/the-curious-case-of-the-RasPi-in-our-network.html)
- **nebula.app** [Spider-Man Writer Breaks Down the Game's Opening](https://nebula.app/videos/story-mode-spiderman-writer-breaks-down-the-games-opening)
- [Big Fish Getting Bigger](https://cygnusentertainment.com/2022/01/19/big-fish-getting-bigger/)
- **nebula.app** [How the Tongan shockwave caused a tsunami](https://nebula.app/videos/simonclark-how-the-tongan-shockwave-caused-a-tsunami)
- **youtube via Piped** [Git's Best And Most Unknown Feature](https://piped.kavin.rocks/watch?v=2uEqYw-N8uE)

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View file

@ -0,0 +1,87 @@
+++
title = "February 2022"
date = 2022-03-01
+++
![Me sitting on the couch with my laptop, with a couch laptop table on top of my arms while triaging all shiori issues.](image.png?width=640#center)
<div class="text-center">I'm pretty sure this is how everyone use their laptops at home.</div>
<!--more-->
## Personal projects
- Started work on [dharma](https://code.fmartingr.dev/fmartingr/dharma), a simple tool to check for broken links, sources and hrefs on a static site to generate a report and potentially allow comparision with a local fpolder to check which files are not included/linked in the static site and can be deleted.
- A lot of work in [**go-shiori**](https://github.com/go-shiori). After I wrote the original maintainer about the project it made me maintainer as well, so I've been making some quality of life fixes, triaging all issues and sorting some stuff here and there. Most of the time I'm just replying issues or reviewing pull requests, but the feeling or moving the project forward is amazing. There's a lot of work to do, though, so I'm grateful the community is there after all this time. I managed to make two releases and screw up only once!
## Books
- Read [**Press Reset**](https://www.goodreads.com/book/show/55277893-press-reset)
- Read [**The Final Empire**](https://www.goodreads.com/book/show/58921971-el-imperio-final)
- Read [**Last Hero Inuyashiki**](https://www.goodreads.com/series/177249-inuyashiki)
- Read [**Umbral de lo siniestro**](https://www.goodreads.com/book/show/58975499-el-umbral-de-lo-siniestro)
- Read this month:
- [**One Piece**](https://www.goodreads.com/series/57193-one-piece) (Up to date)
- [**Hellbound**](https://www.webtoons.com/en/thriller/hellbound/list?title_no=3598) (Up to date)
- [**Tokyo Revengers**](https://www.goodreads.com/series/256393-tokyo-revengers) (Volume 2)
- [**Gigant**](https://www.goodreads.com/series/249469-gigant) (Volume 8)
- [**Atelier of Witch-Hat**](https://www.goodreads.com/series/212829-tongari-b-shi-no-atelier) (Volume 2)
## TVShows and Movies
- Ongoing with [**Ranking of Kings**](https://beta.crunchyroll.com/series/G79H23W70/ranking-of-kings)
- Finished [**The book of Boba Fett**](https://www.disneyplus.com/series/the-book-of-boba-fett/57TL7zLNu2wf). I'd say I liked it... but honestly I didn't. And the only thing that made me watch it through the end is 1) it is Star Wars 2) <span class="spoiler">Mando</span>.
- As always, [**Nebula**](https://nebula.app/) and [**CuriosityStream**](https://curiositystream.com/) as daily drivers.
- Watched the [**Legend of Vox Machina Season 1**](https://www.primevideo.com/detail/The-Legend-of-Vox-Machina/0O1MH4HMS00EO6XP75LWG5TB89)
- **Harry Potter** marathon! Only the last two films remain.
- I've not watched/checked on my Youtube feed for the entire month and I've lost the urge to check it out. Now I only check nebula from time to time (because it does not have updates daily) and I'm way happier and tend less to procastinate.
## Games
- Continuing with [**Please, dont touch anythng!**](https://store.steampowered.com/app/354240/Please_Dont_Touch_Anything/). We are only two endings from finishing it.
- Sort of finished [**Pokemon Legends: Arceus**](https://www.nintendo.es/Juegos/Nintendo-Switch/Leyendas-Pokemon-Arceus-1930510.html).
The game was crazy fun with the new catching mechanic, but the end-game is not very well crafted:
- The game doesnt teach you to prepare a decent pokemon team
- The difficulty curve is just awful. After some easy battles with 3 pokemon max the last one is a trainer with 6 pokemon, swaps them to take type advantage and heals them to max health. At this point it can easily one shot your team easily if you're not carefu enough. <span class="spoiler">Which ends up being three combats in a row without healing in between (first vs 6 pokemon, then a legendary, and then the same legendary but angrier) making only two viable strategies: Grinding (which isnt very effective in this game) or just sacrificing Pokemon in each fight because you know its going to kill them. (Which is, in fact, the recommended method in online guides)</span>
- There was a lack of love and polish in general as well: secondary mission tracking can be vastly improved, the player should be able to travel between areas without passing through the village, if you give me a secondary mission to get _n_ items in each map, at least give me something to track them, since I already have to catch ~250 pokemon at least once, and on top of all, <span class="spoiler">dont make having those collectibles mandatory for completing the pokedex because one pokemon only show up if you do</span>.
that seem to be using the same engine as this one)
`</rant>`
Even after all that, I think is a good way to move forward with the pokemon franchise but is very obvious that this game needed more time to be polished and to think some things through.
I really hope they invest enough time in the next entries in the series since it seems that they share the engine.
- Started [**Lost Ark**](https://store.steampowered.com/app/1599340/Lost_Ark/).
Oh geez, why did I do this.
![My character fishing in Lost Ark](lost-ark.png)
## [Articles](https://t.me/fmartingr_articles)
- [Google search is dying](https://dkb.io/post/google-search-is-dying)
- **video** [Anti-Piracy in Nintendo DS Games](https://yewtu.be/watch?v=QiTene7mHpc)
- [iCloud+ Custom Email Domains should be better](https://domlaut.com/icloud-custom-email-domains-should-be-better/)
- [Alpine Linux and Docker Infrastructure Three Years Later](https://www.wezm.net/v2/posts/2022/alpine-linux-docker-infrastructure-three-years/)
- [What using RSS feeds feels like](https://gilest.org/rss-feels.html)
- [Things that used to be hard and are now easy](https://jvns.ca/blog/2022/02/20/things-that-used-to-be-hard-and-are-now-easy/)
- **video** [Why Theres An Empty Skyscraper In The Middle Of Times Square](https://nebula.app/videos/hai-why-theres-an-empty-skyscraper-in-the-middle-of-times-square)
- [Gemini isn't the solution to the broken web](https://kevq.uk/gemini-isnt-the-solution-to-the-broken-web/)
- [Life of a DNS query](https://wizardzines.com/comics/life-of-a-dns-query/)
- [Please don't use discord for FOSS projects](https://drewdevault.com/2021/12/28/Dont-use-Discord-for-FOSS.html)
- [Why Facebook keeps collecting peoples data and building their profiles even when their accounts are deactivated](https://digiday.com/media/why-facebook-keeps-collecting-peoples-data-and-building-their-profiles-even-when-their-accounts-are-deactivated/)

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

View file

@ -0,0 +1,55 @@
+++
title = "March 2022"
date = 2022-04-01
+++
![A Japanese Torii gate](image.jpg?width=640#center)
<div class="text-center">I've started drawing a little on the tablet. I'm awful at it, but it's a relaxing way to pass the time while having a cup of coffee. (Yes, the date is wrong)</div>
<!--more-->
This month has been pretty poor in comparision to others, apart from work we had some situation at home that has made us took the decision of moving to another place, so in between looking for a place, the preparations and the undisclosed thing that has made us take this decision I didn't have much time for anything else, and that's why this month's entry is so scarce in content in comparison to other months.
Since we're planning to move in two-three weeks this will be the same for the coming month as well.
## Personal projects
Some little progress on [**go-shiori**](https://github.com/go-shiori) triaging and bug-fixing. Nothing else worth mentioning.
## Books
- Started reading [**The well of ascension**](https://www.goodreads.com/book/show/68429.The_Well_of_Ascension)
- Started reading [**Log Horizon #1**](https://www.goodreads.com/book/show/18939933-1)
- Read this month:
- [**Solo Leveling #4**](https://www.goodreads.com/book/show/58086172-solo-leveling-04)
- [**Horizon: Corazon de Madre**](https://www.gtm-store.com/product/horizon-corazon-de-madre/) A book from [Games Tribune](https://www.gamestribune.com/) about Horizon: Zero Dawn (Spanish).
- [**Gigant #9**](https://www.goodreads.com/series/249469-gigant)
## TVShows and Movies
- Watching [**Ranking of Kings**](https://beta.crunchyroll.com/series/G79H23W70/ranking-of-kings). Not up to date because I didn't have time. but I may be almost there.
## Games
- Started [**Marvel's Guardians of the Galaxy**](https://www.xbox.com/es-ES/games/store/marvels-guardians-of-the-galaxy/9pgll77c201j)
## [Articles](https://t.me/fmartingr_articles)
- [Alpine Linux and Docker Infrastructure Three Years Later](https://www.wezm.net/v2/posts/2022/alpine-linux-docker-infrastructure-three-years/)
- [What using RSS feeds feels like](https://gilest.org/rss-feels.html)
- [Things that used to be hard and are now easy](https://jvns.ca/blog/2022/02/20/things-that-used-to-be-hard-and-are-now-easy/)
- [Nebula](https://nebula.app/videos/hai-why-theres-an-empty-skyscraper-in-the-middle-of-times-square)
- [Google Search Is Dying | DKB](https://dkb.io/post/google-search-is-dying)
- [Write plain text files](https://sive.rs/plaintext)
- [Generate unique random values directly in the database](https://sive.rs/rand1)
- [Bugs in Hello World](https://blog.sunfishcode.online/bugs-in-hello-world/)
- [The day Steve Jobs dissed me in a keynote](https://sive.rs/itunes)
- [David Amador 🐙 on Twitter](https://twitter.com/DJ_Link/status/964124424969637888)
- [Framing and World of Warcrafts Rest System](http://www.psychologyofgames.com/2010/03/framing-and-world-of-warcrafts-rest-system/)
- [https://www.theverge.com/22935074/hundred-rabbits-uxn-roms-preservation](https://www.theverge.com/22935074/hundred-rabbits-uxn-roms-preservation)
- [Babycastles Academy: Intro to Uxn](https://spectra.video/w/1gV9xtPSU6wPHkH4terVDs)
- [The Fediverse: Decentralized Social Media for Human Beings](https://www.privateinternetaccess.com/blog/the-fediverse-decentralized-social-media-for-human-beings/)
- "[Reddit's website uses DRM for fingerprinting](https://smitop.com/post/reddit-whiteops/)"

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

View file

@ -0,0 +1,16 @@
+++
title = "April 2022"
date = 2022-05-04
+++
![A picture of a room in my house right now, full of boxes because we're moving to a new flat.](image.png?width=640#center)
This is the most accurate summary I can give of the last month. This is the first time player 2 and I are moving between
places together, and between the usual work this kind of thing has and some surprises we have had along the way... I didn't
have time for anything else.
TV has been set in the living room for... three days? And we haven't used it. I can play a little bit on the Deck when tired,
but usually no more than 20 minutes or so. Reading is limited to that little time before going to sleep, and we've been
so tired that I'm lucky if I manage to finish one chapter.
I started to catch up with Github and E-Mail yesterday (literally!), hopefully things will normalize in June.

View file

@ -0,0 +1,75 @@
+++
title = "Using ssh_config Match to connect to a host using multiple IP or Hostnames"
date = 2022-08-12
+++
My main computer is a MacBook Pro from 2017, but I have some servers laying around and one other laptop connected at home
with ArchLinux installed that I use mainly for development. I connect to it remotely either directly using a
SSH/Mosh + Tmux + Emacs/Vim combination, or using the pretty convenient VSCode Remote Extensions when I'm not feeling
much of a _hacker_.
Thing is, I may access this computer either from my home network directly if I'm at home or via a SDN if I am not (at the office,
coffeeshop, visiting family, etc).
My approach was to setup the hosts directly on my `~/.ssh/ssh_config` as you would with different machines:
``` bash
# .ssh/config
Host laptop.lan
HostName 192.168.1.2 # Internal network IP
Host laptop.sdn
Hostname 10.0.0.2 # SDN IP
```
That way, I would connect to each one of them depending on the situation. Using tmux and ssh is not that much of a problem
since I could just detach from home, go away, then connect via SDN an everything would be there (though I had to remember
which alias to use instead of just `ssh laptop`). For VSCode is not that convenient since I would need to close the connection,
made a new one to the new host and so on. Surely we could made this simpler, right?
In my home network, my main router is also my DNS server (with Ad Blocking, rules and all kind of fancy things), and that
server resolves my local domain (`*.lan`) to LAN IP Addresses, so I can start with a simple config as I had previously:
``` bash
# .ssh/config
Host laptop
HostName laptop.lan
```
Now, what happens if I'm not at home? I could solve this in several ways:
- I could `ping` my router, but that could collide with other networks out there.
- I could check if my Wifi BSSID is one of the APs at home, but I could also connect via Ethernet.
- I could check if I can resolve the `laptop.lan` address, though this requires network access, but in the end is the one I ended
up using.
``` bash
$ dig +short laptop.lan
192.168.1.2 # At home
$ dig +short laptop.lan
# Empty result when away from home
```
Now, here comes the [`Match`](https://man7.org/linux/man-pages/man5/ssh_config.5.html) magic:
``` bash
# .ssh/config
Host laptop
HostName laptop.lan
Match originalhost laptop exec "[[ $(/usr/bin/dig +short laptop.lan) == '' ]]"
HostName laptop.sdn
```
Using `Match` we can replace properties for a defined host using matches. In this ad-hoc example what I did is:
- `Match originalhost laptop`: The connection host need to match `laptop`
- `exec "[[ $(/usr/bin/dig +short laptop.lan) == '' ]]"`: Execute `dig` and try to resolve my LAN's laptop domain name.
This needs to be a successful command for it to match, in this case we compare `dig`s output to an empty string to evaluate
if we can resolve the `laptop.lan` domain name (check the `[[ ]]`).
- `HostName laptop.sdn` If both rules match, replace the `HostName` property with the laptop's SDN domain name.
This is a pretty easy way to just `ssh laptop` wherever I am. I didn't knew about this particular
keyword until today, and it's pretty powerful!
Documentation: [ssh_config(5) manpage](https://man7.org/linux/man-pages/man5/ssh_config.5.html)