Month: July 2024

On Suddenly

I had a dual major in Uni: history and theoretical physics. My “history mentor” was someone who studied under Howard Zinn, so my knowledge tends towards a somewhat alternative version of history. And his thesis was on slavery — so many of the Project 1619 ideas were hardly new to me. Listening to Trump say VP Harris turned Black — beyond sounding racist weird — shows a remarkable lack of historical perspective and a stunning US-centric view of the world.

Harris’s father is Jamaican. To say she isn’t Black is to say Jamaicans aren’t Black. The University of the West Indies has some 76% of the Jamaican population being of African descent.

Does he think the entirety of the slave trade was built around the USA?!? Over 90% of enslaved Africans were sent to South American and the Caribbean. Jamaica, specifically, was a British colony — and somewhere between half a million and a million enslaved people were sent there. Why? Sugar production! There were about 400,000 enslaved Africans sent to the USA. So, based on historic records? More Africans were kidnapped and forced into slavery in Jamaica than the USA.

https://www.slavevoyages.org/

Verifying Public and Private Keys Go Together

I have no idea how exactly I managed this — but I was renewing certificates on a group of servers and had one that would not work. It’s a Java app, and it just threw a generic handshake error. Even adding debugging didn’t add any useful information. It just didn’t work. Turns out my pubilc key and private key files didn’t go together. I didn’t bother figuring out which one I got wrong — I just downloaded the zip file from our cert provider again.

Using openssl to check the modulus of the cert and key — by getting an md5 checksum of the value, it’s a little easier to compare. This public private key pair go together — they’ve got the same modulus. My original files? Not so much — two different values!

linux1570:certs # openssl x509 -noout -modulus -in /opt/elk/opensearch_config/certs/20240722/$(hostname).pem | openssl md5
(stdin)= 52ca3e85fa7cb564dd395a8f801f9bdf
linux1570:certs # openssl rsa -noout -modulus -in /opt/elk/opensearch_config/certs/20240722/$(hostname)-nopass.key | openssl md5
(stdin)= 52ca3e85fa7cb564dd395a8f801f9bdf

Migrating Redis Data

So, I know that Redis should be a data cache that can be repopulated … but we use it to calculate deltas (what was the value last time) … so repopulating the information makes the first half hour or so of calculations rather slow as the application tries redis, gets nothing, and fails back to a database query. Then we get a backlog of data to churn through, and it would just be better if the Redis cache hadn’t gone away in the first place. And if you own both servers and the files are in the same format, you could just copy the cache db from the old server to the new one. But … when you cannot just copy the file and you would really prefer the data not disappear and need to be repopulated … there’s a script for that! This python script reads all of the data from the “old” server and populates it into the “new” server.

import redis

def migrate_data(redis_source_host, redis_source_port, redis_source_db, redis_source_password,
                 redis_dest_host, redis_dest_port, redis_dest_db, redis_dest_password):
    # Connect to the source Redis server
    source_client = redis.StrictRedis(host=redis_source_host, port=redis_source_port, db=redis_source_db, password=redis_source_password)

    # Connect to the destination Redis server
    dest_client = redis.StrictRedis(host=redis_dest_host, port=redis_dest_port, db=redis_dest_db, password=redis_dest_password)

    # Fetch all keys from the source Redis
    keys = source_client.keys('*')

    for key in keys:
        # Get the type of the key
        key_type = source_client.type(key).decode('utf-8')

        if key_type == 'string':
            value = source_client.get(key)
            print("Setting string value in dest")
            dest_client.set(key, value)
        elif key_type == 'list':
            values = source_client.lrange(key, 0, -1)
            print("Setting list value in dest")
            dest_client.delete(key)  # Ensure the list is empty before pushing
            for value in values:
                dest_client.rpush(key, value)
        elif key_type == 'set':
            values = source_client.smembers(key)
            print("Setting set value in dest")
            dest_client.delete(key)  # Ensure the set is empty before pushing
            for value in values:
                dest_client.sadd(key, value)
        elif key_type == 'zset':
            values = source_client.zrange(key, 0, -1, withscores=True)
            print("Setting zset value in dest")
            dest_client.delete(key)  # Ensure the zset is empty before pushing
            for value, score in values:
                dest_client.zadd(key, {value: score})
        elif key_type == 'hash':
            values = source_client.hgetall(key)
            print("Setting hash value in dest")
            dest_client.delete(key)  # Ensure the hash is empty before pushing
            dest_client.hmset(key, values)

    print("Data migration completed.")

if __name__ == "__main__":
    # Source Redis server details
    redis_source_host = 'oldredis.example.com'
    redis_source_port = 6379
    redis_source_db = 0
    redis_source_password = 'SourceRedisPassword'

    # Destination Redis server details
    redis_dest_host = 'newredis.example.com'
    redis_dest_port = 6379
    redis_dest_db = 0
    redis_dest_password = 'DestRedisPassword'

    # Migrate data
    migrate_data(redis_source_host, redis_source_port, redis_source_db, redis_source_password,
                 redis_dest_host, redis_dest_port, redis_dest_db, redis_dest_password)

Phlox

We have wild phlox that is purple and we have wild phlox that is white. But every now and again we get one that is white with purple stripes, and I love those. Anya dug this one up from the field and planted it in my bee garden last year, and it is huge this year. And still has the striped flowers that I love!

Nesting Instinct — Duck Edition

One of our Pekin ducks has gone broody — but people have managed to sufficiently breed out brooding instinct to what I call “short attention span nesting”. She absolutely needs to sit on a nest. For about 20 minutes, then she’s ready for a swim in the pond or some chow. Which means we wouldn’t trust them to hatch eggs — we’ve got incubators for that. She has, however, figured out a reasonable solution: pinecones. No one takes them from her .She can even leave them out in the yard overnight and the marauding racoon will leave it alone. She built a very convincing nest in our pine trees (and was frantically trying to escape the fence to go sit on the nest) … so Anya relocated it into the duck yard and got the duck over to it. Now she’s got a nest inside the fence to sit on for half an hour and doesn’t seem so compelled to escape.

Homemade Jerky

Scott got some jerky from a local butcher — something like twenty bucks, and he could have eaten it as a snack one night and been done. It was really good, though, and inspired me to research making our own. In an amazing coincidence, a local grocery store put a lot of eye of round on FlashFood,  so I was able to get about 5kg (~11 pounds) of beef for $3/lb.

I made two different recipes — one with smokey guajillo peppers that I use for chili and one with hot pepper flakes. The base marinade was the same, though: for every 1.5 kg of beef, use 1 cup soy sauce, 1/4 cup maple syrup, 2 tbs garlic, 1/3 cup medium ground black pepper, and 1 cup of water. To one batch, I added about 1 tablespoon of red pepper flakes. To the other, I broke up and added pieces (including seeds) of two dried guajillo peppers.

I used the food slicer to slice the meat about 1/4″ thick (we prefer the thicker slices it turns out). Unfortunately, the clearance beef was pre-cut into medallions. Another ‘note for next time’ is to cut with the grain instead of across!

Tossed this in the marinade to coat well, then put it all into a glass food storage container, and left it in the fridge overnight.

The next day, I dried the slices off slightly and laid them out across the food dehydrator trays. I was able to “cook” it all in two batches.

Let the food dehydrator “cook” for about 6 hours at 165F, and we’ve got homemade beef jerky!

and