Skip to content

10th Week of 2024

Activism

  • New: Recomendar el episodio de podcast el diario de Jadiya.

    Diario de Jadiya (link al archivo): es algo que todo xenófobo debería de escuchar, es un diario de una chavala saharaui que formó parte del programa de veranos en familias españolas.

Free Software

Life Management

Time management

Calendar Management

  • New: Add calendar event notification system tool.

    Set up a system that notifies you when the next calendar event is about to start to avoid spending mental load on it and to reduce the possibilities of missing the event.

    I've created a small tool that:

    • Tells me the number of pomodoros that I have until the next event.
    • Once a pomodoro finishes it makes me focus on the amount left so that I can prepare for the event
    • Catches my attention when the event is starting.

Knowledge Management

Analytical web reading

  • New: Introduce Analytical web reading.

    One part of the web 3.0 is to be able to annotate and share comments on the web. This article is my best try to find a nice open source privacy friendly tool. Spoiler: there aren't any :P

    The alternative I'm using so far is to process the data at the same time as I underline it.

    • At the mobile/tablet you can split your screen and have Orgzly on one tab and the browser in the other. So that underlining, copy and paste doesn't break too much the workflow.
    • At the eBook I underline it and post process it after.

    The idea of using an underlining tool makes sense in the case to post process the content in a more efficient environment such as a laptop.

    The use of Orgzly is kind of a preprocessing. If the underlining software can easily export the highlighted content along with the link to the source then it would be much quicker

    The advantage of using Orgzly is also that it works today both online and offline and it is more privacy friendly.

    On the post I review some of the existent solutions

Coding

Languages

Bash snippets

  • New: Self delete shell script.

    Add at the end of the script

    rm -- "$0"
    

    $0 is a magic variable for the full path of the executed script.

  • New: Add a user to the sudoers through command line.

    Add the user to the sudo group:

    sudo  usermod -a -G sudo <username>
    

    The change will take effect the next time the user logs in.

    This works because /etc/sudoers is pre-configured to grant permissions to all members of this group (You should not have to make any changes to this):

    %sudo   ALL=(ALL:ALL) ALL
    
  • New: Error management done well in bash.

    If you wish to capture error management in bash you can use the next format

    if ( ! echo "$EMAIL" >> "$USER_TOTP_FILE" ) then
        echo "** Error: could not associate email for user $USERNAME"
        exit 1
    fi
    

Bash testing

  • New: Introduce bats.

    Bash Automated Testing System is a TAP-compliant testing framework for Bash 3.2 or above. It provides a simple way to verify that the UNIX programs you write behave as expected.

    A Bats test file is a Bash script with special syntax for defining test cases. Under the hood, each test case is just a function with a description.

    @test "addition using bc" {
      result="$(echo 2+2 | bc)"
      [ "$result" -eq 4 ]
    }
    
    @test "addition using dc" {
      result="$(echo 2 2+p | dc)"
      [ "$result" -eq 4 ]
    }
    

    Bats is most useful when testing software written in Bash, but you can use it to test any UNIX program.

    References: - Source - Docs

Python Snippets

  • New: Fix variable is unbound pyright error.

    You may receive these warnings if you set variables inside if or try/except blocks such as the next one:

      def x():
        y = True
        if y:
            a = 1
        print(a)  # "a" is possibly unbound
    

    The easy fix is to set a = None outside those blocks

      def x():
        a = None
        y = True
        if y:
            a = 1
        print(a)  # "a" is possibly unbound
    

DevOps

  • New: Keyboard shortcuts.

    You can press ? to see the shortcuts. Some of the most useful are:

    • f: Toggle favourite
    • Shift+a: Archive element

Infrastructure as Code

Ansible Snippets

Infrastructure Solutions

AWS

Operating Systems

Linux

Linux Snippets

detox

  • New: Introduce detox.

    detox cleans up filenames from the command line.

    Installation:

    apt-get install detox
    

    Usage:

    detox *
    

mkdocs

  • New: Center images.

    In your config enable the attr_list extension:

    markdown_extensions:
      - attr_list
    

    On your extra.css file add the center class

    .center {
        display: block;
        margin: 0 auto;
    }
    

    Now you can center elements by appending the attribute:

    ![image](../_imatges/ebc_form_01.jpg){: .center}
    

Wireguard

  • New: Improve logging.

    WireGuard doesn’t do any logging by default. If you use the WireGuard Linux kernel module (on kernel versions 5.6 or newer), you can turn on WireGuard’s dyndbg logging, which sends log messages to the kernel message buffer, kmsg. You can then use the standard dmesg utility to read these messages. Also, many Linux systems have a logging daemon like rsyslogd or journald that automatically captures and stores these messages.

    First, enable WireGuard dyndbg logging with the following commands:

    modprobe wireguard
    echo module wireguard +p > /sys/kernel/debug/dynamic_debug/control
    

    Once you do that, you’ll be able to see WireGuard log messages in the kernel message facility, if your system is set up with rsyslogd, journald, or a similar logging daemon. With rsyslogd, check the /var/log/kern.log or /var/log/messages file. With journald, run journalctl -ek.

  • New: Monitor wireguard.

Arts

Writing

Digital Gardens

  • New: Add the not by AI badge.

    Not by AI is an initiative to mark content as created by humans instead of AI.

    To automatically add the badge to all your content you can use the next script:

    echo "Checking the Not by AI badge"
    find docs -iname '*md' -print0 | while read -r -d $'\0' file; do
        if ! grep -q not-by-ai.svg "$file"; then
            echo "Adding the Not by AI badge to $file"
            echo "[![](../img/not-by-ai.svg){: .center}](https://notbyai.fyi)" >>"$file"
        fi
    done
    
    You can see how it's used in this blog by looking at the Makefile and the gh-pages.yaml workflow.