Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Finding the best tokens to money ratio from mission items in Lego Universe

In the self-hostable Darkflame Lego Universe game server, you can earn 2 types of currency: money, and faction tokens. In the late game, you accumulate these in spades, but only money is still the most useful. So a lot of advanced players are interested in determining the most efficient way to convert faction tokens into money.

The way to do this scientifically is within the database. All the mission objects are stored in the CDServer.sqlite file, so we can use sqlite3 for this.

I have a whole methodology of what I did, in heading Narrative below. It's very lengthy, and really just my scratch pad combined with the steps I took to become familiar with the database.

tl;dr

All the experienced Lego Universe players are right: Castle Model Pack 3. You can buy this for 10 tokens at Honor Accolade in Nexus Tower, and sell the items from it for 798 money, which makes the token:money ratio 1:79.

Fun picture showing ratio of money to tokens at 79:1

Sql query

You need at least sqlite 3.39 for the FULL JOIN operation. My narrative explains the same query without it, but you're not going to like it.

Technically this query is still incomplete because it shows some of the "small number of random options for rewards" but they also aren't available at Honor Accolade.

SELECT i.mid, IFNULL(i.tokens,0)+IFNULL(p.tokens,0) tokens, IFNULL(i.money,0)+IFNULL(p.money,0) money, ((IFNULL(i.money,0)+IFNULL(p.money,0))/10)/(IFNULL(i.tokens,0)+IFNULL(p.tokens,0)) moneypertoken, i.oid, i.name, p.o2count, p.o2id, p.o2names
FROM (
    SELECT m.id mid, SUM(IFNULL(ic.commendationCost,0)) AS tokens, SUM(IFNULL(ic.baseValue,0)) money, o.id oid, o.name name, NULL, NULL, NULL
    FROM Objects o
    JOIN ComponentsRegistry cr ON cr.id = o.id
    JOIN ItemComponent ic ON ic.id = cr.component_id
    JOIN Missions m ON o.id IN (m.reward_item1, m.reward_item2, m.reward_item3, m.reward_item4)
    WHERE cr.component_type IN (11)
    --AND m.id IN(427,14,17,82,633)
    GROUP BY o.name
) i --items
FULL JOIN (
    SELECT mid, SUM(IFNULL(tokens,0))+SUM(IFNULL(tokens2,0)) tokens, SUM(IFNULL(baseValue,0))+SUM(IFNULL(baseValue2,0)) money, oid, SUBSTR(MAX(oname),1,300) name, o2namecount o2count, SUBSTR(GROUP_CONCAT(o2id),1,300) o2id, SUBSTR(GROUP_CONCAT(o2name),1,300) o2names
    FROM (
        SELECT m.id mid, cr.component_id as crid, ic.baseValue, ic.commendationCost AS tokens, o.id oid, o.name oname, pc.LootMatrixIndex, SUM(ic2.baseValue) baseValue2, SUM(ic2.commendationCost) as tokens2, SUBSTR(GROUP_CONCAT(o2.id),1,300) o2id, SUBSTR(GROUP_CONCAT(o2.name),1,300) o2name, COUNT(o2.name) o2namecount, GROUP_CONCAT(ic2.baseValue) o2_baseValues
        FROM Objects o
        FULL JOIN ComponentsRegistry cr ON cr.id = o.id
        FULL JOIN ItemComponent ic ON ic.id = cr.component_id
        FULL JOIN PackageComponent pc on pc.id = cr.component_id
        FULL JOIN LootMatrix lm ON lm.LootMatrixIndex = pc.LootMatrixIndex
        FULL JOIN LootTable lt ON lt.LootTableIndex = lm.LootTableIndex
        FULL JOIN Objects o2 ON lt.itemid = o2.id
        FULL JOIN ComponentsRegistry cr2 ON cr2.id = o2.id
        FULL JOIN ItemComponent ic2 ON ic2.id = cr2.component_id
        FULL JOIN Missions m ON o.id IN (m.reward_item1, m.reward_item2, m.reward_item3, m.reward_item4)
        WHERE cr.component_type = 53
        AND cr2.component_type = 11
        --AND m.id IN (427,14,17,82,633,1254)
        AND lm.percent > 0.98 AND lm.minToDrop >=1
        AND o.id > -1
        GROUP BY o.id
    )
    GROUP BY oid
) p --packages
ON i.oid = p.oid
ORDER BY moneypertoken DESC
;

Inferior sql query

The query without full joins and is slightly more flawed, is this one. You can run this on CentOS 7 sqlite3 (less than 3.39).

Read more…

html collapsible div without javascript

I wanted to have some collapsible contents in html without using javascript. I was fine using css, but a brief Internet search revealed this gem: css - Collapse without javascript - Stack Overflow

Just use the detail tag. That's it.

<detail><summary>Instructions</summary>Install the application underneath /usr/bin, and the desktop icon in /usr/share/applications.</detail>

Let's see if what I put below works in the final rendered web page.

InstructionsInstall the application underneath /usr/bin, and the desktop icon in /usr/share/applications.

References

In-line.

Adding Let's Encrypt root certs to Android 6

Old Android devices do not have the current Let's Encrypt root certificates installed, e.g., Android < 7.0.

You might need to enable a screen lock password or pin (Settings -> Security -> Screen lock -> PIN). You can remove it after installing these certs.

Install these certificates for "VPN and apps." Note that old Android might want to download these as a .crt file extension, in order to prompt you to install them as a trusted root, which is left as an exercise for the reader.

  1. ISRG Root X1 https://letsencrypt.org/certs/isrgrootx1.pem
  2. Let's Encrypt R3 https://letsencrypt.org/certs/lets-encrypt-r3.pem

References

Weblinks

  1. Ripped directly from How-to install a root certificate on Android 6.0 devices? – Geolantis.360 Knowledgebase
  2. Extending Android Device Compatibility for Let's Encrypt Certificates - Let's Encrypt

carps-cups driver works great for Canon ImageCLASS D320

I have a desktop Linux user who needed to print to his old Canon ImageCLASS D320 printer. CUPS doesn't have any built-in drivers for this, so I had to search the Internet like a noob. But, my ability to use what I found very much depends on my experience and expertise! And thankfully, the project I found, carps-cups was well-designed and took only a small amount of expertise. A standard make && sudo make install later, we could print to the printer!

Further poking after the fact, I should have tried building a dpkg. It was a single user, in a non-scaling environment, so I didn't bother. But if the printer were on my main network (well, it would be behind the one cups server), I would have investigated a dpkg.

FreeIPA on Devuan and sss ssh knownhosts proxy

After this month's updates to my operating systems, I have found something frustrating regarding sssd/freeipa.

Firstly, I had to udpate my package to depend on dnsutils | bind9-dnsutils, which was also shared with upstream Debian package by somebody else shortly afterwards. Seriously, I beat them by 1 hour!

Secondly, after updating, I would get a bogus error when using ssh client.

$ ssh server3

******************************************************************************
Your system is configured to use the obsolete tool sss_ssh_knownhostsproxy.
Please read the sss_ssh_knownhosts(1) man page to learn about its replacement.
******************************************************************************

Connection closed by UNKNOWN port 65535

Apparently file /etc/ssh/ssh_config.d/04-ipa.conf which is not directly owned by package freeipa-client (because it depends on freeipa being configured; i.e., the host being joined to a domain) contains a now-deprecated piece of information. I had to dig around to find info about this. It was back in version 4.12.0. The FreeIPA team wanted to replace sss_ssh_knownhostsproxy with sss_ssh_knownhosts (bug #9536). They solved their upgrade processes, presumably for the Fedora/Enterprise Linux world, but whatever fixes they did apparently don't run client-side on a Devuan/Debian freeipa client.

So I had to poke around to learn exactly what my 04-ipa.conf should look like. I found it:

# IPA-related configuration changes to ssh_config
# Last-modified: 2025-02-02-1 22:25 bgstack15
# References:
#    https://github.com/freeipa/freeipa/pull/7345/files
#    https://www.freeipa.org/release-notes/4-12-0.html
PubkeyAuthentication yes
GlobalKnownHostsFile /var/lib/sss/pubconf/known_hosts
#VerifyHostKeyDNS yes

Match exec true
   KnownHostsCommand /usr/bin/sss_ssh_knownhosts %H

# Deprecated as of v4.12.0
# assumes that if a user does not have shell (/sbin/nologin),
# this will return nonzero exit code and proxy command will be ignored
#Match exec true
#   ProxyCommand /usr/bin/sss_ssh_knownhostsproxy -p %p %h

I wonder if this is something worth reporting to the Debian package. I'm not entirely certain how the "upgrade logic" is applied; I only was researching the end-effect in the config file. I just want my ssh client to work! A brief examination of my EL8 equivalent shows it's still on freeipa 4.9, and EL9 equivalent is on 4.12.2 but there's no /usr/bin/sss_ssh_knownhosts binary and that old sss_ssh_knownhostsproxy works correctly.

So I will just distribute this /etc/ssh/ssh_config.d/04-ipa.conf to all my Devuan systems and call it a day.

#!/bin/sh
# Startdate: 2025-02-03-2 08:38
# Purpose: install the freeipa >= 4.12.0 /etc/ssh/ssh_config.d/04-ipa.conf file
sudo install -m 0644 -o root -g root /mnt/public/Support/Platforms/devuan/04-ipa.conf /etc/ssh/ssh_config.d/04-ipa.conf

References

All links in-line.

Jitsi reenable self view

Jitsi Meet is great software. It's gotten better and better over time! Unfortunately, there's one little tiny problem. If you hide your self-view, you see a little notification that says you can re-enable the view from Settings. This information is wrong, however. So you have to run a little javascript scriptlet and somehow reload the page, without it overwriting this value. I haven't quite settled on what exact order of operations (run javascript, reload page, log out of meeting?) needs to happen, but hopefully somebody else can move this further along and make it work in the end.

a = JSON.parse(localStorage["features/base/settings"]);
a["disableSelfView"] = false;
localStorage.setItem("features/base/settings",JSON.stringify(a));

LibreOffice Customize Keyboard does work, but...

When you go to customize keyboard shortcuts so that there's some keystroke for increasing and decreasing font size, you will discover something. And upon taking screenshots for writing this post, everything makes sense now!

screenshot, too big

Screenshot of a cell with a value too large for the width

You will find the Menu Tools... -> Customize... -> dialog tab Menus and learn the name of the operation that should happen.

Read more…

Sort using rDNS naming

Notice

This post has nothing to do with dns or reverse dns. This is only talking about sorting text.

Main

Sort of like how flippin' freedesktop.org uses "reverse DNS names" to get such lovely files as /usr/share/applications/org.geeqie.Geeqie.desktop, I wanted to sort some domain names. A sorted list looks less like I just made it up, and like I pulled it out of a report or tool!

So I have a small script here that sorts via "reverse DNS" convention.

awk -F'.' '
{
    for (i=NF; i>0; i--) {
        printf "%s %s", $(i), (i>1 ? "." : "")
    }
    print $0
}' | sort | awk '{print $NF}'

It was too small to bother putting it in the files/ for this post.

Fedora 41: Lessons learned

Operations for each new OS level release

I need to create a few new files.

  1. /mnt/public/www/domainname/repo/mirror/bgstack15-stackrpms-fedora-41.repo
  2. /mnt/public/www/domainname/repo/mirror/example-bundle-fedora41.repo

Lessons learned

  1. Fedora 41 now needs more than 2GB of RAM for the installation, despite the hardware overview saying 2GB is enough.
  2. If you experience the forever dots beneath "Starting automated install.Checking storage configuration...", the problem might be in your kickstart file. You might not be able to access one of the --repo values. You can learn which one by pressing CTRL+C on the text console, and letting it dump to the /tmp/anaconda-tb* file(s) for more details. Then you can find:

    WARNING org.fedoraproject.Anaconda.Modules.Payloads:    raise SourceSetupError(msg.format(name=respotiroy.name, details=str(e))) from None
    WARNING org.fedoraproject.Anaconda.Modules.Payloads:pyanaconda.modules.common.errors.payload.SourceSetupError: Failed to add the 'fedora-cisco-openh264' repository: Failed ot download metadata for repo 'fedora-cisco-openh264': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
    

    It's a shame this couldn't be more visible, or offered to skip, but it is supposed to be an automated install. But an automated install should make errors more visible on the completely-stuck part.

Read more…

PulseAudio send audio to 2 outputs

If you want to send audio to multiple outputs (that are not a part of the built-in sound card such as the headphone jack and the speaker jack) at the same time, you can use a feature of pulseaudio to accomplish this.

Technically this will generate a new sink that will send to all possible outputs, so I hope that is sufficient. I didn't dabble with the module parameters for listing the intended slave sinks.

You load an additional pulseaudio module, such as with this command. It does not give a custom name or choose specific sinks to use so it will use all sinks.

pactl load-module module-combine-sink

Or put this in your file /etc/pulse/default.pa.d/local.pa or similar:

load-module module-combine-sink sink_name=combined sink_properties=device.description="combined"
set-default-sink combined

If you do not give a short description (what lots of paradigms would call "display name"), it will use the default one which lists all devices, and it can overwhelm your menus when choosing an output device!

References

Weblinks

  1. pulseaudio - Play sound through two or more outputs/devices - Ask Ubuntu