Remove subfolder from all git history

# Remove DIRECTORY_NAME from all commits, then remove the refs to the old commits # (repeat these two commands for as many directories that you want to remove) git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch DIRECTORY_NAME/' --prune-empty --tag-name-filter cat -- --all git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d # Ensure all old refs are fully removed rm -Rf .git/logs .git/refs/original # Perform a garbage collection to remove commits with no refs git gc --prune=all --aggressive

February 27, 2020  |  🏷️Git

Dexed patches I like

Cartridge collections: Dexed_cart_1.0.zip Patches !Instruments > Misc > 2003.SYX > Brass&REV7: Punchy brass with slight echo !Instruments > Misc > DECKARD.SYX > SYNTHI 1-5: Versatile dark lead bass

February 19, 2020  |  🏷️Music

Heroes of Might and Magic VI does not start (black screen)

What I expected After installing Heroes of Might and Magic VI and then starting it through Steam, the game should enter the main menu. What I got The game screen is only black and never enters the main menu. How I solved it Go to My Documents > Heroes of Might and Magic VI. Open ProfileData with your favorite text editor Replace <gfx_Fullscreen2>Fullscreen</gfx_Fullscreen2> with <gfx_Fullscreen2>Windowed</gfx_Fullscreen2> Start game. Game will be in windowed mode, but it’s better than nothing ...

Kubernetes + GCloud + Kind Cheatsheet

Kubernetes + GCloud + Kind Cheatsheet Links Official Kubernetes Cheatsheet Kubectl Bash autocomplete source <(kubectl completion bash) Context - easy way of changing namespaces Contexts are saved to $HOME/.kube/config, so you can edit that file manually if you mess up. # One-time-only - create context kubectl config set-context iix --namespace=iix --user=kubernetes-admin --cluster=kubernetes # Later - use context kubectl config use-context iix Listing # List all images in the active namespace kubectl -n dev get pods -o jsonpath="{.items[*].spec.containers[*].image}" |tr -s '[[:space:]]' '\n' Modify existing daemonset kubectl get ds fluentd-gcp-v2.0 --namespace kube-system -o yaml > fluentd-gcp-ds.yaml # Replace stuff in fluentd-gcp-ds.yaml kubectl replace -f fluentd-gcp-ds.yaml Modify existing configmap Updating ConfigMap in the apiserver is more complicated than updating DaemonSet. It’s better to consider ConfigMap to be immutable. Then, in order to update the configuration, you should create ConfigMap with a new name and then change DaemonSet to point to it. ...

Using black or white text depending on background color

One problem which I encounter time and time again when creating a webpage or applications is matching text color with a changing background color. When creating a GUI you usually create a lot of white boxes with a black text on it, just to get sizes and stuff matching. Then later a designer or customer decides on a theme which affects how that box looks. Most of the time the background and text colors are hand-selected so they match well enough, but from time to time you have to create a box which can change background color on demand, and then you have to have the text color matching to make the box readable. I have done too many slightly different solutions to this problem, so I thought I would write something down here. Since most of the time, text colors are off-white and off-black, the formula should be tweakable to match any given hue. ...

May 11, 2019  | 

Turn off caps-lock without the key

I usually don’t have a keyboard key mapped to caps, since I have my caps mapped to escape instead. However, from time to time it still gets activated. So to save me googling-time, this is the easiest way to turn it off: Alternative 1 xmodmap -e "clear Lock" Alternative 2 #! /usr/bin/env python from ctypes import * import subprocess class Display(Structure): """ opaque struct """ X11 = cdll.LoadLibrary("libX11.so.6") X11.XOpenDisplay.restype = POINTER(Display) display = X11.XOpenDisplay(c_int(0)) X11.XkbLockModifiers(display, c_uint(0x0100), c_uint(2), c_uint(0)) X11.XCloseDisplay(display)

HTTPS/SSL/TLS Verify installed certificate

Verify cert is correct openssl s_client -connect domoticz.iix.se:443 -servername domoticz.iix.se </dev/null Verify date of expiry for installed cert # HTTPS openssl s_client -connect example.com:443 -servername example.com 2>/dev/null </dev/null | openssl x509 -noout -dates # SMTP % openssl s_client -starttls smtp -connect smtp.iix.se:25 </dev/null 2>/dev/null | openssl x509 -noout -dates

Java Regex Cheatsheet

Escaping strings in regex replace s.replaceFirst(Pattern.quote("text to replace"), Matcher.quoteReplacement("replacement text"));

March 14, 2019  |  🏷️Regex

Salt Cheatsheet

# List hosts sudo salt-key --list-all # Add host sudo salt-key -a hello-hostname # Apply one/several hosts sudo salt 'hello-hostname' state.apply sudo salt 'hello-*' state.apply sudo salt 'hello-hostname' test.ping sudo salt '*' state.apply users ## När något gick fel och man missade att lessa loggen sudo salt-run jobs.list_jobs sudo salt-run jobs.lookup_jid $jobid | less

March 5, 2019  |  🏷️Salt

Open port in fedora

Open port for a given zone sudo firewall-cmd --zone=FedoraServer --add-port=8080/tcp