Skip to content

Instantly share code, notes, and snippets.

View mofrim's full-sized avatar

mofrim mofrim

  • Göttingen, Germany
View GitHub Profile
@mofrim
mofrim / switch_win_ws.sh
Created September 30, 2025 13:16
Focus window to the right or move to new workspace for Hyprland. Useful for workflow on small displays.
#!/usr/bin/env bash
# This is my switch-focus-or-create-ws-script. If there is no more window left
# or right of the current one will switch to the next workspace. So far, at
# least, when moving to the right, this leads to creation of new workspaces.
out="$(hyprctl dispatch movefocus $1)"
winno_on_cur_ws="$(hyprctl workspaces -j | \
jq '.[] | select(.id == '$(hyprctl activeworkspace -j | jq '.id')')' | \
jq '.windows')"
@mofrim
mofrim / keychron_linux.md
Created March 21, 2025 05:51 — forked from andrebrait/keychron_linux.md
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

@mofrim
mofrim / sorting-algorithms-c.md
Last active August 6, 2024 22:08
Sorting Algorithms in C

Sorting Algorithms in C

BubbleSort

The easy one. $\mathcal{O}(n^2)$

void bubblesort(int *arr)
{
 sort sort sort;
#! /usr/bin/env nix-shell
#! nix-shell -i python2 -p python27
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Alexey Kutepov a.k.a. rexim
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,