Categories
coding

Fortune

I’ve been learning Terminal commands from a new book that I got, “Tweak Your Mac Terminal“.

Reading through the first chapter, I discovered a simple command-line utility called “Fortune”. When it’s installed and run at the command-line, Fortune displays random quotations or proverbs. It is often used to provide a humorous or thought-provoking message to users when they log in or open a terminal session. I noticed within the fortune manual (man fortune) that there were some offensive fortunes that had been relegated to only operating when one entered the -o flag (fortune -o) but then discovered that the offensive quotations had actually been removed altogether from the home-brew repository because, well, it includes explicitly racist, homophobic, ethnically insensitive and other offensive content that directly conflicts with the Homebrew’s code of conduct.

Curiosity killed the cat and I found them online. Needless to say, they are at least pretty crass if not outright offensive. But finding them led me down the path to discovering how one creates their own quotations to add to the library of possible fortunes.

To add your own quotations or messages to the fortune database, you’ll need to create a custom fortune file and then compile it into a .dat file. Here are the steps:

Create a Fortune File:
  • Open a text editor, such as bbedit, nano, vim, or gedit.
  • Add your quotations or messages, one per line, to the file. Each message should end with a % character. For example:
This is my first custom fortune message.
%
Here's another custom fortune message.
%
Add as many messages as you like.
%
  • Save the file with a .txt or .dat extension (e.g., my_fortunes.txt).
Convert the Fortune File:
  • Use the strfile command to convert your text file into a .dat file. The .dat file is used by the fortune program to provide random messages efficiently. Run the following command:
strfile my_fortunes.txt my_fortunes.dat
  • Replace my_fortunes.txt with the actual name of your text file and my_fortunes.dat with the desired name for your .dat file.
  • Install or Copy to Fortune Directory:
  • If you want to make your custom fortunes available system-wide, you can copy the .dat file to the system’s fortune directory. On most Unix-like systems, this directory is typically /usr/share/games/fortunes/ or /usr/local/share/games/fortunes/. You may need to use sudo to copy the file:
sudo cp my_fortunes.dat /usr/share/games/fortunes/
Categories
coding

Scrumdinger

scrumdinger card color not working

I’ve been dabbling with Xcode since I got my first Macbook back in 2016. I’ve wanted to learn how to make an iPhone app and especially how to make one that uses SwiftUI, the user interface is growing in popularity and by all accounts is Apple’s recommended choice. Last month I started on this tutorial from Apple’s developer site and last week I finished it! The app is called Scrumdinger and it helps keep track of speaking turns and time limits during a meeting.

A screenshot of the Scrumdinger app.

One problem that needed to be sorted out happened within the section titled, “Creating a card view“. I ran into this warning:

Because I had followed the first section perfectly, I assumed I didn’t need to download the Scrumdinger “starting project” because if that was the case, then how would I be able to make an app myself? Eventually I discovered I would need to add color assets to Xcode in order to avoid needing the “starting project” files.

After eventually figuring out how to do it manually, I made this video showing a quick look at the process:

Then repeat for the remaining 15 colours or just download the “starting project”. I can see why the writers of the tutorial opted to skip the tedious operation of adding each colour manually but it’s nice to know how to do it.