Hacks

xrayspx's picture

Kodi Machine Screensaver Notes

Music: 

Veruca Salt - Born Entertainer

I've just spent too long messing with a small PC to replace my Raspberry Pi Kodi machine. Problem was that the system would blank the screen after 10 minutes and there's too much stuff to test, and each test takes 10 minutes. Make a change, reboot, wait 10 minutes, make another change, and so on.

The problem was the Xorg default screen blanking, and it was fixed by creating /etc/X11/xorg.conf, with only the following config in it:

Section "ServerFlags"
Option "IgnoreABI" "True"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection

I had previously tried a bunch of stuff with setterm and enabling rc.local to run from Systemd, all to no avail, so I wanted to document this one for the next time.

xrayspx's picture

Search for Certificates on Windows Systems

Music: 

Nine Inch Nails - Broken

Here are a lot of words about what's essentially a one-line CMD + Powershell script...

I've recently run into a situation where a trusted root certificate authority certificate was missing from several Windows systems in multiple locations and domains. This was causing an issue with automation which reached out to a site which had a certificate signed by that CA. I can see a good use case for this if an organization has their own CA and needs to verify that all endpoints have that CA certificate in their trust store for example.

xrayspx's picture

Mac Classic Pt. 2 - This is Fine

Music: 

Pailhead - I Will Refuse

Note: I say "We" a lot. Natalie has been doing at least as much of this work as me. She has a whole method that she likes for the tantalum caps so she pretty much installed all of those. She even discharged the CRT. We learned later that the Classic seems to bleed the CRT automatically which is nice. I'm still sticking a screwdriver back there every time though just to make sure.

Good and bad news on the Mac Classic front.

If you read in part one, we over-paid a princely sum for a Mac which "Works as intended", but which should really have been "For parts or repair" for 1/3 what we paid.

So I'm personally beholden to make this fucker run regardless of personal cost in blood or treasure at this point.

"Rookies do very tidy job and rightfully feel pleased"

We recapped the motherboard on the Mac Classic. We got a heat gun, generous with the tape all around to make sure we didn't mess up any other components, and quickly and easily got the old parts off, we cleaned the pads up with solder wick, tinned them with new solder and put in the replacement tantalum caps, applying a bit of flux and cleaning regularly along the way. No damaged pads, everything went extremely smoothly regardless of which of us held the iron. Natalie really did most of the installation of the new parts.

Before:

After:

"Rookie makes Rookie Mistake"

The eagle-eyed among you already see why my office smelled like shit all day last Saturday. Of course, tantalums don't note polarity the same way any electrolytic I've dealt with has. So we installed them all backwards.

I know I have seen at least one person mention that while doing a recap and replacing electrolytics with tantalums. In fact, in the box from the company we ordered the replacements from:

So it's not like there weren't ample people trying to get this information into my head. Oh well, happens. Here's the before & after, after the second recap:

I also took the cardboard shield off the high voltage board and saw sticky burnt electrolyte gack on the back of the board. That gack was the smell that took this machine beyond just "nicotine soaked" when you turned it on.

We've removed the high voltage board and will re-cap that in Part 3.

I'm in no position to recommend the hot air station we got, but it was just "not quite the cheapest one on Amazon". Came with some extras like a pair of side cutters and a couple pairs of tweezers, so that was helpful.

xrayspx's picture

Mac Classic - First Impression

Music: 

"Works As Intended" they said....

Unless Craigslist Guy was using a sharpie to play tic-tac-toe on the wavy checkerboard screen, we have different definitions of "intended".

Of course if the intention is that we have a project now, well then Mission Accomplished. Replacement caps are on the way. The board itself looks totally clean aside from the standard nicotine layer gooped everywhere, but no visible corrosion or damage.



xrayspx's picture

PiST

Music: 

Peter Murphy - The Sweetest Drop

*Skip to the RetroPie customization stuff*

Like every other moderately Vintage / Retro Computing person,
not to mention my whole job being what it is, I immediately bought one of those
12" IPS 16:9 Eyoyo monitors when I started seeing them pop up on some YouTube channels. Thing works great as a bench monitor, but it's kind of a weird size for use with 1980s OSes that expect 4:3. I found that Eyoyo also makes a 4:3 12" 800x600 monitor with all the same inputs so I grabbed one. Since the Atari branded monitors for the ST were 12", and I never saw any of these machines on anything much bigger than a 13" TV back in the day, this looks pretty much exactly as I remember and the correct aspect ratio makes everything feel "bigger" in the right way.

The Pi 3 seems to be completely sufficient for emulating a stock 8Mhz 68000, it just needs enough power, swapping a 750ma power supply for 2.5A made a huge speed difference in emulation. I'm not trying to make this a "modern" experience like PiMiga or anything that requires any more horespower. For software, I started with RetroPie for their package management and the fact that they've already done the work of building all their packages to run from the command line with SDL/framebuffer, plus the ease of tweaking things like the boot splash screen, etc.

Aside from that, it's really just Hatari and Amiberry. I found a 1GB ACSI disk image for the ST which is split into thirds and had a bunch of preloaded software. I've not added anything to it yet, but apparently the hero at 8bitchip has also archived over 1500 ST games and has patched them to run from a hard disk so I won't need to sort through a bunch of disk images which is great. I already spotted Oxyd in the list.

That all makes me want to get NeoDesk running, which I gather is possible though it didn't immediately work in the 5 minutes I had to spend on it. Like I said, for this machine I'm not interested in running a "modern" take like PiMiga. But "nostalgia", well, while I'd certainly love to have original ST or Amiga hardware, I really am more nostalgic for the content and getting in front of Vroom or Nebulus for 10 minutes every 2 months, and it's awesome that it's using the same desktop I spent so much time in front of.

The little boot menu I wrote just replaces the RetroPie autostart.sh file at /opt/retropie/configs/all/ with one that shows the user a menu to select the boot OS or shutdown. Windows 3.11 is a menu option, that's kind of TBD. DosBox is installed but I haven't done the full Windows install yet but it'll be fun to play Solitaire on this thing.


Little tweaks I made to RetroPie

I used RetroPie as my base rather than regular Raspbian because of their great packaging and basic customization tools. I just installed Hatari and Amiberry from the retropie_setup installer and they worked immediately at the command line. The retropie_setup tool also lets you swap out the default boot splash screen. I was expecting to just find the location of the file and swap in an Atari Fuji logo and be done with it. But they've built the tool into their setup utility, and even let you assign an MP4 so I was able to use an animated rainbow Fuji logo so it just looks awesome.

I made one edit to /boot/cmdline.txt to suppress the bootup log output, so cmdline.txt looks like this now:

console=serial0,115200 console=tty1 root=PARTUUID=8ee2ea28-02 rootfstype=ext4 fsck.repair=yes rootwait loglevel=3 quiet consoleblank=0 plymouth.enable=0

I copied /opt/retropie/configs/all/autostart.sh out of the way and replaced it with:

#!/bin/bash

/home/pi/bin/menu

That's pointing to the boot menu screen. It's really simple but really what am I trying to do here? I did add a countdown timer so it will automatically boot to an ST desktop after 20 seconds:


#!/bin/bash
# /opt/retropie/configs/all/autostart.sh

clear
echo "POMPEY PIRATES" | sed -e :a -e "s/^.\{1,$(tput cols)\}$/ & /;ta" | tr -d '\n' | head -c $(tput cols)
echo ""
echo ""
echo "Press '1' For Atari ST"
echo "Press '2' For Amiga"
echo "Press '3' For Windows 3.11"
echo "Press '9' For Bash Shell"
echo "Press '0' For Shutdown"
echo "Press 'T' For Trainer"
echo ""
echo ""

msg="Booting Atari ST in"
tput cup 12 0
echo -n "$msg"

l=${#msg}

l=$(( l+1 ))

for i in {15..01}
do
tput cup 12 $l
echo -n "$i Seconds"

read -t 1 -n 1 system 2>/dev/null

if [ "$system" = "1" ]
then
/opt/retropie/emulators/hatari/bin/hatari --timer-d 0 && reset; /home/pi/bin/menu
elif [ "$system" = "2" ]
then
/opt/retropie/emulators/amiberry/amiberry.sh && reset; /home/pi/bin/menu
elif [ "$system" = "9" ]
then
exit 0
elif [ "$system" = "0" ]
then
sudo shutdown -h now
fi

done

/opt/retropie/emulators/hatari/bin/hatari --timer-d 0 && reset; /home/pi/bin/menu


To-Do

  • I'll probably install Windows and Mini vMac just to do it
  • Add ST High Res mode
  • May add a timer to the menu to boot to the ST after some number of seconds just to make it more immersive.
  • Add a "POMPEY PIRATES" at the top and "PRESS 'T' FOR TRAINER" at the bottom for authenticity



  • xrayspx's picture

    Nixie Clock

    Music: 

    Bloodshot Bill - Mary Ann

    Natalie got me a cool nixie clock project for Christmas. We've split duties putting it all together and we just finally got it all worked out and on the shelf.

    Overall the project was pretty easy, though you can see there's one pretty badly folded in place resistor that wasn't in the directions so we had to cram it in last minute. And we had a couple of issues with certain numbers on certain tubes, but it looks great in the end.

    xrayspx's picture

    Lattice of Convenience - MP3 Playlists

    Music: 

    Underworld - Kittens

    Hopefully everyone can live in the future someday.

    We do a lot with MP3 playlists. I run Airsonic for streaming around the house and in the car, and we have a playlist-based FM transmitter setup, etc. So I have scripts which run every night and generate playlists based on star ratings and other things (GET THE LED OUT ANYONE?).

    Previously what I've done is dump the contents of a bunch of Smart Playlists in Clementine to a file and use those files to generate the randomized 200 track daily playlists. The downside to that is that every time I add music or change star ratings, I'd have to refresh these "base" files like some kind of animal. I had base playlists for "3+ stars", "4+ Stars" and "5 Stars", among others.

    Today I decided to fix all that. Clementine uses a SQLite3 database, so now I'm just querying it instead, and it seems to be working well. For example, my "5 star" playlist in Clementine results in 10800 or so tracks. The same one built from the DB ends up with a couple hundred more tracks, but is pretty close. I'm not entirely sure what the difference there is just yet, but "close enough". What it looks like to me is I probably need to enable Samba case sensitivity.

    The DB records ratings as decimal numbers from 0.0 (Zero stars) through 1.0 (5 Stars). So to build a "4-Star +" playlist, searching for rating >= "0.8", you get ratings like this:

    1
    1.10000002384186
    0.800000011920929
    0.800000011920929
    0.800000011920929
    1.10000002384186
    1.10000002384186
    0.800000011920929
    0.800000011920929
    1
    1
    1
    1

    ! Caveat: Prior to Clementine 1.4.0rc1-533-gf4e70face there was a bug where it was possible to give a song a higher than 5 star rating (higher than 1.0 in the DB) as you can see above, so know that if you have Clementine from the repositories, it's likely you have that bug. For instance in the UI, if you want to show all 5 star songs, use "Rating is Greater Than 4.5 Stars" rather than "Rating is Equal to 5 Stars".

    Now I can just have a cron job to copy the master Clementine DB once a day to my server and drop it in next to the playlist generation scripts.

    The downside to all this is speed. When using the Clementine-Generated base playlists, I could be sure all the files actually exist on disk. However while Clementine will only show you files that exist in the UI, it doesn't seem to do a very good job of cleaning the database of stale files which no longer exist. So if you move or rename files, the old DB entries stick around unless you purge it completely and start over from scratch. That means I have to test every single file as I add it to the playlist, which takes time. It takes about 5-8 seconds to generate my 200 track 5-Star M3U file.

    The 5-Star.sh script is below if you'd like to play along at home:

      


    #!/bin/bash

    rm /Volumes/Filestore/CDs/playlists/5\ Stars.m3u

    i=1

    while [ $i -le 200 ]
    do
     file=$(sqlite3 ./clementine.db "select filename from songs where rating > "0.9" order by random() limit 1;" | awk -F "file://" '{print $2}')

     ### Clementine data encodes special characters and accent marks and stuff so I'm using
     ### Joel Parker Henderson's urldecode.sh to undo that: https://gist.github.com/cdown/1163649
     
     data=$(urldecode.sh "$file")
     if [ -f "$data" ]
     then
      ### Have to escape leading brackets because grep treated it as a range and would allow duplicates ###
      ### Can't do that in "data" because \[ isn't in the filename so they'll fail ###

      escaped=$(echo "$data" | sed 's/\[/\\[/g')
      #echo "$escaped"

      ### Avoid duplicates
      match=$(grep -i "$escaped" /Volumes/Filestore/CDs/playlists/5\ Stars.m3u)
      if [ -z "$match" ]
      then
       echo "$data" >> /Volumes/Filestore/CDs/playlists/5\ Stars.m3u
       ((i++))
      fi
     fi
    done

    For the 3+ and 4+ lists, I repeat this main block, but instead each rating dumps into a text file that I randomize into an .m3u at the end. So for the 3-Star + script below, I collect 130 5-star tracks, 45 4-star, and 25 3-star, push them out to a temp file and then cat temp.m3u | sort -R > "./3 Star +.m3u". I could do all this by creating a new table in the database and stuffing tracks into that, but this was faster for me to write and it works well enough:


    #!/bin/bash

    rm /Volumes/Filestore/CDs/playlists/3\ Stars\ +.m3u

    i=1

    while [ $i -le 130 ]
    do
     file=$(sqlite3 ./clementine.db "select filename from songs where rating > "0.9" order by random() limit 1;" | awk -F "file://" '{print $2}')

     ### Clementine data encodes special characters and accent marks and stuff so I'm using
     ### Joel Parker Henderson's urldecode.sh to undo that: https://gist.github.com/cdown/1163649
     
     data=$(urldecode.sh "$file")
     if [ -f "$data" ]
     then
      ### Have to escape leading brackets because grep treated it as a range and would allow duplicates ###
      ### Can't do that in "data" because \[ isn't in the filename so they'll fail ###

      escaped=$(echo "$data" | sed 's/\[/\\[/g')
      #echo "$escaped"

      ### Avoid duplicates
      match=$(grep -i "$escaped" ./3-star-tmp.m3u)
      if [ -z "$match" ]
      then
       echo "$data" >> ./3-star-tmp.m3u
       ((i++))
      fi
     fi
    done

    i=1

    while [ $i -le 45 ]
    do
      file=$(sqlite3 ./clementine.db "select filename from songs where rating >= "0.8" and rating

      ### Clementine data encodes special characters and accent marks and stuff so I'm using
      ### Joel Parker Henderson's urldecode.sh to undo that: https://gist.github.com/cdown/1163649

      data=$(urldecode.sh "$file")
      if [ -f "$data" ]
      then
       ### Have to escape leading brackets because grep treated it as a range and would allow duplicates ###
       ### Can't do that in "data" because \[ isn't in the filename so they'll fail ###

       escaped=$(echo "$data" | sed 's/\[/\\[/g')
       #echo "$escaped"

       ### Avoid duplicates
       match=$(grep -i "$escaped" ./3-star-tmp.m3u)
       if [ -z "$match" ]
       then
        echo "$data" >> ./3-star-tmp.m3u
        ((i++))
       fi
      fi
    done

    i=1

    while [ $i -le 25 ]
    do
      file=$(sqlite3 ./clementine.db "select filename from songs where rating >= "0.6" and rating

      ### Clementine data encodes special characters and accent marks and stuff so I'm using
      ### Joel Parker Henderson's urldecode.sh to undo that: https://gist.github.com/cdown/1163649

      data=$(urldecode.sh "$file")
      if [ -f "$data" ]
      then
       ### Have to escape leading brackets because grep treated it as a range and would allow duplicates ###
       ### Can't do that in "data" because \[ isn't in the filename so they'll fail ###

       escaped=$(echo "$data" | sed 's/\[/\\[/g')
       #echo "$escaped"

       ### Avoid duplicates
       match=$(grep -i "$escaped" ./3-star-tmp.m3u)
       if [ -z "$match" ]
       then
        echo "$data" >> ./3-star-tmp.m3u
        ((i++))
       fi
      fi
    done

    cat ./3-star-tmp.m3u | sort -R > /Volumes/Filestore/CDs/playlists/3\ Stars\ +.m3u

    rm ./3-star-tmp.m3u

    xrayspx's picture

    Dr Pepper Clock

    Music: 

    We just got a really great Dr Pepper restaurant clock, as featured in the arcade scene of Wargames. We think it's meant to be modular and can be attached to lighted menu-boards. It's got a pass-through 110V plug so you can daisy chain stuff off of it, and the side trim is easily removable to clip in a sigh board on each side.

    However, while it is beautiful, it doesn't need to be on all the time, so I added a switch. The wiring is very simple with just a couple of wire nuts tying the inbound power to the AC plug and fluorescent light. I found some suitably retro-ey looking switches on Amazon at 6 for $9.

    We decided to put the switch on the bottom just in case I cracked the plastic or something similarly horrible happened. All in all, very straight forward, but one pro-tip was in drilling the hole. I started with a small drill bit and worked my way up, but when I got to the larger drill bits I ran the drill in reverse to just use friction to make the hole rather than trying to hog out a hole in very thin and brittle material with a way-too-big bit. This worked /great/, thanks Dave.

    Wiring before:

    Switch:

    Wiring After:

    Switch external:

    Fixed Tags:
    xrayspx's picture

    Caching Password passer

    Similar to the RDP Launcher, I occasionally need to grab passwords that I use all the time from KeePassXC to paste into various forms or prompts. Basically anything I use more than once per day, I have defined in this script for quick access. I don't want to be able to remember these, and I also don't want to have to interact with the password manager UI if I'm in a shell.

    xrayspx's picture

    Sharp Boombox Repair

    Music: 

    Tom Petty - Freefallin'

    Pages

    Subscribe to RSS - Hacks