Skip to content

Instantly share code, notes, and snippets.

View oowekyala's full-sized avatar

Clément Fournier oowekyala

View GitHub Profile
@oowekyala
oowekyala / BenchmarkPmd.java
Created November 7, 2025 16:31
Wrapper for PMD to run some warmup iterations and dump timing numbers to stdout. Drop this in the pmd-cli module.
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cli;
import org.apache.commons.lang3.ArrayUtils;
public class BenchmarkPmd {
public static void main(String[] args) {
@oowekyala
oowekyala / justfile
Last active November 28, 2025 16:02
PMD justfile
# Justfile
# Convenience recipes for developers of PMD
#
# Just documentation: https://github.com/casey/just
commonBuildOpts := "-Dmaven.javadoc.skip -Dkotlin.compiler.incremental -Dmaven.source.skip -Pcentral-portal-snapshots"
# Regenerate sources for the Java module
genJavaAst:
rm -f pmd-java/target/last-generated-timestamp-*
@oowekyala
oowekyala / util.zsh
Created January 14, 2024 16:41
PATH manipulation functions, put into rc file
# Prepend a segment to the path (takes priority).
prepend_PATH() {
export PATH="$1:$PATH"
}
# Append something to your PATH (current PATH takes priority).
append_PATH() {
export PATH="$PATH:$1"
}
@oowekyala
oowekyala / MLIRLexer.py
Last active August 7, 2025 10:14
MLIR Pygments lexer, can be used with the minted package for LaTeX
# Pygments lexer for MLIR.
# Authors: Karl F. A. Friebel (@KFAFSP), Clément Fournier (@oowekyala)
# Usage: pygmentize -x -l ./MLIRLexer.py:MLIRLexer file.mlir
#
# MIT License
#
# Copyright (c) 2025 Clément Fournier, Karl F. A. Friebel
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@oowekyala
oowekyala / foo.sh
Created December 6, 2023 14:14
PATH manipulation functions for your shell
prepend_PATH() {
export PATH="$1:$PATH"
}
append_PATH() {
export PATH="$PATH:$1"
}
# Delete some part of the path
# https://unix.stackexchange.com/questions/108873/removing-a-directory-from-path
import net.sf.saxon.Configuration;
import net.sf.saxon.expr.Expression;
import net.sf.saxon.expr.LocalVariableReference;
import net.sf.saxon.om.StructuredQName;
import net.sf.saxon.sxpath.IndependentContext;
import net.sf.saxon.sxpath.XPathEvaluator;
import net.sf.saxon.sxpath.XPathExpression;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.value.BooleanValue;
import net.sf.saxon.value.SequenceType;
@oowekyala
oowekyala / Java.xml
Created January 18, 2022 18:09
pmd extension descriptor draft
<!-- xmlns and stuff -->
<language id="java" displayName="Java">
<versions>
<version id="13" displayName="Java 13" />
<version id="15" displayName="Java 15" />
</versions>
<parser class="...JavaParser"/>
<violationSuppressor class="...JavaViolationSuppressor"/>
@oowekyala
oowekyala / Set2.java
Created July 30, 2021 21:56
An unmodifiable set of 2 elements, with predictable iteration order.
import java.util.*;
/**
* A set of 2 elements. Unfortunately, {@link Set#of(Object, Object)}
* does not guarantee stable iteration order across JVM
* instances.
*/
public final class Set2<T> extends AbstractSet<T> {
private final T e0;
@oowekyala
oowekyala / gist:bd261748029530231a18f365f418d544
Created July 19, 2021 16:05
Install contents of texlive-fonts-recommended using tlmgr directly
tlmgr install avantgar bookman charter cmextra courier ec euro euro-ce eurosym fpl helvetic lm-math marvosym mathpazo ncntrsbk palatino pxfonts refs symbol times txfonts utopia wasy wasysym zapfchan zapfding
@oowekyala
oowekyala / bfc.scala
Last active June 14, 2020 23:05
Brainfuck to C "optimizing compiler"
#!/bin/sh
exec scala "$0" "$@"
!#
/*
A compiler from Brainfuck to C, with some peephole optimizations.
Usage (no compilation required):
./bfc.scala -f <brainfuck source file> -o <output file name> (<gcc flag>)*