⇚ Go Back

Other Code

Too long, didn't read version of this page:

This page will be something of a living document. Naturally I'm making more and more code, so it'll be updated as-needed. These are largely programs that I either make for fun or for simple projects. Quite a few of my scripts utilize the fantastic dmenu utility. They often end up being one-liner scripts that read in a file that I usually store in .config, then do something based on the output. As an example, here's an example one-liner script that I have for launching games: setsid $(grep -v "#" -h ~/.config/games | dmenu -i -l 20 | cut -d"@" -f1) .

Most of what I've written for myself are POSIX-compliant shell scripts. I have a few choice ones mirrored here: Click me! I have all the scripts commented but I'll give a bit more of a description here. backMeUp was the result of my lack of satisfaction with timeshift (a GUI backup utility) and its less portable nature. Rsync is one of my favorite utilities to manage the large amount of data I work with on a weekly basis. I know how to use rsync, and honestly, Timeshift is just a wrapper on top of rsync, so I might as well bypass it. As it works right now, it makes one backup, but it can easily be returned to a state of two daily and one weekly backups.

Dmenuunicode is a reimplementation of another script of the same name, but I wanted to expand its functionality. Most of my work was adding in another layer of menu on top of the existing script. Dmenuyt was part of my endeavor to get away from using the Youtube site itself. It's not quite as fast as other solutions such as a more rigorous solution such as youtube-viewer, but it is completely independent of Perl at least. Plus, the Perl shell is rather annoying, and doesn't allow the cursor to move. Nonetheless, it still works just fine.

sha256cp is one of my most used scripts, as is sha256ls. I don't have a homogenous series of disks, so a RAID array wouldn't be that practical. rsync and this utility are the ones that I use to ensure data integrity as they're copied between disks. The final noteworthy script in my opinion is the Proton executable. This is a wrapper script to run Valve's gaming-focused distribution of WINE known as Proton without having to have Steam launched. I always had trouble adding in non-Steam games to Steam, so I use this script to run them. As well, WINE is a rather bulky package, so in partitions with a low disk space, it can be prudent to have the distribution (as well as the .wine directory) symbolically linked on a different disk.

I'm a really big fan of the programs developed by Suckless. In short, they are very minimalist programs which are designed to have the user add in the functionality they want to based on pre-made package and the user's C knowledge. I've uploaded my builds of various suckless packages here: Click me! The only package I have that I did not patch from the ground up myself is the package for the suckless terminal (st). All the rest I patched from the ground up, troubleshooted the patches, and in more than a few cases, added in my own functionalies in all of them. This could be as simple as changing a shortcut or two, or as complex as a rewriting of a particular subsystem. I'll detail them in the following paragraphs.

I'll start with st, the suckless terminal. This is the one I've done the least with, but I still modified a few lines here and there. I used the code that Luke Smith uploaded, but I did as well modify the openurlcmd function to work with the $BROWSER shell variable. As well, I seem to remember modifying a few lines in st.c, but I don't remember exactly what I did. For the most part it worked perfectly fine; I just needed to change a few lines to work more in line with what I wanted. Slstatus (a simple text statusbar) and slock (a simple screen locker) similarly needed very little patching. A few patches were added, but not much troubleshooting was needed. Given how simple they are, it's not too surprising that not much patching was necessary. Dmenu, while being one of my most used programs, really didn't need much in the way of patching. Most of what I've done is added line/item numbers as well as a fuzzy search.

Dwm is my primary window manager, and consequently, is what I spend nearly all of my GUI life in. I have done a substantial amount of patching to dwm. I never could get launching terminal programs directly from dwm to work, so I had to write simple helper scripts and place them in /usr/bin. As for the functionality I implemented and troubleshot, I've implemented window resizing and moving, gap resizing, multiple layouts, quick shutdown/restart shortcuts, a system tray, and likely other functionality that I do not remember right away. This is the one that I've done the most modification and troubleshooting on, which does make sense, considering it's the program I interact with the most. Window transparency is available as a patch, but I feel it's better to rely on external compositors such as xcompmgr (the one I use) or Compiz.

My main browser I use nowadays is surf in tandem with tabbed. Tabbed is a utility that allows for any X program to be ran in a tab. Surf itself is just a very simple frontend for the webkit2gtk web engine. It's not 100% compatible with HTML5, which is why I also rely on other browsers for sites that won't work in surf. I'm not particularly picky, as I am willing to use anything that's open source (Brave, Ungoogled Chromium, Firefox, Iceweasel, etc). I have done a substantial amount of rewriting of this, as well as some rewriting of dwm in order to get this to work. For non-patch related code writing, I have done the most on this.

First implemented was the search bar, which I applied a patch in a very vim-like way by binding to /. Initially it was a reimplementation of the URL bar but I simplified the script down substantially to make it run faster. Bookmarks were another function that I heavily rewrote. I wasn't much a fan of the way the bookmarks patch handled bookmarking, so I rewrote it to be much simpler, as well as being much more logical to read. As well, I implemented a simple command to edit bookmarks on-the-fly by opening the bookmarks.tmp text file inside $EDITOR.

Another part of the bookmarking functionality that needed rewritten was the way surf actually obtained the URL to bookmark. It's based off of the __SURF_URI atom obtained from xprop. In more simple terms, an atom is a simple variable associated with a window, and __SURF_URI is the current URL. These variables are obtained by running xprop and giving it a particular window. The problem I had was that it was always lagging behind one page; whenever I went to bookmark, it always bookmarked the previous page. I found eventually that this was more to do with dwm than surf, and I had to remove some seemingly non-sensical code regarding when the atoms of a window in dwm.c are updated. I haven't encountered any instability since then, and my bookmarking functionality works perfectly.

Another bit of functionality I overhauled was the copying and pasting functionality. Clipboards can be a bit of an arduous thing in Linux, with many programs potentially using different clipboards. Surf relies on the gtk clipboard by default, which means that if I wanted to paste-and-follow a URL from the system clipboard, I'd have to find a text field, paste into that, copy it back up, then paste-and-follow. I rewrote those functions to be reliant on the system clipboard instead of the GTK clipboard. These were the biggest portions I rewrote in the program, and they make using it for my use case much, much easier. It is worth noting that unless otherwise specified, my rewrites were predominately done in the respective config.h files in each directory. Suckless programs compile their configurations into the binary itself.

This page has already gone long enough, so I think I'll wrap it up here. I also have experience with C# and C++ by virtue of my university focusing on C++, and my usage of Visual C# and Unity to build GUI applications. These were largely for classes, and while I haven't done much with C# outside of academic settings, I do know how to use it. I instead prefer more portable solutions such as GTK+ and Qt for writing GUI applications. I have done database management with a Java frontend, which naturally necessitates a knowledge of SQL. As well, I have a decent enough knowledge of SQL injections to be able to know how to both properly set up a database server and to also debug potential vulnerabilities. On top of knowing Qt, I also know how to write programs oriented around machine learning. I have written tasks using both traditional machine learning approaches as well as deep learning/neural network approaches. If you need something written, I've got all my bases covered. I can write it!