String Hashtable in C



Introduction We have this amazing generic hashtable and we can put pretty much anything we want into it, but it has a few flaws. It uses void pointers and has a pretty verbose setup with that callback struct. If you’re using the same types over and... Continue reading

Generic Hashtable in C



Introduction So, C doesn’t have a native hashtable object but that’s not a problem because we can use one one someone else wrote. Lack of a robust standard library is probably the biggest impoundments of working with C. It’s a real shame C doesn’t natively support hashtables because they... Continue reading

Formatting Strings for Logging



Introduction I’ve been working on a project, and I needed to add logging to the app. I wanted a log formatting function that can take a prefix and a format string (think a sprintf-type format string but safer). This function needs to be more than just an... Continue reading

Validating Constant Time String Comparison In C



Introduction Awhile back I wrote a constant time string comparison function. I briefly mentioned how the compiler can optimize away some of what makes the function constant time. Specifically, the k++ counter used to balance the increment when the forward scan of s2 stops.... Continue reading

Python Http Server



Introduction Quite often I find that I need to serve some files for viewing in a web browser. Most recently, I needed to do this with an in progress OpenAPI document as rendered by ReDoc. All I needed was something that can serve static files. I really didn’t... Continue reading

Python Self Signed Cert Gen



Introduction Sometimes I need to write a simple network server to emulate an application I’m integrating with. Typically, this is ends up being a throw away Python script that allows me to easily inspect at a request and returns a basic response. It’s handy to verify what I’m sending... Continue reading

Python Binary to C Header



Introduction Once again I needed to embed some text files into a C application. The right way to do this is turn the data into a byte array and compile it in. At least it’s the most portable way because some compilers have string length limitations. xxd... Continue reading

Making MiniZip Easier to Use



Introduction Zip files are one of the most popular archive formats out there, and there are a lot of things you can do with them. While working with the ePub ebook format I spent a lot of time working with zip files. Thankfully, the standards committee for ePub used... Continue reading

Read Write File C Helpers



Introduction Reading and writing files in C isn’t as difficult as it sounds. A few simple loops are all you really need. That said, it’s nice to have a few helper functions ready to drop into a project. Before we write anything we need to think about the choice... Continue reading

Recursive Create Directory in C Revisited



Awhile back I wrote a function to recursively create directories in C. It used a string builder to split the parts and rebuild the path. The way mkdir works is by taking a single directory that does not exist and creates it. If there are multiple... Continue reading

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... 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

ARC ActiveX Apple B&N Base64 C lang COM DLL DNS Device Docker FLAC FT GUI GeR2 JNI Javascript Linux Lua Lua C API Mac N770 OS X Off Road OpenSSL REST API STR Shocks Sigil Suspension TLS TOC TRD TRD Pro TRD Sport Tacoma Toyota Vaultwarden Windows WireGuard about ad blocking algorithm amazon analysis android apnx app arch linux automotive backup bash batteries bitwarden book bookeen bookview bug bzr c++ calibre car cats certbot compression configuration container conversion copyright copyright infringement cover cso cybook data structure decoding decompression development device interfaces direction distros dmca donations downloader drm dropbox duplicity eReader ebook ebooks editor electronics encoding epub fb2 files focus st formats formatting future gadgets generic type get books git github gnome google gpl guide hardening headless heuristic hex hg htmlz iOS ideas image intel internationalization interop java jekyll json kernel kindle kwin language law lebookread legal library linode maintenance maintenance programming malware blocking markdown memory mobi mp3 music nginx nook objective-c opds openid opensearch opf packages palmdoc password manager pcre pdb pdf pgm plans play store plucker plugin pml pmlz pocket pro podcast podman ppa print project management prs prs300 prs505 prs700 prs900 pyqt python qt rb regex release restic reveiw reverse engineer reverse proxy review rtf s2n scm screen saver screenshot script search security server sort sorting source code specification spell check spideroak ssl store sync t2b t4b tcr textile thanks thread threading thumbnail tips translations truck txt txtz ubuntu unbound usb vault video vpn vps widget wordpress wpmu x11 xlib xorg xxd yubikey zip zsh ztxt