Skip to content

Instantly share code, notes, and snippets.

View nazarewk's full-sized avatar

Krzysztof Nazarewski (kdn) nazarewk

  • NetBird
  • Poland
  • 07:09 (UTC +02:00)
View GitHub Profile
@nazarewk
nazarewk / README.md
Last active May 13, 2025 11:36
Using TamperMonkey on Firefox to set up TinyMCE rich text editor with Zammad helpdesk software

TinyMCE in Zammad text boxes

This is barely working proof of concept that just confirms it's possible to use TinyMCE in Zammad using either browser console or TamperMonkey user scripts.

It was created with some help from the awemsome Kagi Assistant / Claude 3.7 Sonnet (never wrote/used user scripts in browsers or the TinyMCE itself, didn't write Javascript for a decade). Developed mostly in Firefox's browser console before finally wrapping it up in TamperMonkey script.

It adds 3 custom shortcuts:

// Register keyboard shortcuts
editor.shortcuts.add('alt+m', 'Monospace', toggleMonospace);
@nazarewk
nazarewk / tofu-issue.sh
Last active November 28, 2024 12:37
demonstration of OpenTofu filesystem mirror issue with version `0.0.0`
#!/usr/bin/env bash
set -xeEuo pipefail
trap 'echo "Error when executing $BASH_COMMAND at line $LINENO!" >&2' ERR
dir="$(mktemp -d "$PWD/tofu-report.XXXXXX")"
tf_root="$dir/tf-root"
: "${KEEP:="0"}"
trap 'test "$KEEP" == 1 || rm -rf "$dir" || :' EXIT
export TF_CLI_CONFIG_FILE="$dir/.tofurc"
PLUGINS_DIR="$dir/plugins"
@nazarewk
nazarewk / README.md
Last active November 9, 2023 10:05
Podman container exit killing Sway WM (running as a systemd service)

the issue

sway process stops as soon as podman container exits, eg podman run --rm -it bash -c 'exit 0'

see resolution.md

background

For the last 1-2 years after switching XFCE on Arch Linux to Sway (Wayland) on NixOS I had on and off issues with podman container exits resulting in sway window manager exiting.

It might have been caused by moving sway process inside a systemd service, but at the beginning I was not using enough containers to pinpoint the time.

@nazarewk
nazarewk / README.md
Created October 26, 2023 12:35
Standalone Nix module for modelling JSON data

This is an example of a standalone single-file module that outputs a JSON file out of it's configuration.

Standalone in this context means it's not meant to be used by NixOS or Home Manager configurations.

@nazarewk
nazarewk / message.md
Created October 20, 2023 12:31
a message on KDE describing issues

this seems like something fit for the channel, I'm getting coredumps whenever running (some) stuff under Plasma Wayland

kkdn@krul ~ [SIGABRT]> xdg-which org.kde.plasma.emojier.desktop
*** buffer overflow detected ***: terminated
fish: Job 1, 'xdg-which org.kde.plasma.emojie…' terminated by signal SIGABRT (Abort)
kdn@krul ~ [SIGABRT]> 

but not through SSH:

@nazarewk
nazarewk / README.md
Last active July 14, 2024 07:39
difftastic wrapper providing HTML and easier consumable JSON outputs

This is a pure-Python script which builds on top of difftastics --display json to provide:

  • more ergonomic and ready to use JSON output
  • slightly styled HTML table (mimics side-by-side)

it addresses following shortcomings of current (v0.51.1) JSON output:

  • line-scoped changes within block-scoped chunks are unordered (different each time), had to be sorted by rhs.line_number then lhs.line_number
  • there seems to be a lot of conscutive single-character entries of same type (highlight) for some (probably unknown?) languages, those are merged

addresses Wilfred/difftastic#45

@nazarewk
nazarewk / .gitignore
Last active April 29, 2022 11:01
Helm values cannot be overriden with null
templates/
This file has been truncated, but you can view the full file.
-- Journal begins at Thu 2022-02-17 19:32:53 CET, ends at Tue 2022-03-01 11:01:40 CET. --
Mar 01 10:41:40 nazarewk-krul /nix/store/98sf58748yqq51197whkqc4ik0sr2mmh-gdm-41.3/libexec/gdm-wayland-session[5394]: 02:33:32.833 [DEBUG] [sway/desktop/xwayland.c:704] New xwayland surface title='(null)' class='(null)'
Mar 01 10:41:40 nazarewk-krul /nix/store/98sf58748yqq51197whkqc4ik0sr2mmh-gdm-41.3/libexec/gdm-wayland-session[5394]: 02:33:32.833 [DEBUG] [wlr] [xwayland/xwm.c:833] unhandled X11 property 492 (XSEL_DATA) for window 46137345
Mar 01 10:41:40 nazarewk-krul /nix/store/98sf58748yqq51197whkqc4ik0sr2mmh-gdm-41.3/libexec/gdm-wayland-session[5394]: 02:33:33.087 [DEBUG] [sway/desktop/xwayland.c:704] New xwayland surface title='(null)' class='(null)'
Mar 01 10:41:40 nazarewk-krul /nix/store/98sf58748yqq51197whkqc4ik0sr2mmh-gdm-41.3/libexec/gdm-wayland-session[5394]: 02:33:33.088 [DEBUG] [wlr] [xwayland/xwm.c:833] unhandled X11 property 492 (XSEL_DATA) for window 46137345
Mar 01 10:41:40 nazarewk-krul /nix/store/98s
@nazarewk
nazarewk / README.md
Last active March 1, 2022 10:09
Sway SIGSEGV
@nazarewk
nazarewk / gist:271137f901a6ef501cdfbf698a0c9b4b
Created January 11, 2022 08:59
Sway logs for xwayland mouse events bug report
Jan 11 09:57:09 nazarewk sway[3125]: 01:03:52.567 [DEBUG] [sway/desktop/xwayland.c:686] New xwayland surface title='(null)' class='(null)'
Jan 11 09:57:09 nazarewk sway[3125]: 01:03:52.567 [DEBUG] [wlr] [xwayland/selection/outgoing.c:375] XCB_SELECTION_REQUEST (time=3882857 owner=2097153, requestor=33554433 selection=275, target=254, property=497)
Jan 11 09:57:09 nazarewk sway[3125]: 01:03:52.567 [DEBUG] [wlr] [xwayland/selection/outgoing.c:296] Sending Wayland selection 254 to Xwayland window with MIME type text/plain;charset=utf-8, target 254, transfer 0x14bccd0
Jan 11 09:57:09 nazarewk sway[3125]: 01:03:52.567 [DEBUG] [wlr] [xwayland/selection/outgoing.c:215] Starting transfer 0x14bccd0
Jan 11 09:57:09 nazarewk sway[3125]: 01:03:52.568 [DEBUG] [wlr] [xwayland/selection/outgoing.c:92] read 168 bytes (available 65536, mask 0x1)
Jan 11 09:57:09 nazarewk sway[3125]: 01:03:52.568 [DEBUG] [wlr] [xwayland/selection/outgoing.c:145] nothing happened, buffered the bytes
Jan 11 09:57:09 nazarewk sway[3125]: 01:03:52.