Entries tagged 'author:steeph' (Page 29)

SBWG 0.9.6

Entry created on 2021-08-29 Authors: steeph (376) Categories: Bash (31) Code (31) Computer (78) Linux (36) Projects (41) SBWG (18) Scripts (28) Software (53) Languages used: en (257) Topics: Projects → Code → Bash Scripts → SBWG (16) edit

As foreseen I've made slow progress in development of SBWG, the script that generates this web site, because I want to test and improve it with the current feature set before I start to implement new features. The former is necessary. The latter is more fun. But today I've reached a point where I can say that the only thing left to do before I call it v1.0.0 is testing edge cases and things that I didn't think of testing before, as well as fixing potential bugs discovered from this testing.

So, version 0.9.6 is out, everything is working, The README file, other documentation included in the package, the example website, the included style sets and partly even the code quality has been deemed satisfactory, and I hope I'll find the time to test all sorts of weird stuff and discover and fix some bugs next month, at which point version 1.0.0 will be published and I'll finally be able to allow myself to start working on new features, some of which are awaited by both regular users of the script.

Comment via email

Hope Dies Last

Entry created on 2021-08-09 Authors: steeph (376) Categories: Hope (1) Thoughts (73) Languages used: en (257) edit

I will never forgive her for doing that to meeveverybody!

Comment via email

Backmatch - A Simple Dual-N-Back-Inspired Performance Task Trainer For Bash

Entry created on 2021-07-31 Authors: steeph (376) Categories: Bash (31) Brain Training (1) Code (31) Computer (78) Scripts (28) Software (53) Languages used: en (257) Topics: Projects → Code → Bash Scripts (23) edit

Here is a script that I wrote as a short side project because I wanted my own n-back trainer. I'm aware that the practical memory improments of n-back training, even when using a proper audiovisual dual n-back trainer, is not as great as it's often said to be. I just wanted to try it and see whether I like the training.

Usage

Execute the script and pass it a number that resembles the difficulty level. For example bash backmatch 3 starts the script with a 3-back task. On your keyboard press the key of the letter that was displayed n letters ago (in this example 3 letters ago). When you press a key the next letter is presented immedietly. If you don't press a key for 3 seconds (the time value can be changed by changing the variable sec) the next letter is presented and you don't get a point for this letter. When you exit the script by pressing ctrl+c your keypresses get compared to what was presented and you get your score.


#!/bin/bash

if [[ ${#} -ge 1 ]] && [[ ${1} =~ ^[0-9]*$ ]]
then
  n=${1}
else
  echo "'${@}' is not a number, is it?"
  exit 1
fi

echo "Ctrl+C pressing is for quitters."
npo=$((n+1))
sec=3

end() {
  echo -en "           \n"
  if [[ ${#str} -ge ${npo} ]]							# If enough characters had been generated
  then
    for i in $(seq $n); do echo -n "-"; done					# offset by $n dashes
    echo ${str}
    echo ${you}
    got=0
    for i in $(seq ${#str})
    do
      [[ ${str:$i:1} == ${you:$((i+n)):1} ]] && got=$((got+1))
    done
    echo -e "\n${got} out of $((${#str}-npo)) correct"
  else
    echo "Not enough data to judge you."
  fi
}

trap end EXIT

while true
do
  str+=$(cat /dev/urandom | tr -dc 'A-Z' | head -c 1)				# Get a random new letter.
  echo -en "\r       \r${str: -1}"						# Print the last character in the string (the new letter).
    read -n 1 -t ${sec} key							# Get a single character input, timeout $sec seconds.
    [[ -n ${key} ]] && you+=${key^^} || you+="-"
    [[ ${key^^} == ${str: -$npo:1} ]] \
      && echo -en "\r       good" \
      || echo -en "\r        bad"						# Check if uppercase input char is the same as the nth char from the back.
done

end

exit 1
Comment via email
Entry created on 2021-07-16 Authors: steeph (376) Categories: Silly (32) Thoughts (73) Work (3) Languages used: de (90) edit

µ-d! Arbeit. µ-d! 🔁

Comment via email

Setting Screen Brightness To Any Value With A Three-Step Keyboard Shortcut (Linux)

Entry created on 2021-07-08 Authors: steeph (376) Categories: Code (31) Computer (78) Displays (5) Linux (36) Scripts (28) Languages used: en (257) edit

Initially out of necessity because the brightness keys of my new laptop didn't work out of the box (the driver was aded to my distro not a month later, which should have been acceptable, but I didn't know that at first), I was looking for a way to set the backlight brighness of my laptop's internal screen easily, without typing a command in a shell. What I ended up using I like even better than the usual + and - keys.

I'm using i3wm and dmenu. The way I set screen brightness is

  • 1) I enter the shortcut (mod+B in my case)
  • 2) I enter a number and
  • 3) I hit Enter.
  • It's simple to implement. Just put this line in the i3 config file:

    
    bindsym $mod+b exec \
      thatbright=$(echo "1000\n2000\n3000\n4000\n5000\n6000\n7000\n100\n10" \
      | dmenu -p "How bright though?") && echo $thatbright \
      > /sys/class/backlight/*/brightness
    

    You can put it into one line (without the \s inbetween) if you want.

    You could easily change that to a two-step or single shortcut if you like. I like the three-step version because it allows me to choose from one of seven brightness modes easily but also lets me enter a value below or between those pre-sets without taking up more than one key.

    Code Explanation

    First, the variable thatbright is set to the number that dmenu outputs, which can be one of the numbers that are echoed to the pipe (selected with arrow keys or completed when typed in dmenu) or another number that is entered into dmenu. If that was suggessful, the value is written to /sys/class/backlight/*/brightness. If you have multiple backlights in /sys/class and you only want to set one or if your shell doesn't support wild cards in paths, you can change the * to whatever applies to your system, e.g. intel_backlight.

    Scripts/Commands to set the screen brightness

    The simplest script that sets the screen brightness in Linux is probably the one-liner from above: echo $1 > /sys/class/backlight/*/brightness. This sets the raw numerical value. You need to know what a sensible range of numbers is and what the maximal accepted value is (look at '/sys/class/backlight/[YOUR_BACKLIGHT]/max_brightness'). But there are more elaborate scripts, like bbacklight by Giuseppe Eletto with which you set the brightness with a percentage value.

    Comment via email

    I don't have a capsule in the Gemini Space

    Entry created on 2021-06-20 Authors: steeph (376) Categories: Computer (78) Gemini (2) Gopher (1) Shared (17) Languages used: en (257) edit

    When I first read about Project Gemini (the Gemini protocol) I was excited. I think it's a good idea for several reasons and I'm happy that it's reality and more than a handful of people help building that space and filling it with content. I never got into gopher mainly because I don't find the structure of gopher sites (gopherholes?) suitable for most kinds of content. And because the web exists and, with the right browser extensions and configuration, isn't annoying enough most of the time.

    But now that there is a new kid on the block with a different feature set and the right ideological background of the initiator(s) of the protocol, I seriously thought about moving this site over to the Gemini Space. Or to participate in any way. But I've decided against it for now. I've just started building this site and the software behind it and I don't want to abandon thi project already or start a competing one before this one is established in my mind.

    So this blog entry shall be my only contribution for now. Go check it out, there already is a lot of interesting content in Gemini capsules.

  • Project Gemini Website - with many good links to get started
  • Lagrange - a famous GUI Gemini browser (web link)
  • medusae.space gemini directory - one of several good collections/directories of gemini capsules (gemini link)
  • Geminispace Search engine(gemini link)
  • Comment via email

    The World After

    Entry created on 2021-06-18 Authors: steeph (376) Categories: Dreams (4) Story (5) Languages used: en (257) edit

    I just woke up from a screenable dream. I didn't get enough sleep every day before today this week. So when I finally took the time for a nap, I got reworded with a long, intense dream. I love this feeling of extra REM sleep. (Although it wasn't extra of course. I really missed it throughout the week.)

    I don't usually write my dreams down. And I won't include the actual detailed content, scenes, what I saw, who did what, etc. of this one either. And I won't even try to put the feelings that I had into words. But I just could not go on with normal everyday life without addressing it. I tried, but it felt like letting an entire civilisation die in my head. One with a bunch of kitties among them even. I won't take on that guilt.

    Rough story overview: Stuff happens, people live their lifes, have interactions, make mistakes, hold grudges, are sometimes angry with each other, love, work, try to enjoy life anyway. Then something happened. I wondered throughout the dream what it was exactly. I don't know. Lets say some scientist in a secret laboratory messed up and started a chain reaction of really bad events. It (the world) very quickly gets worse, like fires everywhere, soon no electricity, people disappear (nobody died in this story, they were just suddenly gone somehow). An undetermined apocalypse with the result that every city, town and village and most people are gone. Few people find themselves on an earth that has nothing of the things they were used to just a few days ago. They soon find each other and work together to figure out how to live now. They are the people we met at the beginning. There are people who hated each other, but they have to work together now, and they do. Our protagonist wanders alone for a day until he meets this new small tribe and is instantly assumed part of it. They are a cheerful group of friends now. Nobody hates each other. Everybody helps each other. Everybody acknowledges each others quirks and lives with them. They travel together, presumably to find a nice inhabitable piece of land. Along their way they find ruined cities, a displaced ocean, pieces of their old civilisation that they can use as tools. They share, they laugh together, they build a society.

    This dream felt so good because of the intense feelings that I got from it and that I woke up with. But I found the story worth telling, even if it's just in this short, rough form. I don't think I've ever heard of an apocalypse movie where people didn't try to kill each other or trick them out of their belongings afterwards. Ignoring the facts that this wouldn't fly with Hollywood and that it might still be too soon after waking up for me to judge this, I'd love to watch that movie!

    Parts of the story that I didn't include above: The people somehow also were animals, like in "The Animals of Farthing Wood" maybe, but they were also humans most of the time. They didn't shapeshift, they just were both but mostly one of the two at a time. In the new society one member started a newspaper. He didn't have any tools or paper. He just made it his job to be the newspaper. He ran around telling people the news. Some thought it was annoying, but they just laughed and liked him anyway. The new tribe had a huge float when the protagonist found them. I don't know what they were floating on, but it was light red. The float wasn't in the rest of the dream. There were still forest fires when they traveled. The protagonist discovered at some point that they weren't traveling away from the fire because they were surrounded by huge fires now. They were fine where they were currently. But they had to find a way to get out of that entwining fire. He was telling the rest that I they started to run when I decided to wake up. Maybe better that way, could have continued badly.

    Comment via email

    No smart home for me, thanks.

    Entry created on 2021-06-13 (edited 2021-06-13) Authors: steeph (376) Categories: Electronics (16) Keyboards (10) Microcontroller (1) Presence Detection (1) Smart Home (1) Technology (5) Languages used: en (257) Topics: Projects → Ideas (8) edit

    I don't think I'm going to set up anything that could be considered smart home tech for me. There are such fun projects in it and it would be very satisfying to be able to control some things remotely (that is, I'd decide on and be able to change the interface) but it would also be yet another never-ending project for me. I have never planned to install anything of that kind but I already have so many ideas about what I would do if I would go smart home and how I'd set things up. Let's leave it at that. I have enough too many unfinished project already.

    For example I have those universal keypads that were made for numeric keypads (+ a fey extra keys) of industrial machines. I have at least a dozon of them, maybe two. They are great: Good quality in every aspect, nice hard click, sturdy, customisable (buttons can be switched out or replaced by blank covers) and a simple matrix connector. It would ne great to have one of these next to every door, in or on every table, at the bedside, and maybe one or two non-stationary ones that would control everything that could be relevant from the location of each terminal.

    Every terminal would have a micro controller connected to a network. I could update those controllers all at once with new firmware. The keypads would have several modes from where I could control devices and the lights (including color, at least in one room). Also for my blinking light projects and mood light that would be a nice way of turning on and off exactly those lamps, effects and glowing pictures that I want at taht moment.

    But I won't do it. That's a decision.

    PS: Does anybody want some great small keypads for DIY use?

    Edit: I remember that I, when I previously talked about this topic, said that I don't start with this because the value I see it bringing to my life isn't large enough. I said that the one thing that could convince me that it's worth investing money and time into smart home tech would be a really very reliable way of sensing presence in a room as well as somebody approaching the entrance to a room. Basically, if the music or podcast that I was currently playing on my PC or phone would automatically be played in the room I'm currently in but not in any room I'm not in, except when I was about to walk into another room, then I'd maybe get in. If this would be really really reliable and affortable, then I'd reconsider my decision. Thermal based motion sensors aren't good enough for this. I'd probably need a dozen of them in each room. (Looks like I saved a dozen of the wrong things from being scrapped.) And to customise the software for my home would probably a small project on its own. I don't know of another sensor that could do this that wouldn't require me having at least some sort of device on me all the time.

    Comment via email
    Go To Navigation Page
    Show/Hide Navigation
    Mastodon