pyratelog

personal blog
git clone git://git.pyratebeard.net/pyratelog.git
Log | Files | Refs | README

commit 968b8e31c147f4d8e8dbbc0637f44f9f2c1c024d
parent e0c4696ac1b54f53777af151718d36bc9b3917a2
Author: pyratebeard <root@pyratebeard.net>
Date:   Fri, 18 Feb 2022 13:54:56 +0000

Merge branch 'main' into rnd.mov.rec

Diffstat:
Aentry/20220213-disperse_together.md | 31+++++++++++++++++++++++++++++++
Aentry/20220214-colemak_lvl_up.md | 23+++++++++++++++++++++++
Aentry/20220217-welcome_todo_my_nightmare.md | 98+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 152 insertions(+), 0 deletions(-)

diff --git a/entry/20220213-disperse_together.md b/entry/20220213-disperse_together.md @@ -0,0 +1,31 @@ +## the earth that was +The history of the Internet is a fascinating story. In the relatively short time it has been around, dating back to the 1960s, it has become one of the greatest technological achievements in human history. + +The Internet began decentralised, free from central control and ownership. Most of the Internet is still decentralised but there is an ongoing fight to stop this from changing. Governments and companies are all trying to get a handle on the internet and make sure people use it the way _they_ want. If you rely on one company, what happens when they decide to change their policies, or simply disappear? + +What if, instead of uploading all your content to a centralised platform, such as a single social media platform, you could run your own little copy of that social media platform? It could be made available to everyone, or to only friends and family. You have more control over it. + +So groups of people break away from the centralised social media platform. Create their own instance to post content amongst their friends, and these little silos are created. + +Once you've seen all the cat pictures and memes your friends have, you may want to break out of your instance. You find another group of friends that had also broken away from the main centralised social media platform, but you don't want to have to create an account on their instance when you already have one on yours. What if the two instance could be linked so content could be shared without having to join every instance? This is known as federating, and has been very common in technology. + +Take email, for example. Do you think email would be the same if GMail users could **only** email other GMail users? Email is based on a protocol which anybody can use. So GMail can send to Protonmail, because they both use the same protocol. + +Another analogy is the telephone network. Imagine picking up the phone to call a friend only to find out they use a different provider, so you can't talk to them. + +Now we have decentralised our social media, people or groups can have more control over their data. They can also federate with other instances of the same social media platform and build a little web of content. + +## no power in the 'verse +Social media using a decentralised federation model already exists. There are popular alternatives to Twitter ([Mastodon](https://joinmastodon.org){target="_blank" rel="noreferrer"}), Instagram ([Pixelfed](https://pixelfed.org){target="_blank" rel="noreferrer"}), Reddit ([Lemmy](https://join-lemmy.org){target="_blank" rel="noreferrer"}), and more. These alternatives allow you to join instances or create your own and then federate with other instances. A number of them also take it one step further and federate across different platforms. Imagine being able to follow an Instagram account from your Twitter account without having to sign up to Instagram. + +One of the most popular protocols currently enabling this federation is [ActivityPub](https://activitypub.rocks/){target="_blank" rel="noreferrer"}. If you join a Mastodon instance you can follow users from Pixelfed instances, Lemmy instances, [Peertube](https://joinpeertube.org){target="_blank" rel="noreferrer"} instances (a Youtube alternative), as long as the instances are federated. This has become known as the Fediverse. + +Admittedly, joining the Fediverse can seem quite daunting. I joined Mastodon in 2017. I did spend some time looking at the [instance list](https://instances.social/list#lang=&allowed=&prohibited=&min-users=&max-users=){target="_blank" rel="noreferrer"} but ultimately I signed up to the most popular instance, [mastodon.social](https://mastodon.social){target="_blank" rel="noreferrer"}. If you have used Twitter then you should find Mastodon easy to use. One notable difference is the Local Timeline and the Federated Timeline. The Local Timeline is every "toot" made from the instance you are logged into. The Federated Timeline is every "toot" made from any instance that is federated with the instance you're on. + +I use hashtags as a way to find content and users to follow. Search results should include all federated instances, giving you access to all the cat pictures and memes in the 'verse. + +Apart from Mastodon I have also recently started using Lemmy as a replacement to Reddit. I have been making a point of catching up on the Fediverse before looking at Twitter or Reddit. + +No social media is ideal for all users, but with decentralised instances you can find users with a common interest, or with values that you deem important , or even start your own instance. And by federating these instances you are not going to be stuck in a silo. + +I am by no means an expert on the Fediverse, but if you have any questions feel free to reach out using the contact information on my [home page](https://pyratebeard.net){target="_blank" rel="noreferrer"}. I would also be happy to hear any suggestions and recommendations of Fediverse accounts to follow. diff --git a/entry/20220214-colemak_lvl_up.md b/entry/20220214-colemak_lvl_up.md @@ -0,0 +1,23 @@ +It has been a [little over a month](20220113-colemak_exp.html) since I switched to using the Colemak keyboard layout and I am quite happy with how comfortable I have become with it. The first couple of weeks were tough. I found the extra concentration needed was quite draining and the frustratingly slow typing didn't help. + +I have used it every weekday for work, only using QWERTY on my phone and a couple of times on my laptop. By the end of each week I was finding it easier, then after barely using the keyboard over the weekend the first couple of days back were slow. That time to speed up is improving though. + +The main issue I thought I would have was not as problematic as expected, however there have been issues I didn't foresee. + +## ghost of the navigation +After the first couple of days I was expecting my heavy reliance on Vim navigation to be a hindrance, now that the H, J, K, L keys are not situated together on the home row. As you may recall I installed `xte` and set `xbindkeys` keybindings to emulate J and K by pressing Alt+n and Alt+e respectively. I actually haven't used these keybindings at all and have very quickly become use to the positioning of H, J, K, L. That being said, my navigation within Vim has changed. Probably for the better. Due to the position of the basic navigation keys I stopped relying on them as much and started using alternative navigation (`w`, `e`, `b`, `f`, etc.) and count navigation a lot more. I also started learning the jump list, something I hadn't really touched on before. + +Vim navigation in other tools still use H, J, K, L, but I have grown accustomed to it very quickly, so that hasn't been the blocker I thought it would be. + +## fear of the boot +I don't reboot my PC very often so I didn't consider requiring Colemak at boot. I shut everything down the other day while I was [painting my wall](https://mastodon.social/@pyratebeard/107751942807459892){target="_blank" rel="noreferrer"}, so when I booted up I had to be really careful typing in my encryption passphrase and login password (looking at the QWERTY keyboard on my phone while I typed). I should really try and fix that before I next reboot. + +## the vm factor +I run virtual machines on my PC for a multitude of reasons but not all of these have Colemak immediately available, for example the Debian installer doesn't list Colemak (but it does have Dvorak). I can switch my system keymap to QWERTY to make things easier but I find it hard to switch back and forth so quickly. I think it is made worse by the physical keys being in a different layout, if I switch to my laptop (with a QWERTY keyboard) I don't have any difficulty typing. + +This is only really an issue when I am installing a clean distro. Most of the time I configure a base VM to clone, so I can make sure Colemak is working. This won't help me in work though, unfortunately accessing VMs through the web console doesn't pass through the system keymap. All of this has meant some "quick and easy" jobs took a bit longer. + +## brave new world +After a frustrating start I have actually started to enjoy the Colemak layout. My typing is still not perfect but I have seen a huge improvement in the last week. For now I will stick with it, dealing with the VM issue as and when. If anybody has any good suggestions to dealing with that let me know. + +I am also going to practice switching back and forth between Colemak and QWERTY, in the hopes that I can change seamlessly on the same keyboard. If that goes anywhere I may write another entry about it. diff --git a/entry/20220217-welcome_todo_my_nightmare.md b/entry/20220217-welcome_todo_my_nightmare.md @@ -0,0 +1,98 @@ +I have always been one to make todo lists. My process has changed a lot over the years, from when I used actual paper to using only digital lists. My current setup is a bit hacky but works for me, so I thought I would share it. + +On my PC I started using a [simple script](https://git.z3bra.org/scripts/file/todo.html){target="_blank" rel="noreferrer"} (thanks to z3bra) to add tasks to a file, by default ~/.todo. There is nothing special about this todo file, it is simple plain text. I am aware of the [todo.txt method](http://todotxt.org/){target="_blank" rel="noreferrer"} but after trying it for a while I felt like it was not working for me. I have tried [kanban boards](https://en.wikipedia.org/wiki/Kanban_board){target="_blank" rel="noreferrer"} after using similar methods in work, but I didn't find it worked very well for my own personal tasks. + +My personal note and wiki tool of choice is [vimwiki](http://vimwiki.github.io/){target="_blank" rel="noreferrer"} so I tried keeping my todo list in that. This worked well for a while but I couldn't find a quick and comfortable workflow with it. + +Other notable attempts include [Taskwarrior](https://taskwarrior.org/){target="_blank" rel="noreferrer"} and [calcurse](https://calcurse.org/){target="_blank" rel="noreferrer"}. + +At the moment I am happy with the simple `todo` script. I spend a lot of time in [tmux](https://github.com/tmux/tmux/wiki){target="_blank" rel="noreferrer"}, so I have added a couple of keybindings to my config. I have one keybind to display the todo list in a tmux popup and another to start a command prompt with a prefix so I can write out a task, close the single quotes, and hit enter. If you're interested the relevant config is +``` +# toggle todo list popup +unbind t +bind t display-popup -w 75 -h 13 ~/bin/todo + +# add task to todo list +unbind T +bind T command-prompt -I "run-shell '~/bin/todo " +``` + +Adjust the width and height of the popup to your preference, and change the path to your script if required. + +This workflow was working quite well when I was at my PC, but what happens when I am not? On my phone I run [termux](https://termux.com/){target="_blank" rel="noreferrer"} so I can easily log in to my PC from anywhere (with a VPN) and add an entry to my todo list, but sometimes this process is a bit slow, or I may not have a network connection at all. + +I have [Markor](https://gsantner.net/project/markor.html?source=github){target="_blank" rel="noreferrer"} installed for taking notes so I thought I could sync my todo file to my phone to modify in Markor. I didn't want to install a tool such as [syncthing](https://syncthing.net/){target="_blank" rel="noreferrer"} on both my PC and phone for a single file so I started using `rsync` in a script periodically run by `cron`. I set my crontab to push the todo file from my PC to my phone at the end of the workday, then pull from my phone before work each workday. + +This worked well as long as I only edited the file on my PC during working hours and on my phone outside of working hours, which is _usually_ the case. I knew it would bite me in the ass at some point though so I started looking at a way to sync them properly. I came across `incron`, which is like `cron` but is triggered by filesystem events instead of at specified times. This looked like a good start, so I installed it on my PC and configured incrontab to push the todo file to my phone whenever it is modified. I immediately [hit a bug](https://github.com/danfruehauf/incron/issues/12){target="_blank" rel="noreferrer"} which caused `incron` to run once and then not run again. + +Disappointed by this I decided to hack together something similar myself using `inotifywait` from the [inotify-tools](https://github.com/inotify-tools/inotify-tools/wiki){target="_blank" rel="noreferrer"} package. This tool is really easy to use, and is available in termux. I set a script on both my PC and my phone to watch the todo file and `rsync` it to the opposite device if it changes. +``` +#!/bin/sh + +LOCAL_TODO="~/.todo" +REMOTE_TODO="/path/to/markor/todo.txt" +REMOTE_HOST="pyratephone" + +exec inotifywait -e close_wait -m $LOCAL_TODO | while read TODOFILE ; do + rsync $LOCAL_TODO $REMOTE_HOST:$REMOTE_TODO +done +``` + +I daemonised this on my PC and created a service on termux using [termux-services](https://wiki.termux.com/wiki/Termux-services){target="_blank" rel="noreferrer"}. With the package installed creating a service is straight forward; create a service directory and `run` script +``` +mkdir -p $PREFIX/var/service/todod/log +ln -sf $PREFIX/share/termux-services/svlogger $PREFIX/var/service/todod/log/run +cat >> $PREFIX/var/service/todod/run << EOF +#!/data/data/com.termux/files/usr/bin/sh + +LOCAL_TODO="/path/to/markor/todo.txt" +REMOTE_TODO=".todo" +REMOTE_HOST="pyratepc" + +exec 2>&1 +exec inotifywait -e close_write -m $LOCAL_TODO | while read TODOFILE +do + rsync -e "ssh -i /path/to/sshkey" $LOCAL_TODO $REMOTE_HOST:$REMOTE_TODO +done +EOF +chmod +x $PREFIX/var/service/todod/run +sv start todod +``` + +I immediately hit another issue, the DELETE_SELF file event. When you pass the `-d` flag to the `todo` script to delete a line it uses the command +``` +sed -i "${1}d" $TODOFILE +``` + +Unfortunately this command causes the file to be replaced with a new file, which generates the DELETE_SELF event. This means `inotifywait` sees the original file it was monitoring as deleted and can't monitor the file anymore. It doesn't look at the filename therefore does not recognise that the new todo file is "the same". To overcome this I switched the use of `sed` with `ed`. The `delete` function in the `todo` script now looks like this +``` +delete() { + test -n "$1" || exit 1 + ed $TODO << EOF >/dev/null +${1}d +w +q +EOF +} +``` + +Using `ed` means the file is opened, the line deleted, and the file closed causing a CLOSE_WAIT event. You can find my version of the `todo` script on my [git server](https://git.pyratebeard.net/dotfiles/file/bin/bin/todo.html){target="_blank" rel="noreferrer"}. + +The same issue occurs with `rsync`, the file is replaced with a new file causing a DELETE_SELF event. The quickest way I thought to fix this was to restart the daemon on the opposite device after the `rsync`. My script now looks like this +``` +#!/bin/sh + +LOCAL_TODO="~/.todo" +REMOTE_TODO="/path/to/markor/todo.txt" +REMOTE_HOST="pyratephone" +DAEMON_RESTART="SVDIR=/data/data/com.termux/files/usr/var/service sv restart todod" + +exec inotifywait -e close_wait -m $LOCAL_TODO | while read TODOFILE ; do + rsync $LOCAL_TODO $REMOTE_HOST:$REMOTE_TODO + ssh $REMOTE_HOST "${DAEMON_RESTART}" +done +``` + +The `run` script on my phone has a different $DAEMON_RESTART variable to restart the script on my PC, and specifies the IdentityFile like I did with the `rsync` command. + +So now I have a sync of sorts, and the workflow on my PC works well with the tmux keybindings. I expect at some point I will need to consider what happens when I make a change to the file and there is no network connection to the other device but that is a task for another day, it's on the todo list.