Skip to content

Instantly share code, notes, and snippets.

View sparr's full-sized avatar

Clarence "Sparr" Risher sparr

  • Amazon
  • Whitinsville, MA, USA
View GitHub Profile
sparr / gist:008ebfab065bd00c3dd903fa43b9ad55
Created June 13, 2023 16:29
golang proposal for standard tag functionality for json, toml, yaml, etc
This gist is to preserve this proposal draft while I pursue alternate proposals first.
Currently if a package wants to define a struct that can be loaded from arbitrary config files, with encoded/serialized/markup field names different from the struct field names (e.g. changing "FooBar" to "foo_bar" to match conventions, "Miscellaneous" to "misc" for brevity, etc), the package must add separate struct tags for json, toml, yaml, etc. Any encoding not specifically enumerated in the tags will either fall back to using the struct fields directly, or have to implement parsing of another encoding's tags.
While these different encoding packages offer some unique functionality, such as go-yaml's `inline`, encoding/json's `string`, and go-toml's `multiline`, they all share common functionality of specifying the key name and the `omitempty` flag. For use cases where that subset of functionality is sufficient, it would be convenient if most or all of the markup/encoder/serializer/marshaler/etc packages supported a com
sparr / test.vue
Last active February 21, 2023 20:11
vue file illustrating github syntax highlight bug
<b v-if="c?.d" />
sparr /
Last active December 11, 2022 21:03
Bash script to rename/symlink SkyrimSELauncher.exe and skse64_loader.exe to enable/disable SKSE for launch via Steam.
# This script manipulates SkyrimSELauncher.exe and skse64_loader.exe so that
# tools like Steam that expect to run SkyrimSELauncher.exe will transparently
# run skse64_loader.exe instead.
# When SKSE is "enabled", SkyrimSELauncher.exe will have been renamed to
# SkyrimSELauncher.exe.orig and replaced with a symlink to skse64_loader.exe
# When SKSE is "disabled", that symlink will be named SkyrimSELauncher.exe.skse
sparr / Xorg.0.log
Created January 4, 2021 00:14
computer hard lockup, usually in cpu/gpu intensive activities, this time while video editing
[ 4.659]
X.Org X Server 1.20.10
X Protocol Version 11, Revision 0
[ 4.659] Build Operating System: Linux Manjaro Linux
[ 4.659] Current Operating System: Linux shaggy 5.8.18-1-MANJARO #1 SMP PREEMPT Sun Nov 1 14:10:04 UTC 2020 x86_64
[ 4.659] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.8-x86_64 root=UUID=fd2098fb-01b7-4272-be32-a908fd3a2eb5 rw quiet resume=UUID=42821bc8-4cb6-4897-8e37-fad6b3492e9e udev.log_priority=3
[ 4.659] Build Date: 03 December 2020 08:59:12AM
[ 4.659]
[ 4.659] Current version of pixman: 0.40.0
[ 4.659] Before reporting problems, check
sparr / journalctl -xe
Created November 13, 2020 16:37
iwlwifi microcode error on arch linux on dell latitude 7390
This is an excerpt showing approximately two cycles, it repeats indefinitely with minor differences as long as wifi is enabled.
Nov 13 07:37:02 shaggy kernel: iwlwifi 0000:02:00.0: Queue 3 is stuck 16 73
Nov 13 07:37:02 shaggy kernel: iwlwifi 0000:02:00.0: Microcode SW error detected. Restarting 0x0.
Nov 13 07:37:02 shaggy kernel: iwlwifi 0000:02:00.0: Start IWL Error Log Dump:
Nov 13 07:37:02 shaggy kernel: iwlwifi 0000:02:00.0: Status: 0x00000040, count: 6
Nov 13 07:37:02 shaggy kernel: iwlwifi 0000:02:00.0: Loaded firmware version: 55.d9698065.0 cc-a0-55.ucode
Nov 13 07:37:02 shaggy kernel: iwlwifi 0000:02:00.0: 0x00000084 | NMI_INTERRUPT_UNKNOWN
Nov 13 07:37:02 shaggy kernel: iwlwifi 0000:02:00.0: 0x000022F0 | trm_hw_status0
Nov 13 07:37:02 shaggy kernel: iwlwifi 0000:02:00.0: 0x00000000 | trm_hw_status1
sparr / dice_to_card.pseudocode
Created May 2, 2020 18:25
Convert 3d6 to a playing card
# original idea and base logic from
dice_to_card(a,b,y) {
suits = {2:'H', 3:'C', 4:'D', 5:'S'}
if (y>1 and y<6) {
# number cards
rank = ceil(a/2) + (ceil(b/2)-1)*3
if rank==1 rank = 10
return rank, suits[y]
elif ((a==1 or a==6) and (b==1 or b==6)) {
sparr / gist:25f14355a291ff1036f21856104a7bb9
Created February 14, 2020 02:44
Debugging early function exit with gdb
Breakpoint 11 at 0x5555557490ec: file ../src/app/commands/cmd_frame_tag_properties.cpp, line 100.
(gdb) c
Thread 1 "aseprite" hit Breakpoint 10, app::FrameTagPropertiesCommand::onExecute (this=<optimized out>, context=<optimized out>) at ../src/app/commands/cmd_frame_tag_properties.cpp:98
98 tx(new cmd::SetTagName(tag, name));
(gdb) list
93 Tx tx(writer.context(), friendlyName());
94 Tag* tag = const_cast<Tag*>(foundTag);
96 std::string name = window.nameValue();
97 if (tag->name() != name)
sparr / gist:ae107533d427360d5cca26268378691e
Created September 10, 2019 19:25
reddit profile post silent failure
Request URL:
Request Method: POST
Status Code: 200
Remote Address:
Referrer Policy: origin
accept-ranges: bytes
cache-control: private, s-maxage=0, max-age=0, must-revalidate, max-age=0, must-revalidate
content-length: 245
content-type: application/json; charset=UTF-8
date: Tue, 10 Sep 2019 19:23:52 GMT
sparr / gist:ac4944172d2375cb8fdb38c448f001ee
Created April 27, 2019 01:23
Factorio universal belt balancer, 4x4 belts, 23x9 tiles