macOS USB Enumeration in C

Introduction Apple provides documentation for using IOKit, but it’s not very clear how to do a number of things. Descriptions and relationships of functions often isn’t clear. While there are examples, they tend to be lacking. The generic types IOKit uses doesn’t help either because you could have multiple... Continue reading

macOS IOHIDManager Permission Issue

Introduction The other day I was working with a USB-HID device and I thought my machine was starting to act funny. I could use the device no problem in a Windows VM but whenever my application tried to use the device, it was unable to open it. At this... Continue reading

C if Statement Evaluation

Introduction One of the bad things that the C language allows is setting variables and calling functions directly in an if statement. This should be avoided due to how the statement can exit early stopping some of the logic from happening. That said, this can also be abused... Continue reading

Full Text Search with Jekyll

Introduction When I switched from WordPress to Jekyll I gave up searching posts. I knew this was a limitation of running a static site and I didn’t think it would be too big a deal. After a year I’ve found I actually look up some old reference posts... Continue reading

Making and Using C plugins

Introduction No app is ever complete and you’ll never get to the point where users stop asking for new features. Sometimes those feature are low priorities so you’ll never get to them or they’re inane and you’ll never touch the idea with a 10 foot pole. This happened to... Continue reading

String List in C

Introduction Currently we have a generic list container which uses void pointers to allow anything to be stored. Previously, we created a type safe string hashtable wrapping the generic hashtable. We want to do the same thing for our list and so now we’re going to... Continue reading

Generic List in C

Introduction Lists (dynamic arrays) are yet another super useful data structure that C just doesn’t have. C arrays are great for when you can get away with a fixed size but not so fun if you need to dynamically expand because you don’t know quite how many elements you’ll... Continue reading

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 over... 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 <code... 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. The <code... 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 -i... 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

ARC ActiveX Apple B&N Base64 C lang COM DLL Device FLAC FT GUI GeR2 JNI Javascript Linux Lua Lua C API Mac N770 OS X Off Road OpenSSL Python REST API STR Shocks Sigil Suspension TOC TRD TRD Pro TRD Sport Tacoma Toyota Windows about algorithm amazon analysis android apnx app arch linux automotive backup bash batteries book bookeen bookview bug bzr c++ calibre car cats configuration container conversion copyright copyright infringement cover cybook data structure decoding 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 markdown memory mobi mp3 music nginx nook objective-c opds openid opensearch opf packages palmdoc pcre pdb pdf pgm plans play store plucker plugin pml pmlz pocket pro podcast ppa print project management prs prs300 prs505 prs700 prs900 pyqt python qt rb regex release reveiw reverse engineer 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 usb video widget wordpress wpmu x11 xlib xorg xxd yubikey zip ztxt