Unsigned Count Down



Introduction Something that comes up surprisingly often is traversing an array backwards. Maybe you’re emptying a queue. How about my personal favorite, reversing the order of elements. Counting in a for loop is so common you just don’t think about it. But counting backwards can lead to issues... Continue reading

Lua For Loop Scope



Introduction One odd thing about Lua when compared to other programming languages is, everything is global by default. Take this for example: function func_a() q_var = 7 end func_a() print(q_var) Once... Continue reading

Thread Pool in C



Introduction When I was writing Poddown I needed a thread pool and I needed one that is cross platform. Since it’s a lightweight app I didn’t want to include a big third party threading library. So I wrote my own. Why a Thread Pool Creating threads can... Continue reading

Cross Platform Thread Wrapper



Introduction There are many open source applications which use threading and are limited to either *nix or Windows because Windows handles threading a bit differently than *nix. I develop on macOS so pthreads is my go to but using it effectively locks me out of Windows because Windows doesn’t... Continue reading

Looping Through Bytes to Check for Bits



Checking for bits in 1 byte is easy. Checking in 2 bytes is also easy. Checking an odd number of bits in a variable number bytes isn’t so easy. The hard part is dealing with the boundary between bytes where we need to move from one to the next. Lets... Continue reading

Lua-stater a Lua State Machine



At work I use state machines extensively in one of our applications. I’ve found state machines to be very powerful when working with messaging. They are especially useful when combined with event based processing, where an event comes in, the current state can process and move to the next state... Continue reading

Lua Ternary



Lua doesn’t have true ternary operator but there is a way to mimic the behavior. This is one of the biggest issues people who aren’t used to Lua have when reading Lua code. For the most part Lua is simple and straight forward to understand. Assuming a blocky and easy... Continue reading

Lua Case Insenstive Table



Introduction This is something I wrote for PenLight but alas it wasn’t merged. The problem they had is the use if __pairs which isn’t present in Lua 5.1. The project wants to maintain compatibility with 5.1 and LuaJIT which targes 5.1. All the Lua projects I deal... Continue reading

BPF Skid Plate



Introduction I decided to enhance the look of my Tacoma by buying a skid plate. While I do want something that will work as a skid plate, I didn’t want a lump of grey metal. The TRD Pro skid looks good but I’m not a big fan of trying... Continue reading

Moving From WordPress to Jekyll



Introduction When I first started this blog back in 2008 I hosted it myself using an Arch Linux instance with Linode. For the blogging platform I used WordPress MU because it was, and still is, one of the most popular blogging platforms. At that time the MU version... Continue reading

WordPress Gutenberg Editor is Garbage if You Need to Post Code



Introduction Recently WordPress.com (and WordPress in general) has started pushing the new Gutenberg editor. It uses a block based model instead of a traditional document centric one. This I don’t like but I also don’t mind. It’s a different way of composing and I can see the benefit. However,... Continue reading

Mergesort in C



Introduction Quicksort is most people’s go to sort function and that’s not a bad thing because it’s a really good general purpose sorting algorithm. A good implementation is really fast and, being an in place algorithm, it uses very little memory. The big drawback of Quicksort is that... Continue reading

General Comparison Functions in C



Introduction qsort, heapsort, mergesort, bsearch, and many more search and sort functions all take a compar argument to determine the sorting order of elements in an array. The compar function takes the form int (*compar)(const void *, const void *). The <code... Continue reading

Softening the Tacoma TRD Sport Ride



Introduction The TRD Sport is known to have the hardest ride of any of the Tacoma trims. You’d except this from the Sport model with a sport tuned suspension. Out of all the trims the Sport has the least body roll and is the best handling Tacoma. As with... Continue reading

KDocker 5.2 Released



This isn’t a huge release but includes a very nice new feature. Lock to desktop! This will force the an application to always open on same desktop (when using multiple desktop workspaces) that it was originally docked on. The default behavior is to still to open on the current desktop.... Continue reading