List of Dune Characters and Locations for my reference

Dune character and location notes:

Item Description
Duke Leto Atreides Leader of the Atreides, Paul's father
Lady Jessica Paul's mother, Bene Gesserit concubine to Leto, bears a son against the wishes of the Bene Gesserit
Paul Atreides Main character, son of Leto and Jessica. Fifteen years old
Bene Gesserit Sisterhood of "witches" who seek to gain political power, addicted to spice
Caladan Ocean homeworld of the Atreides
Arakis Desert world, home of the spice melange, setting for the entire book
Gurney Halleck Troubador Warrior, skilled in the use of the baliset, loyal friend to Leto
Thufir Hawat Old Mentat, master of assassins that has served house Atreides for many years
Duncan Idaho Swordmaster of the Ginaz, one of Leto's right hand men
Dr. Wellington Yueh Betrays Duke Leto
Princess Irulan "Narrator" of the book. Each chapter begins with one of her short diary entries
Sardaukar Elite military force of the Emperor
Fremen Local peoples of Arakis, glowing blue eyes
Mentat Human "computers", vast memories, ability to organize lots of information
Muad'Dib Small desert mouse, Paul later adopts this as his Fremen name
Kwisatz Haderach Male Bene Gesserit who can bridge space and time, result of breeding program
Liet Kynes Planetologist assigned by the emperor to assist in transition of Arakis
Salusa Secundus Harkonnen prison planet
Leave A Reply

Wemos D1 mini Pin mapping

I've been using the Wemos D1 mini for several home automation projects. Unforunately the pin designations on the board don't match what Tasmota users. I was able to track down the Wemos D1 mini pin mappings to create a cheat sheet.

Label GPIO
D0 16
D1 5
D2 4
D3 0
D4 2
D5 14
D6 12
D7 13
D8 15
RX 3
TX 1

Bolded pins can be used for any project without limitation, other pins can be used but may have some limitations.

Leave A Reply

Linking two Tasmota devices (without MQTT)

I have two Tasmota enabled devices that I want to turn on/off at the same time. In my case I have a wall switch that powers the main lights, and a wall socket that powers some corner lights and a radio. Using Tasmota's rule system this is not too complicated. We need tell each Tasmota device that whenever the state of it's relay changes (for whatever reason: button, timer, etc.) it needs to tell the other Tasmota device to set it's relay to the matching state. We can use the WebSend feature built in to Tasmota to send commands between two devices.

On device #1

RULE1 on POWER1#State do WebSend [] POWER1 %value% ENDON

On device #2

            RULE1 on POWER1#State do WebSend [] POWER1 %value% ENDON

This can also be done using MQTT pretty simply, but I wanted to see if I could do it with vanilla Tasmota. Doing it direct with WebSend is pretty simple and saves having to run an MQTT broker if you just have two simple devices.

Leave A Reply

Books of 2020

List of books I read in 2020. Also see the list of 2019. The date indicated denotes the date I started reading the book.

2020-01-17 - Dune Messiah - 256 pages
2020-02-08 - Gerald's Game - 332 pages
2020-03-10 - Brain Droppings - 257 pages

Leave A Reply

Printf() and variable length precision

Formatting floating point numbers is usually best served with printf(). This example will print Pi to two decimal places:

printf("%0.2f", 3.14159265);

If you want to control how many digits of precision printf() uses you can use the * variable in your format

printf("%0.*f", 4, 3.14159265);

This example will print Pi with four digits of precision. The * substitution is used like a regular parameter, and printf() uses it in the order it receives it.

Leave A Reply

Perlfunc: file_put_contents()

PHP has a really handy function called file_put_contents() that simplifies writing to a file. I did a quick Perl version of that function for my scripts.

sub file_put_contents {
    my ($file, $str) = @_;

    open (my $fh, ">", $file) or return undef;
    print $fh $str or return 0;
    close $fh;

    return length($str);
Leave A Reply

Apache: Redirect HTTP to HTTPs with exclusions

If you want to redirect all HTTP requests to HTTPS it's pretty simple:

<VirtualHost *:80>

    Redirect permanent /

I needed to do an HTTPS redirection, but exclude my /api directory to make things simpler and faster for my ESP8266/ESP32 boards. This is slighly more complicated but still doable:

<VirtualHost *:80>

    RewriteEngine On
    RewriteCond %{SCRIPT_FILENAME} !/api
    RewriteRule /(.*)$1
Leave A Reply

Perl: Change a specific line in a file

If you need to change a specific line in a text file based on line number you can use the following Perl one-liner:

perl -pi -e '$_ = "New value\n" if $INPUT_LINE_NUMBER == 75' file.txt

Just change the 75 to whatever line number you want to update.

Leave A Reply

Javascript: Remove an item from an array

I need to remove a specific item from a Javascript array. I'm sure there are lot of ways to do it, but this is a quicky function I came up with to do it.

// Loop through an array removing any matching items
function remove_item_from_array(needle, haystack) {
    var ret = [];

    for (i in haystack) {
        var item = haystack[i];

        if (item !== needle) {

    return ret;
Leave A Reply

Perl: Fetch HTTPS content

If you need to fetch a remote URL via HTTPS in a Perl script the easiest way I have found is to use HTTP::Tiny. HTTP::Tiny is a core module, and included in all Perl installations.

Sample code:

use HTTP::Tiny;

my $http = HTTP::Tiny->new(verify_SSL => 1, timeout => 5);
my $resp = $http->get("");
my $body = $resp->{content};

print $body;
Leave A Reply

Fedora 31 major package versions

Fedora 31 has these versions of some core packages:

Package Version
Apache 2.4.41
GCC 9.2.1
Kernel 5.3.7
Perl 5.30.0
PHP 7.3.11
Vim 8.1.2198
Git 2.23.0
MariaDB 10.3.17
Leave A Reply

Perl: Printing lines of a file between two delimiters

I need to print out the lines of a text file that are between a specific starting delimiter and and ending delimiter:

perl -nE 'print if /START_DELIMITER/../END_DELIMITER/' input.txt

or use this to exclude the delimiter lines

perl -nE '/END_DELIMITER/ and $y = 0; $y and print; /START_DELIMITER/ and $y = 1' input.txt

This method also works for data passed in via a pipe.

Leave A Reply

Linux: CentOS 8 major package versions

CentOS 8 has these versions of some core packages:

Package Version
Apache 2.4.37
GCC 8.2.1
Kernel 4.18.0
Perl 5.26.3
PHP 7.2.11
Vim 8.0.1763
Git 2.18.1
Leave A Reply

ZSTD compression level with tar

I've been using zstd more and more for general compression. Using it with tar is pretty straight forward:

tar -cvpf -I zstd /tmp/etc.tar.gz /etc

This does not allow you to set the compression ratio however. After some digging I found an environment variable that controls the default compression level. If you run tar like this you can change the default compression level.

ZSTD_CLEVEL=19 tar -cvpf -I zstd /tmp/etc.tar.gz /etc

GZip has a similar variable, but it will allow any command line variable (not just compression ratio).

GZIP=-9 tar -cvzpf /tmp/etc.tar.gz /etc
Leave A Reply

Restricting SSH sessions to a single command

Using SSH keys to allow passwordless logins to a server allows cool scripting opportunities. You may want to allow a user to login via SSH, but restrict them to a specific command. This can be done with a command option in your authorized_keys file. If you prepend a command="" option to your SSH key line, SSH will force that command to run that command every time a user with that key connects.

command="/usr/bin/ls /etc -lsa" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDunzvfGJi4qcHixaoCQ0k1kociSYfIlwhXzI1ywtltA user@desktop
Leave A Reply