Skip to content

Instantly share code, notes, and snippets.

View sirn's full-sized avatar

Sirn Thanabulpong sirn

  • Tokyo, Japan
  • 03:32 (UTC +09:00)
View GitHub Profile
@sirn
sirn / zfs-fix-amx-context.patch
Created August 9, 2023 09:16
Fix AMX Context Saves/Restores on Sapphire Rapids
diff --git a/include/os/linux/kernel/linux/simd_x86.h b/include/os/linux/kernel/linux/simd_x86.h
index 660f0d42d..7e1f46e81 100644
--- a/include/os/linux/kernel/linux/simd_x86.h
+++ b/include/os/linux/kernel/linux/simd_x86.h
@@ -290,7 +290,7 @@ kfpu_begin(void)
*/
union fpregs_state *state = zfs_kfpu_fpregs[smp_processor_id()];
if (static_cpu_has(X86_FEATURE_XSAVE)) {
- kfpu_save_xsave(&state->xsave, ~0);
+ kfpu_save_xsave(&state->xsave, ~(XFEATURE_MASK_XTILE));
@sirn
sirn / README.md
Last active October 20, 2022 16:03
Gopls and the Rabbit Hole

Gopls and the Rabbit Hole

gopls v0.9.5 hangs when visiting a buffer when running under eglot under Mac GUI for some reason. Downgrading gopls to v0.9.4 make it works under eglot again. Naturally, I would assume this was a regression with gopls. git bisect indicates that the first "bad" commit was https://github.com/golang/tools/commit/cd31eaad03d53a18fa4b5e25b94d0b65e7380349, which means it should fail since v0.8.2, but for some reason installing via go install golang.org/x/tools/gopls@vX.Y.Z worked up to v0.9.4, even with go 1.19, and even v0.9.5 works fine when running under LSP client (Sublime Text).

In an attempt to find out if this code path was indeed an issue, I cloned the latest commit and attempt to stub out gopls/internal/vulncheck. Fortunately, this particular code were already stubbed out for go version older than 1.18, so removing this code was easy:

diff --git a/gopls/internal/vulncheck/command
@sirn
sirn / README.md
Last active October 7, 2022 17:53
Gopls failing under Eglot

Gopls failing under Eglot

Demostrating Gopls failing under Eglot v0.9.5.

Instructions

  1. Save init-eglot-test.el somewhere
  2. Save main.go at $PWD
  3. Run Emacs using:
  • GUI mode: /path/to/Emacs.app/MacOS/Emacs -Q -l test-eglot.el
@sirn
sirn / Makefile
Created March 25, 2020 15:12
Making Makefile Awesome
help:
@: # Print this help
@printf 'Usage: make TARGET\n\n'
@printf 'You must run make with one of the following targets to continue:\n'
@printf 'Run make VERBOSE=1 TARGET for verbose log.\n'
@awk ' \
/^[^\t:]+:/ { \
split($$0, s, ":"); \
cmd=s[1]; \
} /^\t@: #/ { \
@sirn
sirn / Makefile
Created March 13, 2020 08:35
amazing-makefile
help:
@: # Print this help
@printf 'Usage: make TARGET\n'
@awk ' \
/^[^\t:]+:/ { \
split($$0, s, ":"); \
cmd=s[1]; \
} /^\t@: #/ { \
split($$0, t, ": # "); \
body=t[2]; \
@sirn
sirn / 01_basic.md
Last active December 22, 2019 15:14
Ryzen 3900X coreinfo

Machine Info

Ryzen 9 3900X, C8H

qemu --version

QEMU emulator version 4.2.0
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
@sirn
sirn / README.md
Created July 31, 2019 08:26
Stop Intel Bluetooth from being an absolute shitshow

Fix Intel Bluetooth

Intel Bluetooth sometimes seems to stuck in a weird state where it cannot response to any command (e.g. Bug #1790454). Bluetooth will simply not working when this happens, and can only be fixed by unplugging the computer from any power source (reliable) or restart until it works (may took 5-10 tries for it to work).

This script simply try to unload the driver and reload it with an option to repeatly doing so (press R) until it started working. It is written for runit, so when used elsewhere you might want to replace sv stop and sv start lines to systemctl stop bluetooth.service and systemctl start bluetooth.service respectively.

@sirn
sirn / README.md
Last active February 7, 2019 03:45
OmiseGO eWallet Workshop
  1. Install Docker and docker-compose
  2. Copy docker-compose.yml somewhere in your machine.
  3. Run docker-compose up -d
  4. Run the following (in one line, without $):
$ docker exec -it docker-local_ewallet_1 env MIX_ENV=prod mix do local.hex --force, local.rebar --force, ecto.create, ecto.migrate, seed
  1. If ☝️ error, please try breaking into multple commands:
@sirn
sirn / omnifocus-capture.el
Created June 17, 2018 18:22 — forked from jrblevin/omnifocus-capture.el
Sending Tasks to OmniFocus from Emacs <http://jblevins.org/log/emacs-omnifocus>
;; Based on omnifocus-capture.el by Ken Case with the following original comment:
;;
;; To capture tasks from Emacs to OmniFocus using Control-C Control-O,
;; drop this script in your emacs load path and add lines like these to
;; your .emacs:
;;
;; (autoload 'send-region-to-omnifocus "omnifocus-capture" "Send region to OmniFocus" t)
;; (global-set-key (kbd "C-c C-o") 'send-region-to-omnifocus)
;;
;; The send-region-to-emacs function has been rewritten as follows:
(defun custom/winum-select-treemacs-or-window-0 ()
(interactive)
(-pcase (treemacs--current-visibility)
[`visible (treemacs-select-window)]
[`exists (treemacs-select-window)]
[`none (winum-select-window-0-or-10)]))