How to fix zsh completions

I was trying to add some zsh completions and I couldn’t figure out why they weren’t working. I had added them into a folder that I was running autoload on, but I still couldn’t get it to work.

I found this stackoverflow post and it saved me.

Here is what my .zshrc looks like now.


The code


autoload -Uz compinit && compinit

# enable case insensitive tab completion
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
fpath=(/usr/local/share/zsh-completions $fpath)
source $DOTFILES/zsh-completions/_arduino_cli

NOTE: I set up environment variables for important paths hence the $DOTFILES line.

So what is this doing?

I think the gist of this is autoload compint (I was already doing this) and then source your completion files (I was not doing this).

I’ll probably later write a nice loop for this if I end up with more completions.

Back to the beach.

My family and I recently took a trip to Missouri after having moved to South Carolina about six months ago.

It was nice to see family and friends.

It was also nice to have a reminder for why we moved here in the first place.

No matter where you go or what you do there will be trade-offs. When I go to the beach and see my daughter’s eyes light up, I know that I’m happy with the trade-offs we’ve made to get here.

My oldest daughter standing in the wake

A userscript to add links to headers in articles

I read a lot of things on the internet and sometimes I want to save my position for later. Many websites use HTML section heading tags to mark sections of their content. Many of these websites attach an id attribute which is nice because if you paste that id into the url like https://nickkaczmarek#some-id you can link to the spot in the website that contains that id.

Some websites go even further and provide an anchor to that section heading and it makes it really easy to just click that value and then if the page is reloaded you will stay at that spot. This website by Sarun Wongpatcharapakorn is a great example of a site that provides clickable links to parts of the article.

Unfortunately many websites either don’t have these id attributes (for instance my website 😬) or they do, but you can’t click on them. If you’re particularly pioneering you can inspect the web content, grab the id, and paste it in the address bar in your browser. As you can see that is a lot of work and also assumes you are even familiar with how to do that.

I have been doing the above for a long time and finally I decided I would try to make this better with some automation. So I wrote a userscript to do this for me.

There are many userscript extensions out there. I use one for safari called Userscripts and you can use this on a Mac and an iPhone. There are also Chrome and Firefox extensions with names like TamperMonkey, GreaseMonkey, etc. They all more or less work the same.

# The Code

It’s not perfect, but it has worked on a number of websites for me including wikipedia (where I want to use this most).

# What it looks like when it’s off:

screenshot of website without my userscript

# What it looks like when it’s on:

Screenshow of website with my userscript

How to use git to revert changes to individual files or foldersvidual

This is something I need to do often and often forget how to do it.

tl;dr: git checkout main <filename>

Disclaimer:

Like anything else this is nuanced and there are other ways to accomplish this as well as other arguments to revert to a point in time instead of just the tip of main.

Revert a commit

If you want to a revert a whole commit you can do git revert <hash>.

Revert a file or folder

But what if you want to revert one file or one folder to what is in your main branch?

You can do git checkout main <filename>.

An example repository where you have this structure:

repo-root
β”œβ”€β”€ main.swift
β”œβ”€β”€ Service
β”‚Β Β  β”œβ”€β”€ Service.swift
β”‚Β Β  └── README.md
└── start-docker.sh

You could do git checkout main main.swift to undo main.swift to where it was on main.

Or you could do git checkout main Service to undo the whole directory to where it was on main.

Why would I want to do this?

The situation where I found this useful was that I had a long running branch and I wanted to merge part of the code into main. The problem was there were a handful of files that I did not want to merge to main.

I could have reverted the commits where they were made, but this branch had a lot of commits and I wasn’t sure exactly when these changes were made.

I also could have manually changed them back to what they were in main, but this was a better solution for my use case.

Maybe you’ll find it useful as well.

TΓ­os holding me as a baby.

My tΓ­o David (RIP) and my tΓ­o Jesse holding me when I was a baby. Taken sometime in 1993.

My grandma sent me this the other day and I’m sad that I’ll never get to meet my tΓ­o David. He died of AIDS related complications before I turned 2. I wonder what he would think of the world as it is now.

My tΓ­os holding me when I was a baby.

Angel Oak, South Carolina.

From Wikipedia on the Angel Oak:

Angel Oak is a Southern live oak located in Angel Oak Park on Johns Island near Charleston, South Carolina. The tree is estimated to be 400–500 years old. It stands 66.5 ft tall, measures 28 ft in circumference, and produces shade that covers 17,200 square feet. Its longest branch distance is 187 ft in length. Angel Oak was the 210th tree registered with the Live Oak Society.

This thing is absolutely gigantic.

Picture of the Angel Oak in South Carolina.

Sichuan restaurant with many vegan options in Charleston, South Carolina

Last weekend we went to a Sichuan Chinese restaurant called Kwei Fei in Charleston, SC that had some amazing labeled vegan options. Often times there are dishes that are vegan, but very rarely are they labeled as such. I was quite happy to try this place and the experience was well worth the wait. They even had an option for my two year old daughter to try so we didn’t have to worry about her eating things that were too spicy (despite the fact that nothing ended up being too spicy for her).

Like most food we’ve had in Charleston it was pretty expensive, but that’s just the price you pay when you want good food and especially when you want vegan food.

The one thing I’ll be sure to ask for next time are little bowls to scoop rice and food into because eating rice on a plate with chopsticks is not fun!

10/10 would go again!

kwei fei sign on outside of restaurant

kwei fei menu

Liang Fen, cold jelly noodles with chili oil and peanuts.

Dry fried green beans. (amazing!!!)

Home-style tofu. (Also amazing!!!)

Good sized portion of rice, though I really enjoy when the Chinese restaurant bring you out a giant bowl with like 6 portions of rice. 🍚

Dan Dan Mian. This is actually what caught my eye when looking up the menu originally months ago, but this was my least favorite. Not enough chili oil or sauce with the dish.

Last time at Red Orchids China Bistro

I moved to Charleston, South Carolina recently and we found a Chinese restaurant that had vegan options. To say I was ecstatic is an understatement. There were so many options and it had so many things you never see at American Chinese take-out restaurants like eggplant, bok choy, scallion pancakes, and a bunch of different tofu dishes.

Unfortunately only a month and a half after we moved here they announced that they were closing down after 19 years. Fortunately for them, they are having the biggest rush I’ve ever seen in my life. Like 25 people lining up 30 minutes before the restaurant even opens.

Needless to say I really wanted to eat there once more but I’ve been unable to stop in and sit down because we have two young children and they don’t exactly like the idea of waiting.

Today I got lucky and was able to place an order for pick up. I called the minute they opened and they told me I would be the only pick up order because of how busy they got. Seriously, so much luck!

I’m going to miss Red Orchids but it’s nice to see how much of an impact they’ve made on the area.

Today we order General (Tso)’s tofu, sesame tofu, garlic bok choy, and garlic eggplant. Absolutely delicious.

General Tso's tofu, sesame tofu, garlic bok choy, and garlic eggplant with a plate of steamed rice.

macOS Meets Van Gogh by BasicAppleGuy

Wow, these are really cool. Well done @basicappleguy

macOS Meets Van Gogh:

Four of my favourite OS X/macOS wallpapers reimagined through AI in the artistic style of Vincent Van Gogh.


Following the unexpected success of Big Starry Sur, I am releasing a new wallpaper pack featuring four OS X/macOS wallpapers in the artistic style of the late Dutch painter Vincent Van Gogh.

History

In early March, I posted a photo on social media titled 'macOS Big Sur in the style of Van Gogh’s Starry Night' an AI-generated mashup of macOS Big Sur's default wallpaper attempted in the art style of Van Gogh's The Starry Night. Not being hyperbolic, the wallpaper exploded in popularity. Hundreds messaged me for a link, and when I uploaded it onto Google Drive, the surge to download it was so enormous that Google stopped access to the drive for several hours. It wasn't till the following day that I could finally host it on my webspace and provide a reliable link for people to download it.

That response to Big Starry Sur vastly exceeded my expectations. So positive was the reception that it inspired me to create another collection of four AI-generated macOS wallpapers, again inspired by Van Gogh. Enjoy.

Vincent Van Gogh

Quick history lesson: Vincent Van Gogh was a Dutch-born painter born during the impressionist/post-impressionist period. Selling just one painting during his short 37-year life (1853-1890), Van Gogh's artwork only became famous posthumously. His works, including thousands of drawings and over 900 oil paintings, were primarily created within a narrow 10-year window before his death.

Van Gogh is perhaps most well known for his many self-portrait paintings and works like his 1889 The Starry Night, 1890 Almond Blossoms, and his 1888 Sunflowers series. His adoption of vivid colours and energetic brush strokes are perhaps two of the most notable artistic qualities of this post-impressionist painter; a man who struggled mightily with his mental health and desire to make an impression in the artistic world.

Process

These images were all created using the Midjourney, an AI model that generates images based on prompts provided by the user. Each image featured is the end result from hundreds of prompts, iterations, and creative variations supplied to Midjourney before I was satisfied with the result. From there, images were upscaled, sharpened and textured in Pixelmator Pro before being cropped and formatted for the Mac, iPhone, and iPad.

Wallpapers

This series utilizes four of my favourite OS X/mac OS Wallpapers: Lion, Mountain Lion, El Capitan, and Big Sur and tries to recreate them in the post-impressionist style of Van Gogh. Each wallpaper is available for the iPad, Mac, and iPhone. Enjoy!

Big Sur Take II

The first work is another take on macOS Big Sur's abstract hill wallpaper. But rather than referencing The Starry Night, as I did in my first post, I pointed Midjourney to use paintings from Van Gogh's Wheatfield series. After numerous iterations, the result is this stunning & vibrant wheat field at sunset with rolling hills off in the distance.

iPad | Mac | iPhone


The Starry Mountain Lion

This second work is based on one of my favourite Apple wallpapers from OS X 10.8 Mountain Lion. Released in 2012, Mountain Lion featured the spiral galaxy NGC 3190 located a meagre 79 Million Light Years away from Earth. This photograph of NGC 3190 has always been mesmerizing, and I adore Apple's choice of Blues and Yellows to colourize it for their 10.8 desktop wallpaper. It was a perfect choice for a more minimal and abstract wallpaper to include in this collection.

iPad | Mac | iPhone


Wheat Field with El Capitan

This interpretation of OS X 10.11's wallpaper takes and remixes Yosemite's famous El Capitan. Bold brush strokes and vivid colours reference the palette of OS X El Capitan's signature wallpaper, with a foreground and character inspired by Van Gogh's Wheatfield series.

iPad | Mac | iPhone


Lion with Cypresses

Lion with Cypresses was inspired by OS X 10.7, whose signature wallpaper is the beautiful Andromeda Galaxy, which was colourized with a mix of yellows, pinks, and blues for the official OS release. Those colours and the galaxy motif were integrated into a wallpaper that blended Van Gogh's 1889 Wheat Field with Cypresses and The Starry Night, creating a lively, saturated foreground and a vivid cosmic night sky that dances across the digital canvas.

iPad | Mac | iPhone


In Sum

It feels like magic to have software that can create these unique and beautiful works based solely on text prompts. The growth of AI technologies over the last several years has provided an exciting (and slightly unsettling) peek at previously unimaginable new tools for creative development.


SUPPORT

I’m a one-person operation, working in healthcare by day & running this site as a passion project in my off time.

If you enjoy my work (the articles, the wallpapers, my general demeanour… anything really), consider leaving a tip & supporting the site. Your support is incredibly appreciated & goes a long way to keep this site and the works I produce ad-free & free of charge.

β˜•οΈ Tips

UI Bug with Xcode's invisible characters in documentation comments

Feedback number: FB12128126

I like to display invisible characters in my text editors/IDEs because I want to know if the spaces I’m seeing are spaces or tabs. I also like to be able to tell immediately if I’m seeing multiple spaces or not.

Here is an example of what that looks like. Notice the grey dots between words. screenshot of xcode showing invisible spaces rendered visible

In Xcode, you can find this in the Editor menu labeled as Invisibles.

screenshot snippet of the editor menu in xcode showing the invisibles item

Today I noticed that when using documentation comments, the invisibles are misaligned and lay on top of the characters instead of between them. I submitted a feedback, but I’m not sure it will ever be addressed so I wrote this post in case someone else runs into the same thing.

screenshot of xcode showing invisibles in documentation comment misaligned layout

misaligned invisibles in documentation comment.