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

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]

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

It's incredible that ChatGPT isn't laden with ads (yet)

ChatGPT seems to be quite good at product recommendation. Furthermore, it will describe things without the usual SEO spam hype, and you can ask it if it doesn't tell you already to give comparisons in terms of pros/cons and other tradeoffs, interesting requirements many reviewers won't consider like being able to fit a console in a backpack or being such and such height, estimate price ranges...

I used it to help locate and decide on a modestly priced sleeping bag and 1-person tent ($200 total), having tested them I'm a bit iffy on the sleeping bag but mostly because it's a mummy bag and I've never had one of those before; it does actually fit me (I'm pretty tall). Anyway the experience of having it find and recommend 5 different products for me to look at was a lot more pleasant than using google to find an SEO'd site that probably won't give me what I really want.

I've also had it recommend me some backpacks as I think next time I do long international travel I want to try a backpack instead of messenger back to haul around my laptop etc. Problem is it gave me like 3 good options, now it's just a me-issue in paralysis for which one to try.

See Full Post and Comments

Package-local nicknames

Got around to reading this blog post, seems like something to ramble about myself as ultimately I disagree though I like his arguments. I will now proceed to jump into the shark pool, but while in the air let me babble--

First, I think if you're using the package-inferred-system style, then yes, nicknames are largely pointless. (Though not package prefixes, which I'll get to in a bit.) Most of the time it'll be fine to just :use the packages you need for that file. While in that file, you know all the symbols in use are defined at the top of the file if you're ever in doubt where they come from and don't feel like describing/hovering over the symbol or jumping to the source. Like Java, using this style also encourages to keep files relatively smaller as well, which helps keep the number of symbols at play per file relatively smaller.

I'm not a huge fan of package-inferred-system, at least in the way ADSF implemented it. Also, it seems like the linked post's main complaint isn't so much around nicknames, but around package names entirely. Their example Python code of preferring from sys import argv, exit over import sys and later using sys.argv and sys.exit suggests that to me.

See Full Post and Comments