Skip to content

Instantly share code, notes, and snippets.

View Klohto's full-sized avatar
🐈
Keyboard occupied by a cat

Tomas Klohna Klohto

🐈
Keyboard occupied by a cat
View GitHub Profile
@mrballcb
mrballcb / rancher_desktop_restart.txt
Last active March 14, 2022 16:55
Restart Rancher Desktop from the CLI on Mac
Rancher Desktop is what I've switched to in place of Docker Desktop. It has some differences that
need to be worked around (see previous gist for setting the network subnet a container uses).
One other issue is that after about 24 hours, the docker socket just stops listening. It is currently
on Rancher's radar, but in the meantime, the only real solution is to stop and start the entire
Rancher Desktop app. The below script does exactly that.
A second issue is that a running k3s cluster consumes enough CPU/power that it raises the temperature
of the Mac when it's idle and significantly cuts down on battery life. The second script will stop
the k3s subsystem and kill all running containers, bringing the CPU usage down to a very low level.
@PJUllrich
PJUllrich / big-o.md
Last active April 28, 2024 14:19
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for <= 32 elements, O(log n) for > 32 elements [2]
Deletion O(n) for <= 32 elements, O(log n) for > 32 elements

Merging git repositories, putting one of them into a subdirectory

For this you need git-filter-repo installed (filter-branch is discouraged).

cd a
git filter-repo --to-subdirectory-filter a
@dojoe
dojoe / dkms-module-signing.md
Last active April 24, 2024 18:50
Make DKMS sign kernel modules on installation, with full script support and somewhat distro independent

On systems with UEFI Secure Boot enabled, recent Linux kernels will only load signed modules, so it's about time DKMS grew the capability to sign modules it's building.

These scripts are extended and scriptified variants of https://computerlinguist.org/make-dkms-sign-kernel-modules-for-secure-boot-on-ubuntu-1604.html and https://askubuntu.com/questions/760671/could-not-load-vboxdrv-after-upgrade-to-ubuntu-16-04-and-i-want-to-keep-secur/768310#768310 and add some error checking, a passphrase around your signing key, and support for compressed modules.

dkms-sign-module is a wrapper for the more generic sign-modules which can also be used outside of DKMS.

Installation

  1. Create a directory under /root, say /root/module-signing, put the three scripts below in there and make them executable: chmod u+x one-time-setup sign-modules dkms-sign-module
@IgnoredAmbience
IgnoredAmbience / 99-noto-mono-color-emoji.conf
Last active May 8, 2024 06:50
Noto Emoji Color fontconfig for Konsole
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
Noto Mono + Color Emoji Font Configuration.
Currently the only Terminal Emulator I'm aware that supports colour fonts is Konsole.
Usage:
0. Ensure that the Noto fonts are installed on your machine.
1. Install this file to ~/.config/fontconfig/conf.d/99-noto-mono-color-emoji.conf
@rberenguel
rberenguel / SafariTabSwitcher.lua
Last active April 1, 2022 15:45
An interactive tab chooser for Safari written with AppleScript (yikes) for HammerSpoon (Lua scripting framework for Mac OS automation)
----
-- A tab chooser for Safari written with AppleScript (yikes) and HammerSpoon
----
----
-- Known issues:
-- If a tab has double quotes, unsure about what will happen, the tab
-- list creation is brittle. Single quote is fixed though