TrickJarrett.com

Posts Tagged: programming

Had a programming idea last night. I've spent the past hour and a half futzing with the concept to see if it has legs or not.

Share to: | Tags: programming

Some truly excellent programming quotes

Share to: | Tags: programming, quotes

"My team's intern just found a critical bug by shitposting in our codebase"

Found this story on LinkedIn and it made me laugh.

So our summer intern (who I'm 90% sure is a professional shitposter moonlighting as a dev) just saved our entire authentication service by being, well, an absolute agent of chaos.

Background: We have this legacy auth system that's been running since before TikTok existed. No one touches it. It's documented in ancient Sanskrit and COBOL comments. The last guy who understood it fully left to become a yoga instructor in Peru.

Enter our intern. First week, he asks why our commit messages are so boring. Starts adding memes to his. Whatever, right? Then he begins leaving comments in the codebase like:

// This function is older than me and probably pays taxes // TODO: Ask if this while loop has health insurance // Here lies Sarah's hopes and dreams (2019-2022), killed by this recursive call

The senior devs were split between horrified and amused. But here's where it gets good.

He's reading through the auth code (because "the commit messages here are too normal, sus") and adds this gem:

// yo why this token validation looking kinda thicc though // fr fr no cap this base64 decode bussin // wait... hold up... this ain't bussin at all

Turns out his Gen Z spider-sense wasn't just tingling for the memes. Man actually found a validation bypass that's been lurking in our code since Obama's first term. The kind of bug that makes security auditors wake up in cold sweats.

The best part? His Jira ticket title: "Auth be acting mad sus rn no cap frfr (Critical Security Issue)"

The worst part? We now have to explain to the CEO why "no cap frfr" appears in our Q3 security audit report.

The absolute kicker? Our senior security engineer's official code review comment: "bestie... you snapped with this find ngl"

I can't tell if this is the peak or rock bottom of our engineering culture. But I do know our intern's getting a return offer, if only because I need to see what he'll do to our GraphQL documentation.

Share to: | Tags: humor, linkedin, digital security, programming

My Progamming Language Journey

This post by Ruben Schade walks through his history with programming and the languages he's used. It inspired me to do the same.

QBasic - I did some very early programming with QBasic, but never really unlocked anything with it. I did it because I liked computers and it's what I was supposed to do as someone who liked computers.

HTML - I learned HTML in the early days and I would wager it is the most used language over my lifetime for programming.

mIRC Scripting - This one takes some explaining. In the old days we used chatrooms on a network of servers called IRC (Internet Relay Chat.) It's still around but it's very small these days. Honestly what people are used to in Discord and streaming chat, is basically built on and modeled after chat on IRC.

mIRC was a shareware bit of software which allowed you to write scripts and create "bots." They could do simple things like moderate you chatroom, do simplistic games, run file sharing services, etc. I really got programming with mIRC. I could write something and immediately use it in chat with friends. While I knew and used HTML and enjoyed it, this is really where I feel I became a programmer.

C++ - In high school I learned C++, but honestly I had had a taste of programming for the Internet with HTML and mIRC, and that is where my interest was. C++ and using it online were, at the time, not easily connected and so my interest waned.

Javascript - I didn't immediately dive into it. The history and journey of Javascript is from small functions for the web to the behemoth it is today (which still boggles my mind.) But I didn't really get into Javascript right away. In my mind it was later in high school.

Smalltalk - My freshman year at Georgia Tech, the CS intro course used Alan Kay's Smalltalk. A variant of Lisp. Python caught on as the intro language in the next year or two. Smalltalk was interesting but ultimately again the usage was through a specific lens and it didn't grasp me.

PHP - I don't remember exactly when I picked up PHP. But it has been my go-to development language of choice for web backend programming. Warts and all.

SQL - Around this same time, I also began learning SQL queries. It was entirely to be supplementary to things I programmed.

Java - I only have vague memories of this as a language used for courses. My recollection was it hitting harder on trying to drive object-oriented programming and programming basics. I didn't love the language.

C - I don't remember the exact courses, but I learned C and used it for several courses. I remember doing team projects to make a Tanks game and also a variant on Lemmings that were fun.

Lisp - Full Lisp came later, in a course with Thad Starner. I had actually seen him on TV before the class because he was on the vanguard of wearable computing. For his course, we used Lisp and I recall again, enjoying it, but it was delving deeper into computer theory and again not what I grabbed onto.

ASP - As I recall, I used this for my college internship with Lonnie Harvel. And is my only contribution to a published research paper with 'Using student-generated notes as an interface to a digital repository'. Basically GT was on the forefront of video recording lectures as a resource for students, and we had nascent technology to recognize words in the audio of a video since there wasn't a transcript. So my research was working on ways to take the notes students might write and figuring out ways to tie them back to the video's audio. My core idea was to look for proper nouns and more complex words which would be easier to identify in the video and likely to be relevant to the student.

After college, I didn't immediately go into programming as a career. It became a side hobby mainly. And that hobby time was centralized around websites with PHP, HTML, Javascript and CSS.

ASP.net - When I got back to programming as a daily job, it was largely about ASP.net programming before transitioning back to PHP with Drupal work. I haven't gone back to ASP/ASP.net programming since then.

Kotlin - I learned this briefly back in 2012 as I recall, exploring Android app development. I used it for two app projects to learn and then dropped it.

Python - Honestly, the recency of this language is because I wanted to try it out. I decided to begin learning it for fun and have come to use it a lot more for desktop based projects.

As far as I can recall, that's the list of programming languages I've used, if I missed any there were small one-offs over the years. These days my programming is basically entirely PHP, Python, HTML, Javascript, & CSS.

Share to: | Tags: programming

Testing something

One of the features I love with Glowbug is how it can generate smart embeddings for content. Basically, I enter a custom tag of a URL and it generates special code which goes into the entry. Things like video embeds, social posts, etc. The majority of these are ones I have coded myself in the backend. However, there is a subset where I have found it is easier to make use of Iframely.

Iframely is a company which acts as a middle-agent for generating embeds. Currently they allow up to 1000 embed requests a month before charging you. Which is hugely more than I need, so it's a free service for me.

I make use of them for Wikipedia & YouTube embeds right now. Up to this morning, these domain checks were hardcoded. So, to add a domain (Iframely has several hundred websites they connect with) I'd have to modify the PHP file. This morning, I finally through together the code which lets me manage the list of domains which, if matched, are generated as embeds with Iframely.

So, now, I can add BoardGameGeek.com to their domain list and embed this:

No code changes, just adding BoardGameGeek to the database variable in the server.

Share to: | Tags: programming, glowbug

"Zork: The Great Inner Workings"

Zork largely predates me, though of course I'm familiar with it. I played it a bit in college (who didn't? It's an experimental time for so many.) But I recall being fascinated by its functionality and flexibility. This article is a great read into the way which those programmers pulled it off.

Of course it's a Lisp predecessor.

Share to: | Tags: programming, language, grammar

Today's coding output

Today was largely a lazy day except for some coding. Nothing was a major project, but I messed around with a few ideas and finally implemented a month calendar view for archives. Currently it's just in the sidebar of everyday to link the current month.

I also messed around with a few things:

RSS Headline Summarizer

A script which runs on my home machine where I can run a local copy of the Llama LLM, and I feed it the day's news headlines from my RSS reader, and it spits out a summary of the topics in the news. No real use, but was curious to mess around with the code for it.

Goliath

I worked on pulling all the links from my Bluesky and Mastodon feeds into its own RSS feed. This is a variation of something I had thought seriously a year or so ago which I called Behemoth. It would have been a combined reader for social feeds as well as RSS feeds, and other APIs I could fold into it.

Today was nowhere near that, and was just me poking around at the APIs for each platform, no full implementation.

Glowbug Calendars

As noted above, the calendar display for Glowbug. It's been on my to-do list for a while now and today was the majority of it. There's some more to do with reworking templating to allow the calendar to be set based on the page which is being generated.

--

Overall, it wasn't anything too strenuous, but just fun explorations and distractions during the day.

Share to: | Tags: programming, life

Reminder: Programmers program because we're lazy

Quick coding project this morning.

I finally implemented the man in the middle PHP code which ingests the Longreads subreddit feed and modifies the feed to make each entry link out to the remote URL rather than within Reddit. Previously, the link out was in the body of the post. Normally, this isn't an issue, just click the body link and not the title. But, if I want to save an entry for later reading in my Wallabag, it required me to take an extra step.

This is an excellent example of proof programmers are lazy. I spent 15 minutes coding a solution to a problem which has likely, in total, wasted 5 minutes of my life.

Share to: | Tags: programming

Small Glowbug Tweak

I love the automated post functionality I have on this blog. But I hated seeing the times when my homepage is entirely those posts because I take some time off posting. So now what I do is it puts the most recent automated post on the homepage, and then it skips further automated posts.

Those automated posts are available on that day's archive page.

Share to: | Tags: programming, glowbug

Hot take: Excel should move to formally allowing coding over multiple lines for cell values. Rather than defaulting to everything in a single line.

Share to: | Tags: programming, microsoft excel

Redditor reverse engineers the Slay the Spire mapmaking algorithm

For a side project I'm toying with I went looking for this exact thing and am glad to find it. Very fun and interesting stuff.

Share to: | Tags: programming, slay the spire

"How God plays chess"

An interesting article which delves into the history of endgame tables (where computers have calculated every possible position for a defined number of pieces.) The article shares some interesting anecdotes from the origins of ending tables, as well as a parable (I've copied the start of it below.)

Featuring prominently, and the storyteller of the below parable is Ken Thompson. He isn't a name many will be familiar with, but he was working in Bell labs on things like the C programming language and UNIX.

He created the first endgame table for King-Queen vs King-Rook, which was a monumental thing, something which had never been done before. And the insights gained, and the understanding of what it would take to solve chess, are a fascinating read.

One day World Champion Garry Kasparov, who towers above all his rivals, reached an Elo of 3000. When the rating list was released the heavens over Baku opened and an Angel of the Lord descended. He approached Garry and said: “For what you have achieved you are invited to play a game of chess against God.”

Garry was overwhelmed. He dressed into his finest and got onto the golden escalator that transported him to heaven. There the Angel led him into a small room where God was sitting, drinking coffee and looking at a computer screen. Garry was somewhat surprised that He was wearing jeans and a t-shirt, and had a fairly unkempt white beard. He bowed deeply and said:

“Oh Almighty Lord, Creator of the Universe…”

“Just call me God,” God interrupted. “Or G, which is what most of my friends call me.”

“Okay, God, it is a great privilege for me to stand in your presence and to actually play a game of chess against you. Of course I have absolutely no expectation of winning. I assume you play a perfect game!?”

“Yes,” replied God, “I have done the 32-piece endgame.”

“Ahh,” said Garry, “Of course that is trivially easy for you.”

“No, no,” said God, “it was really tough. More than 10^35 legal positions — it took the matter from a good-sized planet to store. But let us play. You can have white.”

[...]

Share to: | Tags: chess, programming, bell labs, unix

Cry Uncle and Loose the Dogs of War

Had to cry uncle and give up on solving part 2 of Day 5 for Advent Of Code. I tried to solve it with a more elegant way and then when I couldn't figure that out, I tried to brute force it and couldn't get there. Unfortunately I need to cook dinner and do other things before tonight's new puzzle.

I'll go looking at other peoples' solutions to see how they did it after dinner. Bummed to already hit one I couldn't solve, but it's a reminder there's always more to learn.

Share to: | Tags: programming

Advent of Code - Day 4 & 5

I forgot to make a post after Day 4, but I solved it after a few headaches. Day 5 is, as of this posting, half way complete. I got a late start and forced myself to stop at 12:30am to go to sleep since I have work today. I am confident I can complete it after work before starting Day 6. I may try to make tonight a "as fast as I can" finish just to see how I do. Which means starting at 9pm on the dot and going at it. I have no illusions I will remain out of the top 100, but I am hoping to get in the first 2,500 to finish it.

We'll see. If not tonight, I am determined for one of these days to try and do it "competitively.

Share to: | Tags: programming, advent of code

Advent of Code - Day 3: Mull It Over

Part 1 was very straight forward with regex as the key to solving it. Part 2 took me a bit longer. I had watched a video of another coder solving a previous day's challenge and they dutifully coded and tested the examples in each day's problem. Something I usually skipped over. Today I was determined to hold to them. It served me well on the first part, but the 2nd part contains an element of it which the test data doesn't catch for you and it took me a while to fix it.

I ended up using part of the solution from another poster's code. I had a non-regex concept for how to do it, but they showed me how to integrate it as part of the regex. However, the pitfall caught me still.

The core issue is that the "state" of whether to process the inputs carries over across lines of text from the input. This isn't something the test data covers (though the problem makes plain how it should work.) So even though my testing implementation worked, it fell down on the larger dataset.

I figured it out though.

Share to: | Tags: programming, advent of code

Advent of Code - Day 2: Red-Nosed Reports

Took me a little bit longer on this one. First wrong submission for part 1 was because I forgot the rules regarding the difference allowed between numbers in the series. Then I had to do a fair bit of bug fixing before landing on the correct second guess. Part 2 is, I am sure, an inelegant solution where I brute forced the failing lines. I am certain there is a more elegant solution for it. But, in the end, I got both answers.

Share to: | Tags: programming, advent of code

Advent of Code - Day 1: Historian Hysteria

I opted to use PHP as it is what I know best, and I knew the functions it had would be well suited to this problem suite.

My notes after completing today's challenge:

Nailed the first part on the first run. The second one had two issues which I had to correct after 1 incorrect submission. First, I only skimmed the directions (shame on me) and I assumed that they wanted me to only compare unique numbers in the left column. Second was a bug on my part of not trimming off the new line when reading in from the text file.

Share to: | Tags: advent of code, programming

A delightful journey in programming

I am reminded what a giant nerd I am since I watched this while working on other very nerdy things.

Share to: | Tags: python, programming

Glowbug Embeds

So one of the powers of my own blog engine is that I've done a lot of automation that I call 'embeds.' This is code that allows inputting a URL or a code string and having it turned into more robust HTML. This is things like YouTube videos ending up on page, as well as when you see my movie poster or book blocks.

But, today I added a few things for functionality.

There are a lot more potential embed codes via using iframely, but I don't know if I'll ever use them. We'll see.

Share to: | Tags: programming, glowbug

Friday Glowbug Programming

I've had a lovely week off of work, but I'll head back to it on Monday. As part of this week I've blogged and read a fair bit, and as part of blogging, I've coded a fair bit. Again, primarily behind the scenes code, which is some of my favorite stuff as it's the most "hone the tool" hobbit software work for something like Glowbug.

I don't publish this CMS, it's just for me. So I get to appreciate and use it. No performance, just utility. Am I going to win any coding awards for it? Never. Does my github commit streak matter? Not in the least. It's all just for me.

Today's work:

  1. Fix an admin search bug.
  2. Implement pagination on a few pages and write a generic pagination function to reuse.
  3. Fix my 'images' admin page, which now needs to support the sporadic audio files I upload.
  4. Add cleanup functions for getting rid of unused data and files which might be leftover.
  5. Improve efficiency of an admin page which took 12+ seconds to load to be sub 1 second.
  6. Fixed an issue with the link suffixes on the website.
Share to: | Tags: glowbug, programming

Trick.is, my Linktree

A quick project this evening. I picked up the domain a few months ago, finally set it up as a quick an easy link directory style page.

Share to: | Tags: programming

LIMTI

Last night I was able to finally fix my admin UI search functionality. It had been broken for a while. And the answer for why it was broken was disappointingly stupid. I had typoed the MySQL query, writing 'LIMTI' rather than 'LIMIT."

But its fixed now and my life is measurably better. While writing yesterday's post about adulting, I used it to search my original Anthony Bourdain post and replace some now-missing embedded tweets which shared a nice story about a person's meeting of Bourdain. I ended up going to the Internet Archive and snagging screenshots of the tweets to embed in the post.

Share to: | Tags: glowbug, programming, mysql, anthony bourdain

Behind the ATprotocol design

(I'm still working on properly generating Bluesky embeds automatically, so I'm just linking to it and posting a screenshot for now.)

This thread was an interesting look at some of the thinking that lead to the ATprotocol (the underlying system for Bluesky) decisions.

Share to: | Tags: rss, bluesky, programming

Podcast Middleman Dev

Hammered the majority of the podcast middleman out this morning thanks to Python. A few things still to fix (like the fact The Daily has a 12.5 meg RSS file and I am not looking to archive their entire backlog) but the core functionality is there and it's just about trimming off what I don't locally archive, etc.

Share to: | Tags: programming, python, project

Fixed a bug in the Glowbug admin UI, 115 days after I put it into my tracker. Clap please.

Share to: | Tags: programming, glowbug