💾 Archived View for missbanal.net › atom.xml captured on 2023-04-19 at 22:25:55.
⬅️ Previous capture (2023-03-20)
➡️ Next capture (2023-06-14)
-=-=-=-=-=-=-
<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <id>gemini://missbanal.net/</id> <title>Willow's feed</title> <updated>2023-04-04T12:17:45Z</updated> <link href="gemini://missbanal.net/" rel="alternate"/> <link href="gemini://missbanal.net/atom.xml" rel="self"/> <entry> <id>gemini://missbanal.net/status-update-2023-03/</id> <title>Status update mar 2023</title> <updated>2023-04-01T00:00:00Z</updated> <link href="gemini://missbanal.net/status-update-2023-03/" rel="alternate"/> <content type="html">Hello you. Time to recap what happened to me this month. This should be quick. I don't know if the clock change broke something, but this month passed fast! ## Professional situation In short: 20 days to freedom! I'll have plenty of time to finalize Fossbill. This will be my very first focus because I want a reliable, and working project that I could be proud of. I really don't expect too much of it. If it becomes just a proof of my values, and a tool I can rely on, it would be enough to me. Next I would like to help as I can hire.sr.ht. This is a work in progress SourceHut subspace to seek at hackers. I would prefer to not advertise myself on some rival headhunter platforms. I wish to work on FOSS projects as much as possible. And depending on the situation, I also plan to study kernel driver development. I'll probably finally take time to dig into Helios. I expect the whole code base to be lighter than reading Linux code directly. Hoping the learning curves would be softer, as I will be more fluent with Hare than with Linux C specific ecosystem. ## Sxmo released Some days ago we took some time to release Sxmo, and all subprojects. It went as expected, and we didn't encounter much unplanned edge cases. I just fixed and flagged some minor patches into a 1.14.1 sxmo-utils, to cover a really specific cases where sxmo wasn't checking wakelocks as expected, if an idle inhibiter programs was running. Example if mpv was playing something while the device went in screen-off with a user manual action. ## Fun with NFS + FS-Cache + Cachefiles + OpenVPN Before today, I used a simple Syncthing shared folder to sync my musics between all my devices. The problem is that this music folder now weight ~50 Go, which is a problem for my lightest devices (rockpro64, pinephones). From years and years, I looked at solutions or alternatives to avoid this problem. But today I think I found a way. To quote kernel.org: FS-Cache is a module that provides a caching facility to a network filesystem such that the cache is transparent to the user. The more obvious, and FS-Cache supported network filesystem is NFS. Mhh, I have to set up a bunch of things before I could listen to my musics again... In my Alpine client machines, running the cachefilesd daemon is all I have to do for the FS-cache/Cachefiles part. I can optionally edit the config file /etc/cachefilesd.conf to change the fscache folder path, or the culling limits. Next I have to prepare my server machine to offer the music folder as a NFS. Install nfs-utils, and edit /etc/exports so that the client machines can mount the music path. Then start the NFS daemon and it is done. I initially used read only export rules, but now I have to find a better way. NFS doesn't offer authentication, nor encryption by itself. To have a secured and private NFS, I have to set up a VPN. I avoided this as much as possible through years. But now, it is time. I am ready. And in fact, setting up a self-hosted OpenVPN server isn't that bad. The most tricky part is to understand, prepare, and sign carefully the certificates. The basic idea is to give to OpenVPN the CA certificate, so that it can check that the client use signed ones, with the same CA. On Alpine, we can install easy-rsa to help on this step. Then we rsync the folder /usr/share/easy-rsa/ to a specific folder, one for each client, and one for the CA. Ideally this should be done on all different systems, so that the private keys never leaks. I'll not dig into too many details, here is a good step-by-step: => https://github.com/OpenVPN/easy-rsa/blob/v3.0.0-rc1/README.quickstart.md With all signed client and CA certificates, I am pleased to discover that the rest of the OpenVPN config is very simple. Configuring clients is also very straightforward. Start every daemon, and check with `ip a` that it works. Now that all of my machines talks to each other in a secured way, I can mount my NFS folder through this VPN. The FS-cache works as expected and the cache growths as my system read the files. If I never listen to a music, it never gets downloaded. If storage become rare, the less used cached files will be culled out of the local storage. It is perfect! That's all for this month! Have a nice weekend! Thanks for reading me. </content> <author><name>Willow Barraco</name></author> </entry> <entry> <id>gemini://missbanal.net/status-update-2023-02/</id> <title>Status update feb 2023</title> <updated>2023-02-25T00:00:00Z</updated> <link href="gemini://missbanal.net/status-update-2023-02/" rel="alternate"/> <content type="html">Hey there! Let's try to recap what I've done this month. ## Professional situation I'll keep it short this time, promised! I finally resigned. This situation was painful to me, and unnoticeable for my employers. This was going nowhere better, so I decided I'll choose how and when it will end. I still got a two-month prior until my contract actually ends. It will continue to be painful but at least, I see the end now. Fortunately to me, my lifestyle and personal situation don't require important revenues. So I will have months, maybe a year before it really become precarious. I'll have even more time if I manage to obtain unemployment revenue dues. And if nothing works, well I would just knock at to some company doors, and see if they need another developer, for another proprietary ERP web suite. I would say my mental health is way better :) ## Sxmo support Sway upstream! My monthly spam on the channel #sway-devel finally worked! Two Sway folks reviewed the touch seat operation implementation, and after some iteration, we had it merged. => https://github.com/swaywm/sway/pull/6455 Sway Merge Request - Implement seatop_touch To close this topic, let's recap what it does, and why we needed it that much: On Wayland compositors, the applications only receive events that concern their own surface. A program that is not currently focused don't receive keyboard key press, nor that they receive touch or pointer events outside their "window territory". When I worked on sxmo to support Sway, I had to choose which dmenu like program we will use on this compositor. I chose bemenu because it was the more mature, and the more complete solution. But bemenu was not supporting pointer nor touch events yet. I had to implement those! While coding it, I quickly noticed that the bemenu Wayland backend stopped receiving my touch motion events as soon as I was leaving its surface. It was a problem because the behaviors I was intended to implement would require those events. On sxmo menus, if you hold a touch contact, and leave the surface by the top/bottom edge, it should ask you to go to the previous/next page if you release. What was missing: If you initiate a touch from a surface, the futures events related to this touch (motion or release), should continue to be noticed to the initial surface. Touch position should be relative to the surface. Also, x and y could be negatives or higher than the surface weight or height. In the Sway nomenclature, it is called a seat operation. Touching a surface should initiate this kind of operation, and make next events to behave differently. This is what the Sway merge request is all about! ## About bemenu This week I also took time to test the master branch of bemenu. I saw they implemented two features that we will really appreciate on sxmo, border and fixed height. I haven't much to say about borders. This make the bemenu surface more visible while above other terminals. I just noticed they somehow failed to render correctly the right border. It took me some minutes to figure out they forgot to compute the width using the correct scaling value. It means the right border actually was far away outside the surface. Now let's speak about the fixed height. Previously, bemenu height was recomputed while the entries count was shrinking with filters. It was unpractical on desktops cause the filter line and results was moving on almost every keystroke. And then on mobile it was also unpractical cause filtering was shrinking the height so that it became painful to use touches to select an entry. Enforcing a fixed height made the bemenu positions predictable. While trying this on my Pinephone sxmo, I noticed that the newly generated blank space above the last entry was causing behavior issues with the pointer and touches. I pushed a fix to make it more pleasant to use on mobile. I am now waiting for bemenu to release, and I'll add the needed configuration in sxmo-utils. Peter is also working on stripping some part of the sxmo-dwm status bar so that it will "make dwm and sway look identical". I think he will be pleased to see that now bemenu looks almost exactly like dmenu. ## Sxmo suspension overhaul Aren, a prolific sxmo contributor, brought this topic some weeks ago. Thanks to him, long debates, implementation tentatives, and iterations, we re-implemented almost completely how and when we suspend in sxmo. A bit of context: In sxmo we got three state which are "unlocked", "locked", and "screenoff". While in screenoff, we want to suspend basically as soon as possible. But some rules could restraint this. If an ssh session is connected, a player is running, a modem related action is in progress, we have to hold suspension until there is no more "reason". We had a script named `sxmo_mutex.sh` which was serving this purpose. It could `lock` or `unlock` to maintain the list of reason, and `hold` until the reason list is empty. Additionally, we have an extendable hook to check periodically a bunch of condition, and update the reasons (ssh, mpris player, etc). The fun part is that we could actually rely on the kernel itself to implement this. If Linux is compiled with the enabled capability (CONFIG_PM_WAKELOCKS), it will expose to the user space some interfaces to manipulate wake locks. Reading `/sys/power/wake_lock` give the list of the current wake locks. Writing to this file register a new one, with a conditional argument <timeout> in nanosecond after which the wake lock will automatically expire. Writing to `/sys/power/wake_unlock` remove a wake lock. We replaced our `sxmo_mutex.sh` calls to a `sxmo_wakelock.sh` new script that expose a simple API to manage wake locks. Then we had to choose how we should use this to actually suspend. First option was to write "mem" to `/sys/power/autosleep`. It would enable opportunistic suspension. When no wake locks remains, the kernel will suspend by itself. To keep some kind of control we just have to toggle a kind of "not_screenoff" wake lock while switching from one state to another. Unfortunately we still got some edge cases features that prevent us from relying on this. In sxmo we make it possible to ask for a specific suspension time. It is mostly useful to wake up on time for a cronjob by example. We chose for now to keep some kind of control over suspensions. Instead, we chose to use `/sys/power/wakeup_count`. Reading this file block until there is no remaining wake lock. Writing an integer to this would fail if the number is not the current wake lock count. If writing succeed, it will make the kernel to abort the following suspension if new wake locks has been registered in between. With this, we implemented a very simple `sxmo_autosuspend.sh` daemon that will just loop over and try to suspend when no wake lock remains: => https://git.sr.ht/~mil/sxmo-utils/tree/master/item/scripts/core/sxmo_autosuspend.sh sxmo_autosuspend.sh More documentation here: => https://github.com/torvalds/linux/blob/db77b8502a4071a59c9424d95f87fe20bdb52c3a/Documentation/ABI/testing/sysfs-power Linux ABI - sysfs-power List of the benefits: - Less code on our side to manage the list (and hopefully a more robust code from the kernel) - We decoupled suspension from the screenoff hook itself. `sxmo_autosleep.sh` now is a daemon supervised by superd. - We used wake locks <timeout> values everywhere except in some specific cases ("not_screenoff" by example). Hopefully, it will fix all "my phone was awake when I found it" issues. - The kernel gives useful wake lock statistics with `/sys/kernel/debug/wakeup_sources` - This open possibilities to other programs and daemons to manage their own wake locks so that sxmo does not suspend while they are busy. We should now implement this on eg25-manager and ModemManager, additionally to their elogind support. ## The other stuff I have done a bunch of other stuff, mostly for sxmo this month. I'll not cover everything with deep explanations but here some tl;dr: Peter initiated some status bar icon improvement. Recent releases of Nerd Font added a lot of new cool icons that we really needed. Say "bye bye" to the thermometer that display the modem signal strength. We are waiting for nerd-font update to be merged in aports so that we could merge everything in sxmo-utils. Peter also got additional patches ready to be applied later. I worked on sxmo-dwm to drop the patch to support multi-key, so that I could write a new one to support key-up and key-down events. It now allows us to connect sxmo-dwm to Bonsai and so, unify both our Sway and Dwm environments. Now I can grow more complex Bonsai tree, to handle more complex situations than "sequential hardware button clicks" Fossbill didn't have much of my attention this month. Still, I took some time to adapt the bills workflow and manage an extra "quote" state between "draft" and "bill". I also configured and integrated SQL migrations with Alembic, so that futures changes will be easier to do. And finally, I managed to configure automatic builds of my personal aports. There is also a recipe to cross-compile aarch64 packages using qemu-user. It allows me to skip compiling software on my poor devices. It is such a pleasure to drop nightly recipes, and then upgrade on all my devices to install them. I took more time, and used tools to help me to write this. Hopefully with less english mistakes! If you notice some remaining problems, feels free to contact me. Thanks for reading! </content> <author><name>Willow Barraco</name></author> </entry> <entry> <id>gemini://missbanal.net/status-update-2023-01/</id> <title>Status update jan 2023</title> <updated>2023-01-31T00:00:00Z</updated> <link href="gemini://missbanal.net/status-update-2023-01/" rel="alternate"/> <content type="html">Hello there! I expected that this status update could be shorter than the previous one, but then I started to tell the my life's tale. So, let's get started! ## Personal situation and backstory In those early 2023 days, I went to my ex-boss and explained that I had to leave. That my values are too disaligned with those of the company. That was the tl;dr: I have been working for Synbioz for three years, a french web-development company that focuses on Ruby on Rails development. The company markets some values that are aligned to mine. Things weren't perfect, but it was fine enough. We were using the Google toolsuite for everything, from mails to meets, but were also self-hosting Mattermost and some other okay-tier programs. We were hosting client services under AWS, but were using GitLab and signing our emails with gpg. It was barely good enough for me to stay, but I had other concerns in my personal agenda that were more important. This company has recently been sold to Ouidou, another French company that was founded just 4 years ago. This company already staffs 150 employees around every corner of France. Its fast growth already worried me, because I didn't choose to work for a company with a headcount of about 10 just to end up working for a mega-corporation. The toolset rapidly and dramatically changed, moving from Google (already bad) to Microsoft… Outlook never allowed me to use emails in my setup . Our GitLab plan has been stopped, breaking some CI jobs and removing some features. Our access to our password solution has been closed. Even in the marketing corner, no place for some remaining Synbioz values. So, I knew I would have to leave at some point. I asked politely to leave; I planned to start my own self business. To help me with that project, the safest approach was for me to finish my work contract with what we call in France a "Rupture conventionnelle". Both the employee and the company agree that they should split. This isn't a fire nor a resignation and it allows the employee to earn some unemployement assurance. It also would grant me some financial stability to start a fresh project. My ex-boss agreed, but explained that he isn't the one that making this kind of decision anymore. He asked the HRM, who rapidly refused. The answer was that it would cut into their margins. I could leave anytime cause they basically don't need me. I just have to resign. I felt betrayed because I has been put in a precarious situation without any notice. This made me angry, sad and frustrated, and really affected my mental health. At this point, I am still unsure of what I should do and how. In a perfect world, I would begin my self-employment and work for projects I love. I code for good software that will last, and I build a stable ecosystem of partnership and self-hostable SaaS solutions. I do some consulting and missions on the condition these concern FOSS projects. I take more time to seriously study the Linux kernel and low-level language development (I have more appetite for those than for web development today). I work from home, on my own schedule and rely on a FOSS toolsuite of self-hosted or partnered solutions that I share values with. I'm terrified that I might not be capable of building this stable lifestyle, but I know that I should at least try to! ## Fossbill I was thinking about software I would need as a freelancer, and the most missing part to me was be a billing tool. I asked the Fediverse what FOSS freelancers used, and found no clear answers. This was a perfect occasion to play with Flask again! I started to code for fossbill.org, a simple and fast billing solution with a very tight scope. I need to be able to: - generate drafts and bills easily - compute invoice amounts and taxes - send drafts and bills by email - keep a log of activity (creation date, sent date) - mark bills as paid I think this should cover most of my micro-freelancer needs, at least while starting. It is a great occasion for me to try to build a SaaS service and to gain some experience in that business model. Even if it doesnt take roots, this made me build a real world Flask + SQLAlchemy tool from scratch. This project still is under development and some domain features are still lacking. Some other features I still have to implement cover the business plan: - data import/export - user payment registration - customer invoice generation (for the SaaS service itself) - user customisation configuration ## Following sxmobar - Sxmo status reforged Last status I wrote I initiated an overhaul of the sxmo status bar component displaying. This works is now complete and is waiting for its dependencies to be released. Here are some details: The design is simple: sxmobar only manages the bar components. There is no battery nor network nor any kind of embarked monitoring. You can use it like so:
sxmobar -w -o pango|tty|plain # display and follow the bar on updates
sxmobar -a a-component-name 10 "My component" # add (and override) a component "My component" with order priority 10
sxmobar -d a-component-name # Delete the component
You then use monitoring tools that trigger updates to bar components. This implementation has to be robust and keep a consistent state of the components. Both processes do NOT communicate through IPC nor sockets. Concurrent addition, update or deletion shares a single state file. Re-writing this state file triggers a redraw of the status bar in every sxmobar process that watches. The bar should be displayable as plaintext, tty or pango markup. Which means that the bar can be displayed as swaybar content and as a ssh tmux status line at the same time. Bar components have a foreground and background color, a style and a weight that is specified when adding them. I had to add some missing syscall glue code to Hare for inotify and flock to respectively watch for file rewrite, and prevent concurrent reads and writes. ## See yaa Mhh, and I think this covers my productive time this month. I was less active than usual, as I had difficulties preventing me to focus on interesting problems. I still don't have the structure or freedom I want yet, but if you want to hire me for some cool projects, I am ever open to propositions! Willow, out. </content> <author><name>Willow Barraco</name></author> </entry> <entry> <id>gemini://missbanal.net/status-update-2022-12/</id> <title>Status update dec 2022</title> <updated>2023-01-03T00:00:00Z</updated> <link href="gemini://missbanal.net/status-update-2022-12/" rel="alternate"/> <content type="html">Here my first status update post. I would like to write some of those from now. Just to have a periodic public report of topics I'm working on and things I've done. ## Personal situation This end of year was a perfect occasion for me to take holidays. It's been some years I didn't gone 3 weeks free. This was a perfect moment to clear my todo list of things, to apply some important sxmo patchs and to code for fun. ## sxmo-sway rebased over 1.8 Unfortunately we have to continue rebasing the touch seat operation patch above sway release for some time. I periodically ping sway folks for it to be reviewed and to land in master. The rebase wasn't hard and just some minor fixups was necessary. Nothing broke in the process and now some weeks has passed without issues. ## Hare developments The development of hare-ev arrived in a perfect moment for me to play with it. As I wrote bonsai, an final state machine we use on sxmo to trigger multikey actions, I learnt to hate polling over a list of file descriptor. I still lack some understanding of kernel basics but I slowly close the gap. Hare-ev allow to write hare programs that responds to events, requests, responses in a very easy way. It basically does what you would expect. Register files, connect actions on writes / reads. Plus it arrived with some sugars to handle socket connections, timer triggers, etc. Still I struggled with some issues. It took me some time to report them in a clean enough way to be analysed upstream. Now that most problems are fixed and merged I was able to re-implement some things in bonsai. => https://git.sr.ht/~sircmpwn/hare-ev hare-ev ## Bonsai improvements Bonsai daemon and clients communicate over a unix socket. The daemon also had to handle delay transitions in an asynchronous way. I was using a very ugly way, forking to a sleeping process that would eventually be killed, or woke up to notice to the main process the state had to be updated. Noticing through a pipe I was barelly cleaning up afterward. Rewriting all of this with hare-ev was a real pleasure and simplified all of that crap. I also took time to learn more in detail how to manage more cleanly some memory allocations. The v1 was full of big memory leaks… I still have to wait for some dependency to be released to finalize this work. Until that point, I continue to run master on my local pinephone and didn't noticed problems for days now. The daemon is way more stable and light so I'm very impatient to release it. => https://sr.ht/~stacyharper/bonsai/ Bonsai ## Sxmo status reforged In sxmo we used a very simple script sxmo_status.sh to show the bar, manage components, or to tail it to the Sway bar. Over time we added some pango markups to show some colors or font style. Pango markup doesn't works yet on the dwm bar, nor on plain tty. I initially tried to handle it in with special components nomenclature, that would be stripped accordingly in those environments. The problem is that it make sxmo_status.sh too complex for a shell script. And worsely, the hook that compute the components became horrible to write and to maintain. It was very easy to forget some pango components and to break the global structure. It also broke the simple separator logic. In all ways, it wasn't the good approach. Some days ago I initated a Hare program (again) to manage those use cases cleanly. The component structure got a name, priority, content, style enum, fg and bg color enums. The tail daemon will output in plain, tty or pango. Multiple daemons will be able to tail accordingly in Sway bar, tmux status line or wathever. I hope to finish this work this week so that I can try it on sxmo very soon. I'll have to beta test it a lot cause a crash on the daemon would break completly the status bar without easy way to restart it. ## Conky 1.16 released with Wayland support A very surprising news came from the Conky folks recently. I received a mail noticing activities on a 2014 old ticket about Wayland support for conky. On sxmo we built a dedicated solution to display things on Sway desktop cause we wasn't expecting for it to arrive never. I immediatly tried master to give early feedbacks. One of the main dev took time to cleanup builds and I updated the recipe in the Alpine side for it to land correctly. There still is some minor problems with colors and rescalling but the team seems very responsive to my tickets. I think this could be stable in a very short time. => https://github.com/brndnmtthws/conky/releases/tag/v1.16.0 Conky 1.16.0 release message ## Plans for future This year will not be easy for me. I'm planning to quit my job because I would like to live from foss development. Or at least to try to. It's been years now I'm doing this in my free time and I now feel a real dichotomy with my professional life. My current company has be bought recently and I'm now in a structure I really don't like. Using tools I never would have used before. This is also why I took time to cleanup my websites and to refresh this blog. I must start to give public feedback of what I'm doing. And to detail why I think those matter. Happy new year to you :) see ya! </content> <author><name>Willow Barraco</name></author> </entry> <entry> <id>gemini://missbanal.net/how-to-manage-shell-daemons/</id> <title>How to manage shell daemons</title> <updated>2022-01-14T00:00:00Z</updated> <link href="gemini://missbanal.net/how-to-manage-shell-daemons/" rel="alternate"/> <content type="html">While writing shell script, it is pretty common to need to manage some daemons. Example inspired from sxmo-utils where we got a sxmo_modemmonitor.sh script that listen to dbus signals to dispatch notifications.
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" | \
while read -r line; do
notify-send "$line"
done &
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" | \
while read -r line; do
notify-send "$line"
done &
This script got a huge issue. It will exit itself after reaching the end of the file. That mean you cannot control the two dbus-monitor subprocess anymore. You'll have to kill each of them manually.
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" | \
while read -r line; do
notify-send "$line"
done &
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" | \
while read -r line; do
notify-send "$line"
done &
wait
wait
This is a better idea. The two wait will make the script to wait for subjobs to finish. But we still doesnt manage the subprocesses. If you want to be able to clear subprocesses with Ctrl+c or with a kill signal you will do something like this:
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" | \
while read -r line; do
notify-send "$line"
done &
PID1=$!
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" | \
while read -r line; do
notify-send "$line"
done &
PID2=$!
gracefulexit() {
kill "$PID1"
kill "$PID2"
exit 0
}
trap "gracefulexit" INT TERM
wait "$PID1"
wait "$PID2"
This is the most common way to handle subprocess in shell scripts. But it got one main big issue: `$!` is the pid of the while loop only, not the `dbus-monitor`, not the both of them. In consequence, killing those PID in the trap handler will leave alone the dbus-monitors subprocesses unmanaged. So how to manage those? This is the clean way:
FIFO1="/tmp/fifo1"
mkfifo "$FIFO1"
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" \
>> "$FIFO1" &
PID1=$!
while read -r line; do
notify-send "$line"
done < "$FIFO1" &
PID2=$!
FIFO2="/tmp/fifo2"
mkfifo "$FIFO2"
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" \
>> "$FIFO2" &
PID3=$!
while read -r line; do
notify-send "$line"
done < "$FIFO2" &
PID4=$!
gracefulexit() {
kill "$PID1"
kill "$PID2"
kill "$PID3"
kill "$PID4"
rm "$FIFO1"
rm "$FIFO2"
exit 0
}
trap "gracefulexit" INT TERM EXIT
wait "$PID1"
wait "$PID2"
wait "$PID3"
wait "$PID4"
This use named pipe fifo files to separate both commands and to grab each pids. Here is two tips to make it simple and clean:
daemon_pids_cache="$(mktemp)"
start_daemon() {
"$@" &
printf "%s\n" "$!" >> "$daemon_pids_cache"
}
stop_daemons() {
while read -r PID; do
kill "$PID"
done < "$daemon_pids_cache"
rm "$daemon_pids_cache"
}
PIDS=""
start_daemon dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" | \
while read -r line; do
notify-send "$line"
done &
PIDS="$PIDS $!"
start_daemon dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" | \
while read -r line; do
notify-send "$line"
done &
PIDS="$PIDS $!"
gracefulexit() {
stop_daemons
for PID in $PIDS; do
kill "$PID"
done
exit 0
}
trap "gracefulexit" INT TERM EXIT
for PID in $PIDS; do
wait "$PID"
done
</content> <author><name>Willow Barraco</name></author> </entry> <entry> <id>gemini://missbanal.net/perfect-znc-setup/</id> <title>Perfect ZNC Multi-Client Setup</title> <updated>2021-05-28T00:00:00Z</updated> <link href="gemini://missbanal.net/perfect-znc-setup/" rel="alternate"/> <content type="html">By default, ZNC handle the playback. When no client is connected, it will store missed messages and play them back when you log in with an IRC client. But if you got multiple IRC client in multiple device, login with one of them will make the others to never receive the messages. clientbuffer is a module to fix that! It will track what message all of your IRC clients received. ## Configure clientbuffer We have to compile it as it is not a base module.
$ apt install unzip znc-dev
$ curl -o v1.0.48.zip https://github.com/CyberShadow/znc-clientbuffer/archive/refs/tags/v1.0.48.zip
$ unzip v1.0.48.zip
$ cd znc-clientbuffer-1.0.48/
$ znc-buildmod clientbuffer.cpp
$ mkdir -p /var/lib/znc/modules/
$ cp clientbuffer.so /var/lib/znc/modules/
## Connect to ZNC Use this as username: "username@CLIENTNAME/network" Here CLIENTNAME will be used by clientbuffer to identify this client. Make it unique per client. ## Enable clientbuffer on each network
/msg *controlpanel set AutoClearChanBuffer $me False
/msg *controlpanel set AutoClearQueryBuffer $me False
/msg *status LoadMod clientbuffer autoadd timelimit=86400
git push origin d575e61a:a-super-dev -fn
You can notice the `-fn`. The distant repository will then give you something like
To git.sr.ht:~stacyharper/a-good-project.git
+ cfc907c4...d575e61a d575e61a -> a-super-dev (forced update)
You now can `git diff cfc907c4..d575e61a` (removing one dot) to display the difference. If it seems correct, you then can use the same git push command, removing the last `n` argument. </content> <author><name>Willow Barraco</name></author> </entry> <entry> <id>gemini://missbanal.net/why-gemini/</id> <title>The web is dead</title> <updated>2020-09-19T00:00:00Z</updated> <link href="gemini://missbanal.net/why-gemini/" rel="alternate"/> <content type="html">Mozilla Firefox is falling and becoming a sponsorship showcase, only subsist in the mainstream line Google Chrome and other Chromium derivates, Safari which has never been a concurrent, and other minor alternatives as Webengine ones. At writing time, Chrome owns 81% of the web browser usage statistics. This huge usage monopoly give Google a real power over the web evolutions. Pushing new features as standards forces concurrent to follow implementations or to become obsoletes. WWW tend towards complexity. A this time, it is no longer possible for someone or worse some company to build a new web browser. The scope of feature a web browser have to provide is now way to large to be developed, worsly to be defined. So the only web browser that exists and will exists in the future are the ones that already exists at the moment. Here was a rapid part of the state of the world wide web at this writing time. However, the WWW firstly was a way to easily share contents based on a simple HTTP markup language. A simple but complete web browser could be wrote by a small group in a pretty decent amount of time. This gave the web its decentralized, not owned and XXX spirit. Somehow people lost the control over the web and we are now in a state where:
=> /foo An url
=> gemini://my.capsule.com/foo Another url
'''
a pre-formated
content
'''
Everything not listed here is not allowed by the language. As you can see, only 3 title levels exists. The way to display it is up to the client choice. This is not the content owner that choose how to display it. ## Conclusion The Gemini community still is pretty new but very active. People take pleasure to write personal capsules (the Gemini way to refer to websites) and other blog related content. People use this environment to share thoughts easily. There already is two search engine and aggregated feeds to browse content from the Geminiverse. </content> <author><name>Willow Barraco</name></author> </entry> <entry> <id>gemini://missbanal.net/unit-tests-the-curse-worse-than-the-causes/</id> <title>Unit tests, the curse worse than the cause</title> <updated>2020-08-12T00:00:00Z</updated> <link href="gemini://missbanal.net/unit-tests-the-curse-worse-than-the-causes/" rel="alternate"/> <content type="html">Criticizing unit tests is uncommon. Anyway I'll try to explain why I think we should stop writing them. Unit testing is a practice that generally follow when you learning about the SOLID principle. Having a single responsibility per subject is commonly narrated to simplify testing.
class FooRepository
def get_foos
...
end
end
class GetFoosUseCase
def initialize(foo_repo)
@foo_repo = foo_repo
end
def call
...
end
end
One of the approach to test this code is to write unit tests that will check every class independently. The idea is that if every tests passes, then the whole project should be fine. This structure, with injected dependency truly give the hand to the testes to create dedicated contexts around tested subjects.
class TestGetFoosUseCase
mocked_repo = Mock.new.to("get_foos").reply(["a mocked foo"])
subject = GetFoosUseCase.new(mocked_repo)
def test_get_foos
assert subject.get_foos == ["a mocked foo"]
end
end
Do you think this test is stupid and tautological ? I think most of contextual tests actually are. Anyway, to write this kind of tests you got to know how the `GetFoosUseCase` works as you got to know that a call to `@foo_repo.get_foos` is done somewhere. That why I think the ideological "write tests first" is a myth in the unit test world. So now my point is: You though very hard to write SOLID classes and method, limiting coupling as much as you can, and THEN you wrote a completely coupled test suite, as the tests got to know how the context around the subject is working.
class TestGetFoosUseCase
def test_get_foos
assert container("GetFoosUseCase").get_foos == ["a fixtured foo"]
end
end
I think this test code got a huge value, way more than the previous one. It cover way more code as it will go through the `GetFoosUseCase` and the `FooRepository` classes. It will stay the same if you re-factorise both those classes so it is easier to maintain. You can add features in the `GetFoosUseCase` and this test will still be valid and tells you if it still return the fixtured foo. Does this functional test is perfect? Not at all. But it will perfectly serve the automatic test suite purpose: