TheJach.com

Jach's personal blog

(Largely containing a mind-dump to myselves: past, present, and future)
Current favorite quote: "Supposedly smart people are weirdly ignorant of Bayes' Rule." William B Vogt, 2010

The Last Choice

In the hushed space between breath and eternity, Alex found himself standing before a shimmering, formless entity. The ambient glow around it pulsed with warmth, knowledge, and an almost overwhelming compassion.

"Where am I?" Alex whispered, his voice sounding distant, like an echo from another time.

"You stand at the threshold of your next beginning," the entity replied, its voice a melody of countless harmonies. "You have departed your previous life, and now you must choose your next incarnation."

See Full Post and Comments

Japan Trip 3

Previously.

I went to Japan again for the third time, from Sept 15 (left on 14th) to Oct 6. It was sort of a last minute decision to go, with maybe 3 weeks of notice, so the flight wasn't the best. I don't want to fly Air Canada again. I asked a friend if he wanted to come, and he did, so that was fun. Though made hotel finding for the first 2/3 of the trip a bit more challenging, there aren't many twin bed rooms, and of those that are around there aren't many of sufficient room space. (300 sq ft is probably the minimum for two tall guys with stuff.)

My goals for the trip were pretty basic. First as a way to distract myself from some downer thoughts. And second as a pseudo bday gift to myself (though my bday itself is also somewhat a source of downer thoughts), I should maybe indulge in a bit of selfishness and spending on myself from time to time? Having my friend along would also provide some distraction plus practice in being a pseudo guide for someone's first real international trip. He doesn't really know any Japanese.

See Full Post and Comments

Minor apache adjustment

Figured I should do something about naked requests to this server's IP returning an old subdomain's content I don't really put anything on anymore. By default, Apache will use the first configuration it finds (reading vhost files alphabetically) if a request comes in without an associated domain name. Just so happened that the subdomain on another site was alphabetically first. Anyway, I looked up a fix, it seems to work, just put this at the top of that file:


<VirtualHost *:80>
ServerName default
RewriteRule ^ - [F]
</VirtualHost>


Now naked requests return a 403 error, good. Amusingly this can be an issue for HTTPS too. Even though a secure connection by design requires a domain name, browsers can ignore the mismatch and curl can use -k flag and bots can do whatever. So the default response was for another site I recently setup that's alphabetically prior to this one. Solution is similar, but with Apache you must load an SSL key for the connection anyway, or things will break:

See Full Post and Comments

Why is he like this

The stewardship of twitter continues to be a mess of 1 step forward 2 steps back. What will it take to break it?

I guess I'll still be here on my little blog. I should post more. Like about my recent trip to Canada...

Edit: the only thing more insufferable are his antis.

See Full Post and Comments

Brief notes on the mess of scripts involved for Coyo YouTube Post Notifications

I don't exactly know which audience I should write this for, so I'll try just giving some high level notes and anyone curious can follow deeper if they want. If you have any questions feel free to bring them up. Anyway, the context behind this post is that because YouTube won't do notifications of community posts for some reason (though it does do notifications of member posts...) I decided to solve the problem for myself. This initially resulted in a quick and dirty script here.

All the script does is this:
  1. Open up a new instance of my Firefox browser, in "headless" mode so that it doesn't actually show up in my task bar and interfere with any other windows open on my desktop
  2. Navigate to Coyo's community tab
  3. Check to see if there's any new message or not from last time it checked.
    • If there was a new message, notify about it.


I have the script arbitrarily set to run once every five minutes, so there's not too much delay between a post being made and seeing it. This is done with a simple bash loop: while true; do sbcl --script coyo_yt_posts.lisp; sleep 300; done But it could just as well be done by modifying the Lisp code instead, or setting a cron job. (Edit: the latest version of the script on gist now has a loop in the Lisp code and is a bit more robust to some errors.) I could also compile the script into an EXE binary, but there's no need here. The way it checks if a post is new or not is also stupidly basic: it just saves the contents to a local file, and compares against that each time, overwriting it with the new post if it's different.

See Full Post and Comments

What's the value for a programmer to learn Common Lisp these days?

The value depends on what you already know and whether you want to substitute potentially inferior versions of the thing to acquire or make use of the knowledge. I'll list some ideas of useful concepts you may or may not have picked up already.

First, a lot of languages have closures these days, do you know them and more generally how to tastefully use higher-order functions? When Java 8 came out, I could see a difference between programmers who had useful experience or instruction (Scheme + SICP is still great on this) using closures elsewhere prior, excited programmers who were using them for the first time even if frequently not tastefully, and old programmers who had never strayed outside their lane and look at any new language feature or evolution that they now have to learn and contend with to keep up with a shady eye, never mind the potential benefits.

Second, some languages have something like macros, how familiar are you with metaprogramming? Maybe you'll be satisfied with C++? A comparison from the author of the CLASP implementation who is an expert in both langs: Lisp macros are to C++ templates as poetry is to IRS tax forms.

See Full Post and Comments

Collision detection comparison with Python and C++

In 2014 I wrote a post about mixing Python with C. At the end I said I wanted to try a comparison to show that, generally, algorithms trump language. The comparison was to have a 'game' where a lot of boxes fly around the screen and if they hit each other or the screen edge, they reverse their direction. We'd see how far we can push a C (now, I'm going to use C++) version of such a program and how far we can push a Python version, each using the same/different collision detection algorithms.

I enlisted ChatGPT to help me with this. I'm quite impressed.

First I asked it: "Can you write a simple C++ program that uses SDL2 to make a bunch of simple boxes fly around the screen? If they collide with the edge of the screen they should react naturally"

See Full Post and Comments