Today I learned: regex > loop

In writing “quad-quad”, which is a set of four 4-letter speak-able words that can be used as a user-friendly “bookmark” into easily finding a record, I was writing a “quick” program to extract the contents of wikidatawiki-20220820-pages-articles-multistream.xml (a wikipedia dump) and came into this large delay in the following loop:

$alphas = 'qwertyuiopasdfghjklzxcvbnm ';
$newline = '';
for ($x = 0; $x < strlen($line); $x++) {
    $c = substr($line, $x, 1);
    if (strpos($alphas, $c) !== false) {
        $newline = $newline . $c;
    else {
        $newline = $newline . ' ';
    }
}

The loops main purpose is to sanitize any non-letter data by replacing unknown characters with a space for later processing. The end result would be words that I could filter down to 4-character words and tally them up.

When the program read a line around 1mb in length it would “hang” for a bit as it chewed through the data. In a nutshell 25,100,655 bytes of data would take 24m36s. It was time to optimize.

Replacing the previous with the following regex performance was increased immensely.

$newline = preg_replace('/[^a-z]/', ' ', $line);

The same amount of data took 1.892s.

Lesson: If you don’t know regexes, learn regexes.

Jack and Coke? How about John and CUDA (w/ Rocky 8.7 Live)

In previous writeups such as xmrig with cuda for Rocky Linux 8.5 and nVidia CUDA with the wrong video card I’ve navigated Rocky Linux and Cuda. It’s now time to see if we can get John the Ripper CUDA’s components running on a Rocky 8.7 Live Workstation USB install.

Personally, I love projects like this. I started this on 1 8GB USB stick and quickly realized that not only the space required wasn’t enough but I’d need more to do what I needed. I ended up getting 3 SanDisk 32GB Ultra USB 3.0 Flash Drives from Amazon for $16.96.

The biggest help with the Live USB install is using balenaEtcher to get the 2.1GB ISO to an 32GB USB stick. Once that’s done we can boot directly to the Live OS and start our installs.

I did have some derps with balenaEtcher failing to burn the ISO due to a failure of diskpart not returning a positive result to the clean operation. To resolve this I had to use PowerISO to clean the USB volume before windows would properly do it’s clean operation. Minor note to PowerISO is that it contains bloatware during the install and a wrongly-clicked click can give you headaches.

Live Stuff

  • Booted up Rocky 8.7 Workstation Live Workstation from a USB to install Rocky 8.7 Workstation on a separate USB stick.
  • Root with password, user with password
  • rebooted into USB bootable
  • #win

Now onto the necessities to get to our final goal

Read More

Increasing Domain Renewal Costs

Back in the good ‘ol days domain names used to be so economically cheap that you could purchase many of them, renew them, and do things with them. It was great, especially with renewal as low as $9.99/yr.

It’s come time for me to determine which of my 14 domains I want to keep since my current registrar is willing to charge me $37.99/year to renew my domains an additional year.

I used to go through GoDaddy before they did something that I’m not sure but I think it had something to do with buying a domain, then cancelling the domain and forcing me to re-buy the domain at the same price after the cancellation even though the domain was on my account.

Regardless I transferred all my domains to Network Solutions and they gave me a great deal on all my domains. Now renewal is hugely expensive, and so I have to go shopping. I feel it was a bait-and-switch since they really don’t list their renewal pricing on their website nor is it easy to find anywhere on their website.

Read More

Listening to Skype Voicemail .dat files

Continued at Still trying to listen to Skype Voicemails…

Like thousands of other users I religiously used Skype to communicate with many friends and coworkers back in the early 2010s. It was a great platform, with the ability to send messages fluently from computer to phone and vice-versa, as well as make long and drawn out video calls. You could purchase a telephone number from anywhere in the world to have a presence in that country (as I did), and with it you gained voicemail. It did everything perfectly except save voicemails in a reusable format.

I’m not the only person that has a need/want to listen to these types of audio. There are forums of people who have their own needs, such as fathers voices and passed family members. The common solutions proposed are “download VLC”, “use Microsoft Word and run a repair”, or use a “DAT player”, all are non-functional or stupid solutions. There is a ton of common use cases for these old files and the technical solutions are far and none between.

Skype voicemails, once listened to, were downloaded from the Skype servers and stored in the users Skype profile as a dat file. Unfortunately, “dat” files are a general file format and have no immediate player that can open and listen to those files.

Time to dig in. Challenge Accepted!

Read More