Skip to content

Instantly share code, notes, and snippets.

View arkku's full-sized avatar

Kimmo Kulovesi arkku

View GitHub Profile
@arkku
arkku / unifi-network-config.mongo
Last active January 9, 2026 23:40
Edit subnet in UniFi without a gateway
# mongodump --port 27117 --db ace --out "/srv/mongodb-backup-$(date +%Y%m%d)"
# mongo --port 27117
use ace
# Find network by name
db.networkconf.find({name: "Default"})
# Some of these settings can't be set in the UI without a UniFi gateway,
# but manually setting the `"purpose": "corporate"` makes the subnet
# visible (for reference).
@arkku
arkku / Makefile
Last active December 28, 2025 18:35
DKMS makefile for E810 driver intel/ethernet-linux-ice
# Makefile to add the Intel ice driver (E810) as a DKMS module to Debian
#
# Check out the repository https://github.com/intel/ethernet-linux-ice
# into a directory. Put this Makefile into the root of that directory.
# Run `make` as root, which should add the module to DKMS and build it.
# Use `make install` to install, or just `dkms install ice/2.4.5` directly.
# `make clean` to restore the initial state.
#
# When the driver is updated, `git pull` and then just `make` again. It
# should automatically update the version number, as long as the format
@arkku
arkku / Makefile
Last active December 15, 2024 16:19
Makefile for Advent of Code
# Makefile for Advent of Code (or similar daily programming puzzles).
# Kimmo Kulovesi, https://github.com/arkku
#
# This allows you to type `make 3` to compile and run all of your
# solutions for the puzzles of day 3 against both the simple test
# case and the real input. It will time each run, and it will show
# the correct answer under each run (from the file `answers.txt`,
# which you must fill in).
#
# NOTE: This does _not_ fetch anything from the Advent of Code servers
@arkku
arkku / qmk_apple_fn.patch
Last active March 3, 2024 14:22
Patch for QMK firmware to add two keycodes for Apple Fn: KC_APFN simulates the key directly, whereas APFN_LAYER(x) works as MO(x) but also registers as holding down Apple Fn _when no other key is pressed_. APFN_KEY(x) is key x together with Apple Fn.
diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk
index c976b8296d..335b432e78 100644
--- a/builddefs/common_features.mk
+++ b/builddefs/common_features.mk
@@ -108,6 +108,12 @@ ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/mousekey.c
endif
+ifeq ($(strip $(APPLE_FN_ENABLE)), yes)
+ OPT_DEFS += -DAPPLE_FN_ENABLE -DENABLE_APPLE_FN_KEY=1
@arkku
arkku / bunnies.rb
Last active October 20, 2020 12:29
#!/usr/bin/env ruby
puts "🕳"
bunny = [ '(\_/)', '( •_•)', '/ >' ]
count = (ARGV[0] || 17).to_i
0.upto(count - 1) do |i|
space=''
1.upto(i * bunny.last.length) { |j| space="#{space}#{j.odd? ? '.' : ' '}" }
print bunny.join("\n#{space}")
end
puts "🕳"
@arkku
arkku / moshshell.sh
Last active July 9, 2019 18:02
mosh + tmux helper to kill disconnected leftover sessions from the same machine
#!/bin/sh
host="$1"
[ -z "$host" ] && host=homeshell
port="$2"
[ -z "$port" ] && port=60001
slave="$3"
[ -z "$slave" ] && slave=`hostname -s` # use a fixed string if needed
main=$4
[ -z "$main" ] && main=0
@arkku
arkku / named_args.c
Created September 7, 2018 17:49
Named arguments in C (not necessarily recommended)
#include <stdio.h>
struct foo_args { int bar; char *baz; };
void real_foo(struct foo_args args) {
(void) printf("bar=%d, baz=%s\n", args.bar, args.baz);
}
#define foo(args...) real_foo((struct foo_args) { args })
@arkku
arkku / disable-root.sh
Last active November 30, 2017 12:01
Script to disable root account on macOS High Sierra
#!/bin/bash
# This script will disable the root account on macOS.
# At the time of writing there is a severe security flaw in macOS High Sierra,
# which allows the root account to be used without any password to gain admin
# access from any of the GUI password dialogs (it will fail once the first time,
# but on subsequent attempts it will accept the empty password).
#
# The commonly circulated workaround is to set a password for the root account,
@arkku
arkku / config.properties
Created October 5, 2017 14:56
SSH key authentication (only) for UniFi
config.system_cfg.1=sshd.auth.key.1.status=enabled
config.system_cfg.2=sshd.auth.key.1.value=AAAA…Z
config.system_cfg.3=sshd.auth.key.1.type=ssh-rsa
config.system_cfg.4=users.1.password=x
@arkku
arkku / buffy_selections.txt
Last active July 28, 2017 11:30
Buffy the Vampire Slayer
Buffy the Vampire Slayer
Buffy the Vampire slayer is a TV series that began in 1997. It has an extensive cast of characters (a pattern typical of the creator Joss Whedon), funny (and intentionally unrealistic) dialogue and tons of pop culture references. Oh, yeah, and there are some vampires and demons, and a girl with superpowers who fights them - but all that is of secondary importance.
It is highly recommended to watch the entire series, but given that it's 7 seasons (plus 5 more in the spin-off series, Angel), and the fact that especially the first seasons are beginning to show their age, it may be easier to get into the series by watching selected episodes. This list is my selection of such recommended episodes.
Even though I've listed episodes throughout the series, I actually recommend starting from season 4 and working your way up to the musical episode (season 6, episode 7). The musical episode is the best thing ever to be made for TV, but please resist the temptation to skip directly to it, s