Some Recent Bash Scripting Fun

I've been writing more and more bash scripts recently (GitHub repo). It started when I was playing around with a script called tmux-sessionizer from The Primeagen, that uses fzf to search for directories in a preset location, and then open the selected directory in a tmux session.

The first three I came up with were all mainly some sort of selector-style tools powered by fzf:

(they may seem like odd names, but I wanted to be able to use these scripts really quickly)

  • tg (right-top)- a customed version of tmux-sessionizer that lets you quickly fuzzy find a directory and then attach/reattach to a tmux session with it.
  • ala (left)- fuzzy finder for alacritty (my terminal choice) themes, which is then applied on selection.
  • fd (right-bottom) - fuzzy finder that searches the current directory for any subdirectories with a max depth of 3. And then changes into the selected directory.

I also made another one that replaces my existing alias for quickly committing and pushing my local changes with Git, and makes the flow a bit more interactive.

Previously I had an alias gacp, which basically meant (to me) "git add commit push", and did the following:

git add --all
git commit -m "$input"
git push

And I'd use it like this:

gacp "my wonderful code change"

But now with my (aptly) named tool, gt, I just need to type those two letters, and it then lets me quickly run through the process of pushing my latest changes.

First of all, it asks if I want to stage all my current changes (defaults to yes), then it asks what type of commit it is (using conventional commit style), asks for a commit message, and then if I want to push to my remote repo.

So a pretty simple process, but just a bit faster thanks to this little script.

As you can see, I'm clearly having a bit of fun writing these scripts, so don't be surprised when I start uploading even more.

Although my next script/tool will definitely have to be making blog posts easier to start writing. I have a half-baked bash script that creates a basic template, but I think I want to make one with a bit more power, that can be flexible for multiple types of posts. Let's see.

A CLI Tool to Post to Micro.Blog

I've been working on a small command line tool recently. It's essentially a simple way to write a short post on Micro.blog from the command line, called pst.

It's probably not the typical place people tend to do their microblogging. But I did it for a few reasons:

  1. I live in a terminal when I use a computer, so it's easy for me to quickly write a post, or share a link. I don't always have Micro.blog open.
  2. There's obviously less distractions when you can just post and carry on with whatever you were doing.
  3. It's a simple idea, so it would be perfect to use it as a learning oppurtunity.
  4. I don't get many ideas for small projects like this, so I have to run with them. Otherwise I'd never build anything.

So, now you know the reasons, I'll explain a bit more about pst, how to install it, configure your blog, and also how to use it.

First of all, you can install pst from crates.io or homebrew:

crates.io

cargo install pst

homebrew

brew tap chrishannah/pst
brew install pst

To configure pst, all you need to do is to generate an app token from Micro.blog (find that in your Account settings), and then store that in a JSON file under ~/.config/pst/config.json. The specific format is in the README.

Using pst is pretty simple, you have the pst command, followed by the type (post or draft), and then your content. Examples:

pst draft "don't show this to anyone"

pst post "hello, losers!"

After that, you'll see some handy links in the terminal for where you can view, preview, or edit the post on Micro.blog.

I forgot to also say that it's built with Rust! I'd been wanting to write something in Rust for a while, but it was never the right time, and I also didn't have the correct project. Luckily for me, it's a small project, so I decided to use it to learn some Rust.

Obviously I haven't used it for long (or for much), but I've really enjoyed using the language. And especially for these types of tools, I can see myself using Rust even more in the future. (Especially because I have my Neovim config working perfectly with Rust now.)

Apple vs the World

I can't say I'm completely up to date with Apple's various ongoing issues with various government entities, so I can't exactly offer any well thought out opinions. And I also want to say that I'm not exactly that interested in getting into the weeds of it all.

I'm sure in all cases, Apple are right in some areas, and wrong in others. However, what I'm more intruiged in, is the long-term effect that it will have on Apple as a company, and also on the products it builds.

The changes could be related to hardware, software, how Apple's devices interact with devices of other companies, the restrictions they apply to their stores, or it could even affect the company itself. Either way, I'm sure something will end up changing as a result of these various battles.

I'm no longer a die-hard Apple fan, so I'm not going to get overly caught up on any of the arguments for or against them. But there's a reason people talk about Apple's "walled garden". And rightly or wrongly, it seems that more and more people are starting to want to tear down the wall.

Rethinking Phone Battery Life

When I've pictured my "ideal" phone in the past, I've regularly had long battery life as one of the key features. But I've thought about battery life as something that hasn't improved. Because most people have probably been charging their phone every night for quite some time.

However, you could probably argue that battery life has always been increasing. The problem is, so have our demands.

Sure, more powerful chips require more energy to run. So an iPhone 15 will naturally require more resources than an iPhone 5. At the same time, we also weren't expecting an iPhone 15 to record 4K HDR video without affecting the battery life.

It's probably not a big revelation to many. But it's a perspective that might be worth considering when judging the evolution of technology.

The Rabbit R1

I finally watched the Rabbit R1 announcement video earlier, and while I think it's a really raw product and has a lot to prove, I was definitely wowed by it. Maybe it's the hardware design (which was done in partnership with Teenage Engineering), or the idea that this will actually be able to do things for you, rather than just be another conversational AI. Either way, shortly after watching the video, I decided to pre-order an R1.

The relatively low entry price for the R1 at $199/£160 definitely helped. But I also wanted to put my money where my mouth was. Since products like the Rabbit R1 and others like the Human Ai Pin are examples of the direction that I want technology to move towards.

In my ideal world, technology would be used to help us understand, explore, and experience the world around us. Rather than keep us locked away in digital worlds, cut off from people around us. No matter how "connected" it can make us feel when we've got a screen constantly in front of our face.

I'm hopeful that we're moving in the right direction.

My Relationship With the iPad

I have a weird relationship with my iPad. I can go months without using it all, and then suddenly something switches in me, and I want to use it for everything.

While I'm not trying to blame anyone, I think a lot of this comes from me falling for the "what is a real computer" or the "everyone can work from an iPad" hype that used to be quite common on the internet.

Now I'm not saying either those are objectively true or false, or that I want to try and change anyone else's opinions on the iPad. But whenever I pick up my iPad Pro, without any case or keyboard attached, it feels magical to me. It feels like I'm using a computer from a science fiction show[1].

It's because of that feeling, coupled with the conversations around it having the ability to be your only computer, I start wanting to do more things with it. I attach the Magic Keyboard because then it looks like a laptop, and that's a real computer, so it must mean it becomes better. I also then occasionally connect a mouse, or even play around with the Apple Pencil, because this clearly makes it a more capable computer.

Yet every time, it leads me to getting irritated with the quirks/drawbacks of the iPad and then avoiding it for another month (or few). Instead of just letting the iPad be the magical device that it can be for me.

I need to learn how to just enjoy things for what they are, and not try to dream up weird and wonderful scenarios that add needless complexities and friction in my life.


  1. Don't take this as me thinking the iPad is a perfect computer. But that's not important right now. ↩︎

Artifact is Already Shutting Down

The Artifact team announcing the news via their Medium blog:

We’ve made the decision to wind down operations of the Artifact app. We launched a year ago and since then we’ve been working tirelessly to build a great product. We have built something that a core group of users love, but we have concluded that the market opportunity isn’t big enough to warrant continued investment in this way. It’s easy for startups to ignore this reality, but often making the tough call earlier is better for everyone involved. The biggest opportunity cost is time working on newer, bigger and better things that have the ability to reach many millions of people. I am personally excited to continue building new things, though only time will tell what that might be. We live in an exciting time where artificial intelligence is changing just about everything we touch, and the opportunities for new ideas seem limitless.

On one hand I'm dissapointed that an app that I enjoy to use will soon be no more. On the other hand, it's not really surprising. I found it to be a great way to surface content that I was interested in (although the quality did drop in recent times), however the reading experience in the app wasn't the greatest. Even so, it still made my "Software I’ve Enjoyed in 2023" list last year.

I assume this is the case for other people as well, but at least for myself, I would have used the service a lot more if it had some form of web interface.

Also, isn't it a bit weird that this news was posted on a Medium blog? I can understand wanting it in a more permanent place outside of the actual Artifact app, since that will soon stop working. But Medium? Not their own artifact.news domain, or even just a blogging platform with a better reading experience than something like Medium. Maybe that sort of decision shows why the app was like it was.

My First Project of 2024

It's only been just a week, and I've already "completed" my first project of the year. Well, it's not really completed, but it's functional and it already completely addresses a personal need.

The project is a simple plugin for Neovim that helps me generate the initial frontmatter I need for my blog posts. It's called blogutils.nvim, so you can imagine it may grow in the future. But right now, it has three pieces of functionality:

  • formatTitle - Format specified input as AP Title Case via Text Case CLI.
  • formatSlug - Format specified input as a slug via Text Case CLI.
  • generateFrontMatter - Uses the first line of the current buffer as an input, then generates a title, slug, gets the current date, and adds the relevant frontmatter to the top of the file.

Here's a short video showing me generating the frontmatter from an example title:

I may improve it in the future, but right now that's all I need it for. And with how smoothly the development went, I'm really interested in the idea of making more plugins in the future.

Additionally, the act of learning how to write a Neovim plugin has made me much more comfortable using Neovim generally. It's weird to think that just months ago I could barely even use vim motions.


I've also created a new page for my 2024 projects, which now has just a single entry. I plan on using this page to document the projects I work on (big and small) throughout the year, grouped by week. You can also find in the menu bar the top, titled "2024".

I wanted to group by week because I wanted to visualise my work over the year in more granularity. I just hope I build enough things to make it an interesting list.

My Projects in 2023

I wanted to wrap up 2023 with another post looking back at the projects I worked on over the year, and also have a think about what 2024 could bring.

Text Shot

I can't quite remember where I said it, but I remember thinking at the end of 2022, I really wanted to work on another app. Thankfully I did just that, and I managed to develop and release a universal (iOS, iPadOS, and macOS) app that takes in various parameters and generates a "text shot", Text Shot.

Text Shot

It's a simple idea, and the app itself is very utilitarian. But from what I've heard, quite a few people have found it useful, including myself. It was originally developed to be a way to share quotes from websites (blogs), but after some feedback, I ended up making it more general. So you can provide up to four parameters: a title, source, author, and the quote. And on top of that I added some extra features like font options, themes, basic Markdown formatting, and also the option to export Alt text for those that wanted to add it to their Mastodon posts.

Website | App Store

Text Case

This is by no means a new project. But 2023 brought a few small changes to Text Case, along with an entirely new form.

Text Case

Apart from some small visual tweaks and bug fixes, I added back a "scratchpad" feature, which shows a piece of text in all formats and flows at once, similar to the original version of Text Case, there were new colour options added, and also, it became a totally free app! The tip jar still exists, but I decided to make all versions of the app free.

Text Case

The new form that Text Case took in 2023 was a command line application. Partly because I wanted the functionality myself, along with wanting to work on something new, and also open-source[1]. It's made with Swift, and it shares a lot of the underlying logic, although I have been refactoring where necessary as it's now public. I had planned at one point to distribute it alongside the Mac App Store version, and also as a publicly available executable, but the various processes like code signing, Developer ID certificates, app notarization, etc. made me decide to distribute it via Homebrew instead.

Website | iOS App Store | Mac App Store | GitHub (CLI)

Smaller Projects

Apart from the two relatively big projects that I've already mentioned, I worked on a few more smaller projects that were both for fun, and for when I had a quick idea or need for something to exist. None of them are groundbreaking, but they were certainly enjoyable, and I think I learned at least something from all of them.

blogroll.js

This was something that I've seen on other peoples websites, and it's a way to have a static list of links, and randomly, a subset are displayed as a list on a website. As the name suggests, it's a simple JavaScript script, and it's quite minimal (purposely). All you do is define a JSON file with a few links (only a title and URL is needed), include the script on the website, and then specify a HTML element where you want the links to be displayed.

I'm not sure if anyone will ever use it. But it was definitely a useful project for me, as I learned how to make minimal JavaScript scripts, and also have them easily configurable via parameters.

GitHub

random-link.js

Very similar to blogroll.js, this is another script that I built that uses similar logic, but instead only presents a single random link at a time.

GitHub

Arbok

I started to appreciate statically generated websites earlier this year (which is why my blog now runs via Hugo), and I also wanted to write some more Python, so I decided to make another static blog generator, named Arbok. It was an interesting project, although I doubt it will be used (I'm starting to notice a trend). However, I did have to write some Python code to manipulate files at work earlier this year, and what I learned writing this project helped me complete that. So I guess it can be classed a success.

GitHub

Hugo Post Organiser

As mentioned above, my blog is now built using Hugo. But previously, it was based on Ghost. And while I managed to export the content from my Ghost blog into suitable files ready for Hugo, they lacked organisation. So I decided to built a tool that could organise a single directory of markdown files, and organise them into subdirectories by year and month, both taken from the source frontmatter in each file.

I have yet to use this for my live blog, but I wanted to see if it was feasible to accomplish. Thankfully it was, and it's something I still may use. But I decided to not go ahead with using it just yet, because I was reminded many times about the benefit of not changing URLs and breaking any links to my blog posts.

GitHub

Plans for 2024

I don't have any detailed plans for 2024. Just some over arching ideas that I hope to at least be following for the first half of the year.

Instead of trying a lot of new languages and frameworks, I want to spend most of my time building on existing skills. So for example maybe using Swift for a new app, or maybe another command line utility. I'm sure I'll end up using JavaScript or Python for a few fun ideas. But seeing as I currently work professionally as a Java developer, I'm interested to see if I can start doing this more in my spare time as well.

Who knows, maybe my next open-source project will be Java-based?

I certainly enjoyed the process of working in public with the CLI version of Text Case, and even if not open-source, I'm beginning to become more a fan of making free software. So I would definitely expect that to continue.


  1. There may be a better term for it than open-source, because I'm not really encouraging contributions, so it's more "public source". ↩︎

Software I've Enjoyed in 2023

2023 is nearly at a close, so I thought I'd write about the software that I've enjoyed using this year. Some of these I've been using for a while, others I've either moved back to this year, or tried out for the first time.

Things

Screenshot

I'm not exactly a big user of task manager apps, but for the odd occasion where i want to track important tasks, or keep track of things like packing luggage for a trip, or purchasing/wrapping christmas presents, Things has been a really good fit for me. I'm pretty sure it's capable of much more than I use it for, but I'd rather that, than use something that forces me to change my habits.

Neovim

Screenshot

This is probably symbolic of my the general way I've been using my computers recently, but I have to give a massive mention to Neovim. You may not have heard of Neovim, but if you've heard of Vim/Vi, I'm sure you'll have a rough idea of what it is.

I've been using Neovim for most of my development work (outside of Java), writing short notes, editing small files, and also to write blog posts. It's a truly powerful piece of software, and the more I'm both learning and customising it, I'm becoming faster at using it, and it's becoming much more moulded to my own use cases.

If you're interested, my Neovim config is available on GitHub.

Artifact

Screenshot

Apart from social media, I've found Artifact to be a really good tool to surface news, blog posts, links, apps, etc. that are both relevant and interesting to me. I don't use it every day, but I can easily get lost in there if I want to. It sends articles that it things I'd like regularly as push notifications, which aren't always perfect, but they're still useful enough that I've left them on.

The only downside to Artifact is that it's iOS only. I'd love to either see a native Mac app, or even just a web interface that I could use.

NetNewsWire

Screenshot

This is an app I've used for a while. But it's such a great RSS reader, I can't say I've even wanted to even think about switching to anything else. I'm using NetNewsWire mainly to follow people, whether it's developers, personal bloggers, or even a few newsletters.

It seems to me that there's been a bit of a resurgence in personal blogging recently, so I've definitely been using NetNewsWire more than past years. And I hope it continues.

Homebrew

Screenshot

The world of package managers[1] for macOS is a lonely one. Fortunately, what we have is Homebrew. Maybe it's because I appreciate command line tools, or just that I dabble occasionally with Linux, but having a package manager is becoming essential for me. Whether it's to install a CLI tool like eza, neovim, or ripgrep, or even non-open source software through Homebrew Cask, it's a really easy way to both install and manage software.

I use Homebrew myself as a developer as well. I distribute Text Case CLI through a custom Homebrew tap. Simply because I didn't want to go through the hassle of signing and notarising it as an app, and then have the extra baggage of maintaining it that way. Instead, when you use Homebrew to install Text Case CLI, it clones the public repository, and then compiles it on your machine.

I've been through a few laptops at work recently, and that's when I really notice how useful it is to have a package manager. Because in one command you can pretty much get all your required tools installed. Which means you don't need to go through the boring task of going to various app websites, downloading installers, expanding DMGs, etc.

Amethyst

Screenshot

I've been using this for a while, but I'm a big fan of tiling window managers[2], and Amethyst is the best one I've come across for macOS so far.

Sure, I'd much prefer a proper native tiling window system with better workspace support. But at least Amethyst gives me the tiling support, and also some keybindings that can help you throw windows between macOS spaces. It's definitely not for everyone, but as someone that typically works from a laptop screen, it's super handy to be able to manage my windows and spaces from my keyboard.

Safari Web Apps

Screenshot

This isn't an app in it's own right. But the recent feature in macOS Sonoma to save any website in Safari as a web app is so useful for when an app or service only exists online. Back when I was playing Chess a lot, I had the Chess.com website saved in my dock as a web app. At home I just have a web app for Fosstodon (the Mastodon instance I'm on), and at work, I have a bunch of them for internal web tools that we use.

The best thing is that they're not the same as typical web app turned native, like you may see with Electron-based apps. Instead, they look, feel, and perform, exactly how they would if they were opened in Safari.


  1. Basically, a tool that helps you automate the management of installing, configuring, and removal of software (packages). Read more. ↩︎

  2. A window manager that resizes your windows into always-visible tiles on your screen (or workspace). Read more. ↩︎