Skip to content

5th March 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.

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

Infrastructure as Code

Ansible Snippets

Infrastructure Solutions

AWS

Operating Systems

Linux

detox

  • New: Introduce detox.

    detox cleans up filenames from the command line.

    Installation:

    apt-get install detox
    

    Usage:

    bash detox *