Skip to content

Instantly share code, notes, and snippets.

@tstack
tstack / mark-error.lnav
Created September 16, 2020 03:35
lnav script to mark error messages and an immediately preceding "good" message
#
# @synopsis: mark-error "GoodMsg" "BadMsg"
# @description: Find instances of "BadMsg", then bookmark it and the preceding "GoodMsg"
#
;WITH badlines AS (
-- Select the bad and good line numbers from the for the "BadMsg" log messages
-- that were found
SELECT badline, goodline FROM (
-- Find the log messages that contain "GoodMsg" or "BadMsg"
@tstack
tstack / builder.cpp
Last active November 2, 2021 05:55
Experiment in making a generic builder function for C++ types
/*
* An experiment in creating a generic builder for C++.
*
* This is inspired by the following post:
*
* https://marcoarena.wordpress.com/2021/10/25/the-self-growing-builder/
*
* The changes from the post are that the tag structs are used to hold
* the argument values and there is a single generic builder function
* that accepts the tag structs. These changes remove a lot of the