Skip to content

Instantly share code, notes, and snippets.

View pmenke-de's full-sized avatar

Philipp Menke pmenke-de

  • Germany
View GitHub Profile
@pmenke-de
pmenke-de / Json-Regex.md
Last active January 31, 2025 07:30
Extract json documents using RegEx

Taken from this amazing answer and condensed to a one-line grep:

grep -Po '(?(DEFINE)(?<ws>[\t\n\r ]*)(?<number>-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[Ee][+-]?\d++)?)(?<boolean>true|false|null)(?<string>"(?:[^\\"\x00-\x1f]|\\["\\bfnrt\/]|\\u[0-9A-Fa-f]{4})*")(?<pair>(?&ws)(?&string)(?&ws):(?&value))(?<array>\[(?:(?&value)(?:,(?&value))*)?(?&ws)\])(?<object>\{(?:(?&pair)(?:,(?&pair))*)?(?&ws)\})(?<value>(?&ws)(?:(?&number)|(?&boolean)|(?&string)|(?&array)|(?&object))(?&ws)))(?&object)'

Useful for grepping mixed logs, extrating JSON and then processing it with jq

@pmenke-de
pmenke-de / OuterClass.java
Last active September 12, 2023 10:00
Lombok @with record issue
package de.pmenke.test;
import lombok.With;
public class OuterClass<V> {
private InnerRecord rec;
@With
/* static */ record InnerRecord(int aComponent) {}
/* without `static` running `mvn clean install` results in
@pmenke-de
pmenke-de / README.md
Last active May 10, 2024 09:54 — forked from chpatrick/nix-cmake
Using CLion with Nix

let's say you have a C++ project in Nix that you want to work on with CLion so that the nix dependencies are available.

  1. create a .nix utility directory in your project directory.
  2. put the below nix-run.sh and nix-cmake.sh in the .nix directory.
  3. in the .nix directory create symlinks for make, gcc, g++ - and maybe more tools, that need to have the nix dependencies and build tools available - and point them to nix-run.sh
  4. then, in Settings -> Build, Execution, Deployment -> Toolchains set CMake to the path to nix-cmake.sh and point all other build tools to the symlinks you've created.