refactor: moved to hugo
This commit is contained in:
parent
4c6912edd0
commit
e77e5583c2
604 changed files with 1675 additions and 2279 deletions
BIN
content/blog/2021/10/02/september-2021/image.jpg
Normal file
BIN
content/blog/2021/10/02/september-2021/image.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 MiB |
98
content/blog/2021/10/02/september-2021/index.md
Normal file
98
content/blog/2021/10/02/september-2021/index.md
Normal file
|
@ -0,0 +1,98 @@
|
|||
+++
|
||||
title = "September 2021"
|
||||
date = 2021-10-02
|
||||
+++
|
||||
|
||||

|
||||
|
||||
<div class="text-center">I love having this at _somewhat_ walking distance. Can you spot my shadow?</div>
|
||||
|
||||
<!--more-->
|
||||
|
||||
## Projects & Personal
|
||||
|
||||
I manage to fulfill my "development needs" so much at work that I try to use my spare time in other hobbies nowadays. Not that I don't have pending things to do, I just don't feel like spending much time on the computer after work anymore.
|
||||
|
||||
The few things I have been doing are looking for an alternative to the Firewalla at home. I'm thinking on installing opnsense on the Firewalla SoC cause it just don't really suit my needs. The problem is that opened a whole set of questions again on how to setup and sort all network devices at home, how I'm going to manage (server and networking side) the public and private services I have and so on. I would like to try it before just giving up on my current router directly, so I need to setup this on a VM and start playing with it to check if it does the essential things I want it to do.
|
||||
|
||||
Another thing I have been spending time theses days is sorting out my note and habits management. I tend to scribble on paper and just forget about it for current projects, but sometimes I write something that should be more persistent over time. So good luck past/present/future me figuring out how to handle that.
|
||||
|
||||
On the habit side I'm trying out [Habitify](https://habitify.me) just to know how much of my work/personal/leisure time I spend "correctly". That's the best thing I found to track this kind of "tasks", but I don't like the subscription model at all... if anyone has a suggestion that is either self-hosted or single-payment please [contact me](/about/).
|
||||
|
||||
Also, as always, I've been improving my Home Assistant instance with new things. But that's the usual once you enter this world.
|
||||
|
||||
## Books
|
||||
|
||||
- Up to date with [**DICE**](https://www.webtoons.com/en/fantasy/dice/list?title_no=64)
|
||||
|
||||
- Ongoing with [**One Piece**](https://www.goodreads.com/series/57193-one-piece): Volume 56.
|
||||
|
||||
- Finished [**Ruin and Rising**](https://www.goodreads.com/book/show/14061957-ruin-and-rising)
|
||||
|
||||
Talk about a long road... finally finished the trilogy. This final sprint has been a bit rough, and it almost made me read some pages a bit "diagonal" just to end it. Got really boring at the end if I must say. I do not plan on reading anything else for this saga.
|
||||
|
||||
- Started reading [**Japón con Jamón**](https://www.goodreads.com/book/show/48562648-jap-n-con-jam-n)
|
||||
|
||||
This has been on my bookshelf for a year or so now. I just couldn't read anything Japan related because it reminded me a lot of the time I spent there. But well, after two years it's time to go on. Sadly it seems that it's not in anything but Spanish...
|
||||
|
||||
## TVShows and Movies
|
||||
|
||||
- For lunch and dinner time [**One Piece**](https://www.crunchyroll.com/es-es/one-piece)
|
||||
|
||||
- Watched [**Rick and Morty: Season 5**](https://es.hboespana.com/series/rick-and-morty/3be6e070-1044-4740-8478-2936de705e4c/season-5/2d8a1c0b-ad1c-46e2-aedd-475390b2d8da)
|
||||
|
||||
What an amazing season! The first two chapters were incredible, but the last two... oh my! I'm really glad I didn't spoil myself on social because I have enjoyed it a lot. I waited until all chapters were available in HBO so I could watch all chapters in a row. And oh my, I loved it! Not sure why people complain about this season -of course it has better and worse episodes- but overall it has been awesome. The worst part is waiting for the next season!
|
||||
|
||||
- Started [**Raised by wolves**](https://es.hboespana.com/series/raised-by-wolves/607e39f2-6d7c-4d1a-85d2-278ad1e270a1/season-1/1c7157fc-ad39-46fe-a44f-3972e51a80e6)
|
||||
|
||||
I had it in store for some time and only two episodes in... it has everything I like: Sci-Fi, Dystopian setting, robots, etc. But... it is a bit weird. Maybe I don't understand the message of something.
|
||||
|
||||
- Started [**Star Wars: Visions**](https://www.disneyplus.com/series/the-bad-batch/4gMliqFxxqXC)
|
||||
|
||||
It's finally here! As a fan of Japanese animation is awesome to watch some of them allowed to create a history on a Star Wars related setting. I don't know what to expect but so far I liked every episode, specially the one from Trigger... their art style and storytelling is amazing. Though I would've like to know more of each history, I'm happy that episodes are 15 minutes long.
|
||||
|
||||
- Started [**Marvel's What if...?**](https://www.disneyplus.com/series/what-if/7672ZVj1ZxU9)
|
||||
|
||||
Another that I was eager to watch this month and I managed to keep up to date until this point. I'm loving it so far and it seems that everything until this point is going to converge in the final episodes in one hell of a battle. I really hope they do more seasons.
|
||||
|
||||
- Started [**Y: The last man**](https://www.disneyplus.com/series/y-the-last-man/6GhSTQBktm34)
|
||||
|
||||
I wasn't expecting much from this one, but a friend told me about it and I put it off focus while I was doing some chores. It's average for my taste but at least the premise seems... interesting? I don't know. Let's see how it goes.
|
||||
|
||||
## Games
|
||||
|
||||
- Finished [**The legend of Zelda: The Minish Cup**](https://www.nintendo.es/Juegos/Game-Boy-Advance/The-Legend-of-Zelda-The-Minish-Cap-267486.html)
|
||||
|
||||
This game have grown old incredibly well. Mechanics, gameplay and even graphics are incredible. And I'm telling this in 2021 from a game that released in 2004, 17 years ago!
|
||||
|
||||
I played it on original hardware, a tuned GameBoy Advance SP with a FunnyPlaying LCD screen, and even if I liked the experience I had to play it through short sessions (maybe 30-60m tops) because the handhelds are so tiny that my fingers hurt a bit after some time. Also the SP is so narrow that my hands are almost touching. I'm not sure if I will play everything here, maybe only games that can be played for 10-15m (like Rhythm Tengoku) but I have my eye on Golden Sun 1&2 now... I'm glad I have emulation machines everywhere and a brand new [GB Operator](https://www.epilogue.co/product/gb-operator) that I can use to play on a bigger screen and backup my games and saves.
|
||||
|
||||
- Finished [**Doki Doki Literature Club!**](https://store.steampowered.com/app/698780/Doki_Doki_Literature_Club/)
|
||||
|
||||
Not going to say anything. Just play it. It's four hours or so of gameplay. Play it.
|
||||
|
||||
- Still ongoing with [**Baba is you**](https://store.steampowered.com/app/736260/Baba_Is_You/)
|
||||
|
||||
We didn't manage to get much time to play, but we're slowly going through it.
|
||||
|
||||
## [Articles](https://t.me/fmartingr_articles)
|
||||
|
||||
- **Developers**:
|
||||
- [I unlocked NVIDIA GeForce NOW and stumbled upon Pirates](https://medium.com/@ighor/i-unlocked-nvidia-geforce-now-and-stumbled-upon-pirates-dc48a3f8ff7)
|
||||
- [Four Months of Horizontal Game Production - Blog | Adrian Gaudebert](http://adrian.gaudebert.fr/blog/post/four-months-of-horizontal-game-production)
|
||||
- [How WhatsApp enables multi-device capability](https://engineering.fb.com/2021/07/14/security/whatsapp-multi-device/)
|
||||
- [Nitter and other Internet reclamation projects](https://drewdevault.com/2021/09/23/Nitter-and-other-internet-reclamation-projects.html)
|
||||
- [Start using tools again](https://h2x.sh/apple/) (_leaving Apple's ecosystem_)
|
||||
- [Disclosure of three 0-day iOS vulnerabilities and critique of Apple Security Bounty program](https://habr.com/en/post/579714/)
|
||||
- [Serving Netflix Video at 400Gb/s on FreeBSD](https://people.freebsd.org/~gallatin/talks/euro2021.pdf)
|
||||
- [Let distros do their job](https://drewdevault.com/2021/09/27/Let-distros-do-their-job.html)
|
||||
- [Playdate Pulp: Zero to video game in 60 Seconds](https://www.gamedeveloper.com/console/playdate-pulp-zero-to-video-game-in-60-seconds)
|
||||
- [Google and Facebook, I am facilitating packet filtering to block your tracking](https://peguero.xyz/blog/google_and_facebook_i_am_facilitating_packet_filtering_to_block_your_tracking.html)
|
||||
- [How does dithering reduce file sizes?](https://endtimes.dev/why-you-should-dither-images/#how-does-dithering-reduce-file-sizes)
|
||||
|
||||
- **Games**:
|
||||
- [How An Ionizing Particle From Outer Space Helped A Mario Speedrunner Save Time](https://www.thegamer.com/how-ionizing-particle-outer-space-helped-super-mario-64-speedrunner-save-time/)
|
||||
|
||||
- **Other**:
|
||||
- [Why we picture bombs as round black balls with a burning wick](https://www.atlasobscura.com/articles/why-we-picture-bombs-as-round-black-balls-with-a-burning-wick)
|
||||
- [video] [Can YOU fix climate change?](https://www.youtube.com/watch?v=yiw6_JakZFc)
|
|
@ -0,0 +1,62 @@
|
|||
+++
|
||||
title = "Storing data in Node-Red flows using contexts"
|
||||
date = 2021-10-11
|
||||
tags = ["Home Assistant", "Node-Red"]
|
||||
+++
|
||||
|
||||
I've been adding some automations to my Home Assistant recently so it can inform us of takeaway menu changes for local restaurants. We have a few favourites and they usually offer different options each day so checking for updates and notifying us via our Telegram bot is pretty easy.
|
||||
|
||||
<!--more-->
|
||||
|
||||
Since I didn't want to use any library or custom program/service to analyze the page I'm relaying this kind of work to the Node-Red service in my Home Assistant instance. It's a server that is always working, easy to set up, work and iterate from, and I already have some integrations in place for notifications and other QoL, so it seemed like a 110% win.
|
||||
|
||||
Despite having used Node-Red for various purposes along the years I usually delegated state to different services, databases or the filesystem. Not sure why I didn't check if Node-Red had something built-in-- which of course it had.
|
||||
|
||||
Node-Red has this concept of _context_. By default a context is stored in memory only, and you can get/set values from a node or from function nodes very easily:
|
||||
|
||||

|
||||
|
||||
> You can also edit contexts programatically from function nodes using:
|
||||
>
|
||||
> ``` js
|
||||
> msg.contentSize = 123 // From another node
|
||||
> flow.set("menuContentSize", msg.contentSize)
|
||||
> var value = flow.get("menuContentSize")
|
||||
> ```
|
||||
|
||||
In my case I wanted the data to persist service restarts and Node-Red provides a context store filesystem based which stores changes in memory and persists them to disk every 30 seconds, more than enough for my use case.
|
||||
|
||||
To enable it we need to modify the `settings.js` file of the Node-Red installation and add the appropriate `contextStore` parameters:
|
||||
|
||||
``` js
|
||||
{
|
||||
// ...
|
||||
contextStorage: {
|
||||
state: {
|
||||
module: "localfilesystem",
|
||||
base: "state" // This will store the data in ~/.node-red/state,
|
||||
},
|
||||
default: { module: "memory" }
|
||||
},
|
||||
// ...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
> In this example I created a new context store called _state_ using the filesystem module I talked before and additionally I set up the storage in a custom directory.
|
||||
|
||||
This way I can have two context stores: one in memory (the default) and one to store my custom states. You can create more for your use cases but keep in mind that you need to select a different `dir` for each of them so they wont collide. For more information check [the implementation details](https://nodered.org/docs/api/context/store/localfilesystem#implementation-details).
|
||||
|
||||
In order to select an store to use you have a dropdown in the change node:
|
||||
|
||||

|
||||
|
||||
> Or use the third argument`flow.set(key, value, store)`/`flow.get(key, store)` to select it programatically.
|
||||
|
||||
This allows for this very simple state checks in my case but allows for way more complex behaviors right out of the box.
|
||||
|
||||
I'm a very big fan of Node-Red. And I can use that so get notified of takaway menu changes now. Talk about a first world problem.
|
||||
|
||||
- References:
|
||||
- [Node-Red: Context](https://nodered.org/docs/user-guide/context)
|
||||
- [Node-Red: Local Filesystem context store](https://nodered.org/docs/api/context/store/localfilesystem#options)
|
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
Loading…
Add table
Add a link
Reference in a new issue