This is where I talk about whatever's on my mind. Mostly tech stuff but no promises.
When I got my first Raspberry Pi (a 2 model B if I'm remembering correctly) I had some fun playing with it for about a week before the novelty sort of wore off a bit. Instead I found it to be a really handy dedicated plug and play emulator. This was also pretty fun for a while until I realised just using my PC was much less hastle. Thats when I considered putting the novelty (and convenience) factor back into my Pi by embedding it directly in the controller.
This is also the first time I have played with electronics in any meaningful way, so my ulterior motive here was to teach myself souldering and basic electronics concepts.
After starting, I found similar projects by Anthony Caccese and Casperdroid5 which gave me some more ideas about placement of things and wiring.
The whole point of doing this is to make a way to play old games wherever a display (and USB port) are available while also giving an old controller new life. I almost immediatley thought of the SNES controller, and realized it was ideal for this project. The Pi Zero W fits inside snugly and struggles with much past the 16 bit era regardless. Plus, I have the most nostaliga for SNES games.
What I Used
Raspberry Pi Zero W
The heart of the system is, of course, the Pi itself. I decided not to cheap out and get the earlier Pi Zero (sans-W) so that I could easily update metadata, SSH into it and add a keyboard without having to open the whole thing each time.
Super Famicom Controller (SHVC-005)
And of course to make it look nice on my desk I decided to use an original Super Famicom Controller I found somwhere on eBay. These go for pretty cheap (depending on how beat up they are) but be aware we will be doing some back alley surgery on it.
Micro USB Breakout Board
Adding a micro USB port seperate to the one already on the Pi means that I can have it near the edge of the case. This means that I can easily plug and unplug a USB power cable from the system while also not having any cables coming out from the bottom (eww).
I added a long tactile button that protrudes from inside the case. Using a small Python script, this powers off the Pi safely.
How I did It
Before following this blindly, understand that I am a complete amature with electronics - im much more comfy with the software side of thigs. Keeping this in mind, please read the "What I Should Have Done Different" first.
Luckily for us, RetroPie includes a whole bunch of drivers that allow old controllers to be used with it meaning we just have to wire everything up properly. Firstly, the original cable has to be removed from the SNES board.
Desouldering the cable looks messy but as long as youre careful it will work just fine. After this, we need to connect the USB breakout to the test pads on the Pi. Make sure youre smart and use enough wire for it to reach where you want it to sit (I had to resoulder what I have here, oops).
Keep in mind that connecting the breakout to the test pads does not necessarily "add" another USB port. Instead it means if you plug a cable into the brekout it would be the same as plugging it into the original port. Youll then want to connect where the original SNES cable used to be to the correct GPIO ports on the Pi (see the wiring diagram).
The final piece I included was the power button. I also wired this to the GPIO ports on the Pi and wrote a very basic Python script that checks if the pin recieves a signal and shuts down when it does.
To make sure all the stuff we need fits in the controller, a few modifications are needed. Firstly, some pegs and supports in the controller need to be cut out to fit the Pi inside - its best to fit the system in as best you can and only remove what you need. Holes also need to be drilled/cut for the button and ports. I used dremel for this, although my cuts are pretty messy.
The Pi is running RetroPie, a handy Debian-based distro with drivers for controllers and a load of emulators built in. Other than loading the games (instructions for all this are on the RetroPie Website
so I won't go into detail) I had to make sure it recognised the inputs from the controller. To do this I followed a handy guide by Blugoo
. Just make sure that you choose "2 snes controllers" instead of an n64 controller.
And thats pretty much it! Im fairly happy with how it ended up, although there are a few things I would change for next time to make it nicer.
What I Should Have Done Differently
While I'm happy with what I ended up with there are a few things I could change or do differently to make it a little better.
This is the first time I've ever used Dremel to cut holes and to be honest its very rough. I'd like to practice some more before attempting this again to make sure the holes are even and fit the wires snugly.
Putting the button on the side of the controller was really dumb in retrospect. Its easy to accidentally press when playing and would make much more sense on the bottom of the controller.
I thought I could cheap out and center the HDMI port of the Pi in the controller to use it directly. In actuality this made it difficult to plug and unplug the HDMI and meant I had to cut more stuff out of the case than I could have using a HDMI breakout.
I could have used a rechargable battery, similar to Anthony Caccese
. This would make it easier to move around however the device will be wired via HDMI anyway. Its more costly than it's worth in my opinion.
I was close to including an LED indicator somewhere on the system for power status and I still don't know if I should have or not. It might be handy but you can tell if the Pi is on or not without it.
Sat, 01 Feb 2020 17:26:52
From Arch to Void to Arch again
Void Linux is a fantastic distribution which I would recommend to almost anyone interested in software minimalism or to reinvigorate their love for Linux. By doing away with monolithic packages like systemd by default and using clever ways to package software with xbps-src, Void feels like a breath of fresh air. I would still be using it today if it was not for some mostly unavoidable problems. By being as innovative and different as it is, Void has understandably kept a relatively small userbase even compared to similar "minimal/diy" distros like Gentoo, Debian, and of course Arch.
This has negatives and suprising positives from a software development perspective. By having a relative lack of support from many smaller packages, the user is presented with multiple ways to contribute to projects by developing Void support. This is great for someone who sometimes has trouble finding a good reason to write code and has an interesting effect of making them more mindful of broadening support for more distros.
The negatives, however, are a lot more obvious. A lot of time for me at least has been spent having to download packages from source only to find that they are totally incompatible (reliance on systemd/packages preinstalled on other distros/someting else). While I could spend a lot of time debugging or patching these packages, it tends to get in the way of making stuff I actually want to make.
I am glad I stuck with Void as long as I did, and I have learned more from it than any other distro I have seriously tried. Maybe sometime in the future I'll want to experience that breath of fresh air again, but for now its time to go back to something stable.
Sun, 26 Jan 2020 17:48:44
Automate Linux and Android
First of all, I should probably explain myself as I haven't posted really since I started my site. To be honest I have been very busy starting a new job, keeping up with uni, and developing some stuff when I have the chance. On top of this, I've been trying to learn how I 'should be' doing things by reading a few C# and C books (which I will probably talk about at some point too). So what better way to kick this back off with some tricks to help keep organized when I'm busy?
Chances are you already know there are a number of GUI and cloud-based options for keeping your Android and Linux stuff organized so I will not be covering that. Instead, lets do it the fun way (and actually own our files in the process).
If you really want, you could always use a dedicated server to host files relatively cheaply (with a Pi or an old system) however I personally prefer to sync my files. This means that when a file is updated on one device, it synced to those connected to the same network. For example, if I had a shopping list I made on my phone - I could put it in my Sync folder and it would be available on my computer when I need it. I can then use my computer to edit the file, and changes will effectively be saved on both devices when they sync. The program I like to use is called Syncthing
, which can be downloaded from pretty much any package manager and is also available on Android through F-droid.
. There are a few ways to use Syncthing on Linux including solely through the CLI, in the browser, or by using a GUI application. Personally, I use QSyncthingTray
. This gives you a nice little icon in your tray that you can glance at to make sure everything isn't broken.
One of the most handy TUI applications I use almost daily is Calcurse. This lets you add events and to-do lists to a file using a really quite nice ncurses interface. While this is very handy alone, it would be better if you could get the same events and notes on your phone. Luckily, using Syncthing, there is a neat way to do this. By using
you can create an ics file that a good number of calendar apps on android use. The app I'm using currently is Simple Calendar
(actually I'll recommend the entirety of Tibor's 'Simple' apps) which just so happens to have a function to import and export ics files. So, using syncthing, we can export the calendar to the sync directory (such as by running
calcurse --export /home/$USER/Sync/calendar.ics
where it will be available to import through the app. I'm still trying to find a way to run the import function automatically, however I havent found a way to do that as of yet - however it is as easy as tapping the import button whenever you want to refresh the calendar. This works both ways too, you can export the calendar to the sync directory on your phone where you can use a command to import the updated calendar back to calcurse:
calcuse --import ~/Sync/calendar.ics
. To make things easy, I like to leave this command somewhere in my .xinitrc to import the calendar every time I start dwm.
As you can probably guess, calendar files aren't the only thing that can be synced. Other ideas include sharing notes files, pictures, and password files that can be used in keepass.
Fri, 06 Dec 2019 20:50:19
Stuff I Use/My Workflow
Today I'm going to talk about the programs/scripts/whatever I use and have "effectively used my time" customizing. You might notice some common themes here, mostly that almost all of these tools are CLI/TUI based. While I could go into deatail about why I think this is a good idea, thats boring so I'll just put it down to personal preference. In a sentence, my setup is designed so that I can be as lazy as possible, using the fewest number of keystrokes and clicks to get the job done. Oh, and if you want to see some of my customizations and other things feel free to take a peek at my dotfiles.
I've been distro-hopping ever since I started using Linux and Void might be where I settle for good. This is for mostly feel-good reasons, but also because of some of the less common methods/utilities it uses compared to something like Arch or Debian. The most obsessed over is it's use of the runit init system as opposed to systemd. I can't say I have really much contempt for systemd, especially compared to some of the more "hardcore" unix guys but I do appreciate it's simplicity and focus on being solely an init system instead of a horde of hundreds of APIs and functions. It's also easier to use. It relies on the 'sv' command to run and stop processes and symlinking services to a directory to run them on boot. That's it! This is better explained in this blog post
from Mike Perham.
Something that's more appealing to me, however, is how it offers alternatives to other pieces of GNU software. The most exciting of these, to me at least, is that you can choose to use either a glibc or musl variant. Basically, this is the most minimal and efficient distro I have come across personally that doesnt require you to be a masochist in the way Gentoo or LFS would.
dwm is a window manager developed by the guys at suckless. I prefer this over most other /r/unixporn staples due to it using stacking, not containers. This means that when you open a window with dwm, it moves around the other stuff to the right side of the screen so you don't have to do that yourself. If that makes you programs look weird, you can also use the floating mode that lets you drag around and resize windows in a, well, Windows-like way. While it's community is tiny compared to that of i3 or desktop environments like KDE or Gnome, there are still a whole bunch
of patches, scripts, and tweaks that let you turn dwm into basically whatever you want. Oh, and for a nice statusbar I've heard this script
is nice ;)
Fish is a godsend for lazy people like myself, but is far from perfect. It comes with some very nifty features, such as syntax highlighting and autocompletion built in and enabled by default. This means navigating directories and executing commands is faster and prettier.
This is a pretty love-hate relationship though as for whatever reason, Fish is not POSIX compliant at all and means that it cant run the vast majority of scripts it's handed. Luckily, there are alternatives like zsh-autocomplete and zsh-syntax-highlighting that emulate the key selling points of Fish so I'll probably move there in the future.
st is a terminal emulator that, out of the box, is a pain to use. It's missing key features like scrolling, Xresources support, and copying text. Don't leave just yet though, as like dwm and other suckless utilities, there is a dedicated community that provides patches to address features found in terminals like xterm and urxvt. This leaves you with a terminal that has only the features you want, and is extremely light. In particular, I'd recommend the clipboard
, and scrollbacl
patches as a good starting point.
This is a fork of the superior text editor Vim. This fork strips out all the garbage collected over the decades of Vim development and adds some sexy features like a built in terminal emulator (before Vim copied that), sane defaults (syntax highlighting, auto-indenting, etc.), and the support for scripting with Lua. I don't actually care about most of that to be honest but it looks nice and it requires a hell of a lot less setup.
NeoMutt and Friends
For email stuff I use a combination of NeoMutt, isync, and notmuch. This was horrid to setup but in the end means I can check my email, open links, and sync mailboxes efficiently.
Most of the time, just using cd and ls is enough to get around directories but nnn makes it so much easier if you want to do anything more complex than going to your home directory.
Initially I wanted to use MPD for music stuff but it doesn't play nice with external partitions so I was reccomended Cmus. This is a TUI, which makes more sense anyway as it lets you navigate artists, albums, and tracks visually instead of having to memorize all those things.
I use Firefox along with (a slightly more leniant) ghacks-user.js
for shitposting. I pair this with vim vixen for glorious vi bindings and ublock-origin.
I recently found out about Newsboat, a super simple RSS reader. This is especially handy for me when paired with youtube-dl to list uploads from followed channels without having to deal with Googles nasty UI and ads. This means that I can just press the 'o' key over a video and it will open with MPD. Couldn't be simpler.
So That's It
I'm glossing over some minor stuff that I don't think is really worth talking about but hopefully you've found some cool things you can use to allow yourself to be as lazy as I am.
Mon, 10 Jun 2019 14:28:15
Welcome to my site!
So, I think I have my site just about where I want it for the time being and I need to test my RSS feed so here's my first post I guess.
This has been something I have been putting off for a while, as my site was initially just going to be sort of an online CV - but that's boring and I wanted to get better at HTML/CSS anyway so I made this blog page too. At the moment, I'm hosting this website through GitHub pages, which has been pretty handy to be fair as I can simply modify my files and push them when they're not totally broken.
I ended up using a neat little script I found to push posts to my HTML and RSS files directly. This means I don't need to mess around with something like a Wordpress or Tumblr blog, and can make things look pretty using my CSS file.
There isn't really going to be a schedule to this per-se, and I'm just going to post whenever I can think of something worth talking about, but I plan to make a post talking about my workflow and how I approach programming sometime soon.
Sat, 01 Jun 2019 18:20:41