Journal Entries

(Page 4 of 9)

Assorted journal / blog entries.


Now Playing: "Camp Happy Island Massacre" for DOS

TL;DR — I wrote a simple computer game in 1997 called Camp Happy Island Massacre which I now have running online here.

👓 3 minutes

Way back in 1997, I released my first (and, so far, only) computer game, Camp Happy Island Massacre (hereafter referred to as #CHIM), a comedy-horror text game for the DOS operating system. Originally written while I was still in college, the game is about a cursed summer camp and the 3 surviving counselors who try to stop a horrific force before it claims them. I put it out for free (more-or-less) on the internet of 1997, and though it was never a huge success, Iā€™ve always been proud of it.

Fast forward to 2018: although Iā€™ve known about the Internet Archiveā€™s MS-DOS Software Library for some time, Iā€™d never really thought about the specifics of how it works until I read an article which talked about the Em-DOSBox project. Em-DOSBox is a port of DOSBox emulator which runs in the browser via the Emscripten JavaScript library. As I was reading the article, a thought struck me: could I get CHIM running in the browser?

I decided it was at least worth a shot, so I began with step 1, building Emscripten from source. That went off without an issue, so I moved on to the next step, building the DOSBox JS files, and thatā€™s where I ran into my first snag: the only way I was able to get it to build was by disabling the ā€œemterpreter syncā€ function (emconfigure --disable-sync ./configure). It complained about the lack of empterpreter sync, but it built, and that lead me to the next step, packaging the dosbox.js file for use in a browser via the ./packager.py command. Even though this seemed to work great, there was obviously something wrong with my resulting files, as the JavaScript engine in my browser kept throwing an error (ā€œmissing function in Moduleā€). After toying around with it for a while, I found that, if I used ./repackager.py (the Emscripten-less version of the packager) to package my files, I could get an empty DOSBox window to come up, but it still wouldnā€™t load the actual EXE.

By this point, I was flummoxed, and was about to give up. And thatā€™s when I found the answer: js-dos!

After 30 minutes with this tutorial (and some source viewing on a couple of js-dos game pages), I was able to get CHIM working.

But my work wasnā€™t finished yet. Even though Iā€™d kept nearly all of the files for CHIM for the last 21 years (with the exception of the gameā€™s original C++ source files, which were lost in a hard drive crash shortly after it was released), I hadnā€™t really messed with them much in the last decade, so there was some cleaning up to be done. I updated some of the questions (and answers) in the FAQ, replaced the license, and generally tried to clean up the supporting text files. And thatā€™s when I ran into one last unexpected issue: text encoding.

You see, I had forgotten that, when I first wrote the game and the supporting files, I had used some primitive ANSI graphic characters in an attempt to enhance the look of it. And now, when I tried to view those files on my Linux laptop, those graphics came outā€¦ weird.

The fix was to convert the files from the ā€œIBM-862ā€ format to the modern UTF-8 format:

> iconv -f IBM862 -t UTF8 INTRO.TXT -o INTRO.UTF.TXT

This allowed me to edit the files in Mousepad (and serve them up with Nginx), while still keeping the graphics intact. Finally, I added the Unicode Byte Order Mark, which makes it display correctly in the browser, even when served from a file:// URL (you can add the BOM via Mousepad, under ā€œDocument -> Write Unicode BOMā€).

So, if youā€™d like to try the game out, check it out here, and good luck - youā€™re gonna need it!


Dat's Incredible!

TL;DR — I decided to try out the Dat protocol, and now have a copy of this site running on it.

👓 3 minutes

Recently, I was inspired by Aral Balkanā€™s concept of Web+ and his work with dats to add Dat protocol support to my own site(s). Since my experiences might be useful to others, I thought Iā€™d share them here.

A #dat , or Dat #archive (as I understand it) is a sort-of cross between a Git repository and BitTorrent file share. It was initially developed for storing and sharing data in a decentralized way, and so makes for a great way to share an archive of static content (like a website).

To create and share a Dat archive, I needed to install the Dat protocol. Since it uses NodeJS, this is done via the Node Package Manager:

sudo npm install -g dat

I already had a directory in mind to share (the directory that holds the static files of my website), so sharing the dat was as simple as: going into that directory and typing the following commands:

# Enter the directory with the static files
> cd www

# Create the dat
> dat create

Welcome to dat program!
You can turn any folder on your computer into a Dat.
A Dat is a folder with some magic.

Your dat is ready!
We will walk you through creating a 'dat.json' file.
(You can skip dat.json and get started now.)

Learn more about dat.json: https://github.com/datprotocol/dat.json

Ctrl+C to exit at any time
Title: It's Eric Woodward (dotcom)
Description: Dat for the site running at https://www.itsericwoodward.com/.
Created empty Dat in /home/eric/www/.dat

Now you can add files and share:
* Run dat share to create metadata and sync.
* Copy the unique dat link and securely share it.

dat://3dccd6e62ea8e2864fb66598ee38a6b4f4471137eebc23ddff8d81fc0df8dbbc

# Share the newly-created dat
> dat share

And thatā€™s it. šŸ˜ƒ

To verify that I was sharing it, I pointed my web browser to https://datbase.org/, entered my DAT URL in the search box at the top-left of screen, pressed ENTER, and, lo and behold, my website came up.

Another way to verify that a DAT URL is being actively shared is to view it through the Beaker Browser, a special web-browser-like application used for viewing dats. To get it, I went to https://beakerbrowser.com/install/, and downloaded the AppImage file for Linux (no link provided here because the Beaker Browser still in pre-release, and any image that I point to from here will probably be old by the time anyone reads this).

Then, I launched it:

# Make it executable

> chmod a+x beaker-browser-0.8.0-prerelease.7-x86_64.AppImage

# Launch the AppImage

> ./beaker-browser-0.8.0-prerelease.7-x86_64.AppImage

After a few moments, the application came up, at which point I entered my dat URL into the Beaker Browserā€™s address bar, hit the ENTER key, and just like that, my website came up.

Unfortunately, unless your data is wildly popular (and thus located across multiple hosts in the swarm), it is only shared for as long as the dat share command is running on your machine. So, to make the files permanently available via Dat, I had to create a service file that would run the dat share automatically. To do this, I created file in /etc/systemd/system called dat-share-web.service, which looked like this:

[Unit]
Description=DAT Share for It's Eric Woodward (dotcom)
After=network.target

[Service]
User=eric
Type=simple
WorkingDirectory=/home/eric/www
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ExecStart=/usr/bin/node /usr/local/lib/node_modules/dat/bin/cli.js share
Restart=always

# Output to syslog
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=dat-share-www

[Install]
WantedBy=multi-user.target

After I turned-off my existing DAT share, I started the new service, like this:

# Start the service
> sudo systemctl start dat-share-www

# Enable the service
> sudo systemctl enable dat-share-www

Now, my Dat archive will be served 24x7, even after I restart the server.

Everything worked great, but there was one more thing that I wanted to try: I had noticed that, in addition to Aralā€™s site being available at a usual DAT address (dat:// plus a 64-charactercode), it was also available at his own domain name (dat://ar.al/). After a quick search, I found that what I was looking for was DAT over DNS, which can be implemented one of two ways: either via DNS TXT records or by placing a file with a link to the DAT at a specific ā€œwell knownā€ location. Since the second option is the one that the DAT project seems to recommend (and it was dead simple to add), thatā€™s what I did. So now, if you launch the Beaker Browser and open the site dat://www.itsericwoodward.com/, it will take you to the DAT version of my site. Neat!

The DAT protocol is a simple but powerful way to share static content, and can help add a layer of redundancy to a website. Hopefully, your experiences in using it will be as positive as mine.

References:


Making SyncThing Play (IO)Nice

TL;DR — My SyncThing instance was using too much CPU, and CPU Limit didn't help reign it in, so I wound up using IO Nice.

👓 2 minutes

Every now and then, my laptop (running #Ubuntu 18.04) would freeze up: all the screens would lock, and although my mouse cursor was still on the screen, it was completely unable to interact with anything. After 30-40 seconds, everything would start moving again and return to normal.

The very first thing that I usually did when I get control of my system back was to run the top command, and what I frequently saw was SyncThing, an open source application that I use for backups, pegging 100% or higher on my CPU usage:

A screenshot showing SyncThing using too much CPU.

Now, I knew that this wasnā€™t supposed to happen, and until I could figure out what was triggering the sudden jump in utilization, I decided to try and limit SyncThingā€™s consumption via some other way.

Fix #1 - CPU Limit

First, I tried CPU Limit, a utility designed to put a hard limit on the CPU usage for a process, which I installed and used as outlined here:

# Install CPU Limit
> sudo apt install cpulimit
  • I edited the syncthing.service file to make my ExecStart directive look like this:
# Limit SyncThing to no more than 50% of the available processor
ExecStart=/usr/bin/cpulimit -v -l 50 /usr/bin/syncthing -- -no-browser -no-restart -logflags=0
  • Finally, I restarted the SyncThing service:
# Reload the service files
> systemctl daemon-reload
# or use `systemctl --user daemon-reload` for user-specific services

# Restart the SyncThing service
> systemctl restart syncthing.service
# or use `systemctl --user restart syncthing.service` for user-specific services

This worked for a while, but apparently broke after I updated SyncThing from v0.14.43 to v0.14.50 (the service file kept crashing out).

And thatā€™s when I switched toā€¦

Fix #2 - IO Nice

The IO Nice utility (part of the util-linux package in Debian and Ubuntu) allows system users / admins to adjust the scheduling class for an application, which indicates when the process should run: in real-time, as a best-effort (but giving way real-time applications), or only when the system is otherwise idle.

# Install util-linux
> sudo apt install util-linux
  • again, I edited the syncthing.service file, but this time, I made my ExecStart directive look like this:
# We want syncthing to be run as a "best-effort" application
ExecStart=/usr/bin/ionice -c 2 /usr/bin/syncthing -no-browser -no-restart -logflags=0
  • Finally, I restarted the SyncThing service (aain):
# Reload the service files
> systemctl daemon-reload
# or use `systemctl --user daemon-reload` for user-specific services

# Restart the SyncThing service
> systemctl restart syncthing.service
# or use `systemctl --user restart syncthing.service` for user-specific services

Itā€™s been a little over a month since I made this change, and I havenā€™t experienced a laptop freeze-up since. I did have a similar problem with SyncThing on the machine that Iā€™m backing up to, and wound up implementing the IO Nice limit on that box, too (with the same result).

Iā€™ll update this post (again) if I run into any other issues with SyncThing.


Things I Couldn't Say

TL;DR — My previous employer's policies prevented me from voicing my opinions on certain topics. As I am no longer employed by them, these are those opinions.

👓 2 minutes

As I mentioned before, I have recently ended my employment relationship with a certain telecommunications entertainment company, and while I donā€™t want to be seen as someone who bad mouths their former employer, the truth is that they had some policies in place that prevented me from voicing my opinions on certain topics while I was working for them. This is not me complaining so much as explaining why I feel the need to make the following statements now, as opposed to when they were somewhat more relevant to current events.

  • Net Neutrality is a good thing, and it needs to be re-instated ASAP - the major ISPs in the US have proven time and again that they canā€™t be trusted, and that they will use every opportunity to try and take advantage of their customers. IMHO, this is a result of the total lack of competition outside of the top 30-50 markets (and sometimes, even within them, meaning that most customers in the US only have one or maybe two competing ISPs available (and who knows how many are in the same position I am, where only one offers actual high-speed internet, with the other limited to offering DSL). This is why we need #NetNeutrality .

  • Targeted #advertising is not a good thing - Iā€™m not a huge fan of surveillance capitalism in general, but I have a particular distaste for targetted advertising, mostly because of the (unintended?) side effects that we see all around us (filter bubbles, fake news, weaponized misinformation, etc.). That having been said, I do still have a number of Google products in my house, primarily because they are useful devices to have, and (IMHO) that usefulness justifies the data that Google can scrape about me from them. However, to suggest that targetted advertising itself is so useful that we should allow advertisers to collect data about us is, to me, not only the height of arrogance (assuming that these offers are so good that weā€™ll beg them to take our information), but (because those ads track you further) become something of a circular argument: we need to collect this data, so we can show you better ads, which will track you further, so we can collect more data, so we can show you better ads, which will track you furtherā€¦

  • Media conglomeration is not a good thing - there was a time when various arms of the federal government would actually move in order to stop dangerous potential monopolies from forming, but with a few exceptions, that hasnā€™t happened much lately (even though it should). IMHO, telecommunication companies, as gateways to content, should be barred from owning entertainment companies that produce said content (or, if not barred, at least forced to operate those companies at armā€™s length) in order to help guarantee competition.

  • Donald Trump is an unhinged, narcissistic ass-clown who is incapable of telling the truth, and who will go down as one of the worst (but hopefully not last) US presidents in history - I donā€™t think I need to elaborate on this one.

I may have more to add to these someday soon, but for now, the above statements will have to do.


My Blogging Problem

TL;DR — Social media navel gazing about my love/hate relationship with blogging, all because I'm launching a new journal (not blog) at www.itsericwoodward.com/journal/.

👓 2 minutes

I have a problem with #blogging .

For a long time, I assumed that it was a time issue - I felt like I either didnā€™t have the time to do anything cool (which would give me something to blog about), or I felt like I didnā€™t have the time to blog about the few cool things that I did accomplish.

Then, when I did have some time, there would always be other reasons that I couldnā€™t write: Iā€™d have issues with my blogging software (and wind up spend time either diagnosing it, fixing it, or looking for a replacement), or Iā€™d get distracted updating the servers, or by a family issue, or any number of 100 other things.

But what makes it worse is my other problem: every few weeks, Iā€™ll go on a tear where I get hyper-focused on a single topic or idea, and spend a large amount of my free time either researching it, attempting my hand at it, or both. And then, after a few weeks, Iā€™ll inevitably move on to some other topic (something Les Orchard calls ā€œSerial Enthusiasmā€), and I wonā€™t take the time to document what I learned / accomplished during said tear.

Butā€¦ no more.

This post represents the first in (what I hope will be) a series of journal entries about the various things that Iā€™ve done and/or learned about in the few months/years/lives, in hopes of doing my own small part to develop the web. In addition to posting new items here, I also plan to (eventually) import most of my entries from my on-again-off-again Known instance (aka just in case something bad happens to it). Iā€™ve got a few other ideas, too, but weā€™ll see how industrious I am.

And, in order to break my blogging curse, this will not be called a blog, but rather a journal, and it will live at ItsEricWoodward.com/journal/.

So, I hope you enjoy my new journal, and if youā€™re already here, I say ā€œThanks for stopping by, feel free to take a look around, but please donā€™t let the cats out.ā€ ā˜ŗ