til Easy Copy on Write MacOS I stumbled on this while reading through some notes about git worktrees, and found it to be a pretty handy trick. The version of cp on MacOS supports -c for creating copy-on-write copies of a file. E.g., this command would copy a
til Edit current command in $EDITOR It's rare that I learn a new cli shortcut, but here's a cool one I just learned today from the This Week in Self-Hosted (1 March 2024) [https://selfh.st/newsletter/2024-03-01/] newsletter. When you are typing in a shell,
til Delete all repos from an organization in forgejo/gitea I didn't follow my own advice on https://justyn.io/til/mirror-starred-repositories-from-github-to-gitea-forgejo/ and quickly used up all of the disk space on my small forgejo vm. I decided this was a problem for another day and wanted to delete everything in my
til Mirror starred repositories from github to gitea / forgejo I recently wanted to mirror all of the repos I have previously starred on github to my personal forgejo instance. To do this, I created a bash script named `mirror-github-stars-to-forgejo.sh`
til Renumber all windows in tmux If you have a large number of windows open in tmux [https://github.com/tmux/tmux], it can be a pain when deleting some of them as the numbers are no longer consxistent. You could have 20 windows open, but the next window you
til Install ZSH 5.8 on CentOS 7 Quick instructions for compling ZSH from source. Note that this is essentially just download/configure/make/make install. Look in https://www.zsh.org/pub/ for the most recent version if 5.8 is not the version you're looking for. cd /usr/
til Sort ZFS filesystems by snapshot size Quick one-liner to sort ZFS filesystems by the amount of space used by their snapshots.
til Install Emacs 28 (with Native Compilation) on CentOS 7 Instructions for installing Emacs 28 on CentOS 7, and also enabling the new Native Comp feature recently merged in. Note that this is similar to compiling Emacs 27 [https://justyn.io/til/compile-emacs-27-on-centos-7/], but requires extra dependencies to enable native compilation. At the time
til Compile Emacs 27 on CentOS 7 Quick instructions for installing Emacs 27 on CentOS 7 since it doesn't seem to be available in any popular yum repositories. Install dependencies: # Note: This installs dependencies for X11 as well. Change this and the ./configure below if you don't
til Migrate Kubernetes PVC to another PVC Recently I have been testing different storage backends (like Rancher Longhorn, Rook, NFS, etc.) for Kubernetes. Since I'm switching pretty frequently, I needed a simple way to migrate or copy data from one pvc to another. 1. Make sure both PVCs are
til Completely reset local git repo Note: These commands can easily cause data loss. Please do not run them if you do not understand what they do. Even if you do understand, make a backup just in case. If you need to wipe out all of your local changes: Use
til Delete a kubernetes pod stuck in 'Terminating' state Occasionally you may run into a pod that is hung in Terminating state. Sometimes this pod may be on an unresponsive node or just doesn't exist anymore, but the kube api server doesn't know yet. To forcefully terminate the pod,
til Delete all pods in a Kubernetes Namespace Quickly delete all pods (or other resources) in a Kubernetes namespace.
til Copy a Kubernetes secret to a different namespace Kubernetes secrets [https://kubernetes.io/docs/concepts/configuration/secret/] are only accessible in the namespace they're created in. A quick one-liner to copy a secret from namespaceA to namespaceB is: kubectl get secrets <secret_name> --export --namespace=<namespaceA>
til Copy files/directories from one Kubernetes pod to another Kubernetes pod Recently I have been experimenting with different ways to handle storage in Kubernetes; this usually requires me to rsync data from one storage backend to another. My goto solution was to mount both storage backend PVs in the same pod and use rsync, but
til Quickly check for broken links using wget As part of migrating this website from Hugo to Ghost, I wanted to quickly check what links are broken so that I can fix them. wget isn't the best tool for the job, but it does offer a pretty quick sanity check.
til Upload files to Nextcloud using curl (and webdav) I recently had the need to upload a bunch of PDF files from a linux server to my Nextcloud [https://nextcloud.com/] instance. Nextcloud doesn't currently have a headless linux client, but WebDAV [https://en.wikipedia.org/wiki/WebDAV] is available by
til Deploy Varnish as a cache server in Kubernetes kustomization.yaml file: --- apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - deployment.yaml - service.yaml configMapGenerator: - name: varnish-config files: - default.vcl Varnish deployment.yaml: --- apiVersion: apps/v1 kind: Deployment metadata: name: dev-justynio-ghost-varnish-deployment labels: app: ghost-varnish domain: dev.
til Enable caching using nginx-ingress proxy_cache_path [https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path] needs to be configured globally for the nginx-ingress-controller, which means creating or updating the nginx-configuration config map [https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#http-snippet] : ---
til Enable (force) Dark Mode in Ghost's default Casper theme I did not realize that Ghost's default theme, Casper, has a Dark mode for the longest time. By default, it is only enabled if the local OS has dark mode enabled and the browser exposes that information. Note: If you're
til Increasing the max post/upload/body size in nginx-ingress There's a proxy-body-size [https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md#custom-max-body-size] option that can be configured via an annotation on ingress objects. This option maps to client_max_body_size [http://nginx.org/en/docs/http/ngx_
windows Using a Yubikey for GPG in WSL (Windows Subsystem for Linux) on Windows 10 Previously, I wrote about using bash (WSL) on Windows 10 [https://justyn.io/blog/using-bash-windows-subsystem-for-linux-on-windows-10/]. I've changed some of my setup since then, but still use something similar for when I'm developing on a Windows machine. Until recently, I have
finances Automatically Sort and Align Ledger Transactions in VIM One of my goals for 2018 is to track all of my finances using plaintextaccounting [http://plaintextaccounting.org/]. For now, I am using ledger-cli [https://www.ledger-cli.org/] and vim. I won't go into detail on how to use ledger or plaintextaccount
home automation How to restart Home Assistant docker container automatically on failure Intro Quoting from the website: "Home Assistant [https://home-assistant.io/] is an open-source home automation platform running on Python 3. Track and control all devices at home and automate control." I've been using Home Assistant for a while now, and
windows Using Bash (Windows Subsystem for Linux) on Windows 10 I recently reinstalled my main desktop computer, and decided to finally give "Bash on Windows 10", or the "Windows Subsystem for Linux", a real try. I'm hoping it will get rid of my need for Putty/WinSCP as