Skip to content

Instantly share code, notes, and snippets.

View bric3's full-sized avatar
💭
🤨

Brice Dutheil bric3

💭
🤨
View GitHub Profile
@bric3
bric3 / JaegerToPerfetto.java
Last active December 1, 2026 00:08
Convert Jaeger traces To Perfetto (Chrome Trace Event)
//JAVA 25
//DEPS com.google.code.gson:gson:2.15.0
// SPDX-License-Identifier: MPL-2.0
// https://mozilla.org/MPL/2.0/
// gist='https://gist.github.com/bric3/43912194b5ec4d611bd489d96c2c03dc'
// jbang trust add "$gist"
// jbang run "$gist" < opentelemetry.json > trace.perfetto.json
@bric3
bric3 / markdown-showcase.md
Last active October 27, 2026 13:24
Common mark show case, with github extensions

Markdown showcase

CommonMark

These examples use CommonMark syntax. Tables appear in the GitHub extensions section below.

Text, links, and inline code

A paragraph with italic text, bold text, bold italic text, and inline code.

@bric3
bric3 / ImportInterestingPulls.java
Created October 8, 2026 15:41
Save PR description with media content and PR patch
///usr/bin/env jbang --jdk-providers=mise "$0" "$@" ; exit $?
//JAVA 27
//PREVIEW
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
@bric3
bric3 / logPluginWhenApplied.kt
Created July 4, 2025 11:03
Quick and dirty way to print added plugin to a project
/**
* Print the plugin id or its class when plugin is added to the project.
*
* Example usage:
*
* ```kotlin
* subprojects {
* logPluginWhenApplied(this)
* }
* ```
@bric3
bric3 / ElfInterpreterReader.java
Last active July 1, 2025 11:25
Read the program header in an ELF binary. Based on `elf` man page.
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import java.nio.charset.StandardCharsets;
/**
* ELF64 Program Interpreter Reader.
* <p>
* Reads the PT_INTERP (program interpreter) section from a 64-bit ELF file.
* This assumes the ELF file is little endian, but ELF file can be either, see
@bric3
bric3 / synology-transmission-note.md
Last active April 27, 2025 10:02 — forked from samgooi4189/synology-transmission-note.txt
Synology transmission change username and password

The default credential is admin:admin.

  1. SSH into your synology
  2. Stop transmission : sudo synopkg start transmission
  3. Edit /var/packages/transmission/var/settings.json to change the username and password, make sure authentication is required, pssibly requires sudo.
{
    "rpc-authentication-required": true,
    "rpc-username": "...",
@bric3
bric3 / finicky.js
Last active November 9, 2026 16:20
Public finicky v4 / grinch config template
// @ts-check
/**
* @typedef {import('/Applications/Finicky.app/Contents/Resources/finicky.d.ts')} Globals
* @typedef {import('/Applications/Finicky.app/Contents/Resources/finicky.d.ts').FinickyConfig} FinickyConfig
*/
// Use https://finicky-kickstart.now.sh to generate basic configuration
// Learn more about configuration options: https://github.com/johnste/finicky/wiki/Configuration
@bric3
bric3 / svg-patch.gradle.kts
Last active October 21, 2024 13:07
SVG Patcher for gradle using Stax Approach (does not maintain order)
import java.io.StringWriter
import javax.xml.namespace.QName
import javax.xml.stream.XMLEventFactory
import javax.xml.stream.XMLInputFactory
import javax.xml.stream.XMLOutputFactory
import javax.xml.stream.events.Attribute
import javax.xml.stream.events.StartElement
tasks.register<GenerateDarkIconVariant>("patchSVG")
abstract class GenerateDarkIconVariant @Inject constructor(project: Project) : DefaultTask() {
@bric3
bric3 / CodeBlockNodeRenderer.kt
Last active May 6, 2024 14:01
HTML `JEditor` pane for IntelliJ (and markdown code snippet with highlighting), for pre `JBHtmlPane`
import com.intellij.lang.Language
import com.intellij.lang.documentation.DocumentationSettings
import com.intellij.lang.documentation.DocumentationSettings.InlineCodeHighlightingMode.NO_HIGHLIGHTING
import com.intellij.lang.documentation.DocumentationSettings.InlineCodeHighlightingMode.SEMANTIC_HIGHLIGHTING
import com.intellij.openapi.editor.HighlighterColors
import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.openapi.editor.richcopy.HtmlSyntaxInfoUtil
import com.intellij.openapi.fileTypes.PlainTextLanguage
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.text.StringUtil
/*
* DiscusToGiscus.java
*
* Copyright (c) 2021,today - Brice Dutheil <brice.dutheil@gmail.com>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
///usr/bin/env jbang "$0" ; exit $?