Skip to content

Instantly share code, notes, and snippets.

View johannes-riecken's full-sized avatar

Johannes Riecken johannes-riecken

View GitHub Profile
components:
requestBodies:
Shape:
content:
application/json:
schema:
$ref: '#/components/schemas/Shape'
schemas:
Circle:
properties:
openapi: 3.0.0
info:
title: "foo"
version: "0.0.1"
license:
url: "https://www.example.com"
name: "MIT"
servers:
- url: "http://localhost:8080"
paths:
@johannes-riecken
johannes-riecken / inline-java build log
Created December 2, 2022 08:27
inline-java fails to build on macOS Monterey (aarch64)
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/wbg1gz92d9vvp9kfv0j7jwnydqbz8sl7-bazel-3.7.2-dist.zip
source root is .
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
applying patch /nix/store/xms1dccbdpg8baylzl71ddm9zn36baqa-trim-last-argument-to-gcc-if-empty.patch
patching file tools/cpp/osx_cc_wrapper.sh.tpl
applying patch /nix/store/jwzbqr298z1d1n95pj14y6anrhr2lsaq-no-arc.patch
patching file tools/osx/xcode_locator.m
@johannes-riecken
johannes-riecken / addMissingOverrides.go
Created August 31, 2022 07:18
Add missing overrides using CodeQL
package main
import (
"bufio"
_ "embed"
"encoding/json"
"io/ioutil"
"log"
"os"
"strings"
@johannes-riecken
johannes-riecken / Tequilensor.hs
Created August 28, 2022 12:06
Vector is to Tensor as Tensor is to ...
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
import Data.Functor.Identity
import Data.Kind
import GHC.TypeLits
import Numeric.Fin -- from https://github.com/ekmett/numeric-fin/
@johannes-riecken
johannes-riecken / openbsd_function_frequency.txt
Created November 20, 2020 09:42
Frequency of C functions in OpenBSD's /usr/bin
424 free
324 strlen
323 fprintf
319 strcmp
265 exit
229 snprintf
228 printf
211 err
203 memset
189 malloc
@johannes-riecken
johannes-riecken / Integral.hs
Last active November 18, 2020 07:55
Integral using causal commutative arrows
import Control.Arrow
import Control.Arrow.Operations
import Control.Arrow.Transformer.All
import Data.Stream
frequency :: Int
frequency = 1024
exp :: StreamArrow (->) () Double
exp = fixA (integral >>> arr (+1))
@johannes-riecken
johannes-riecken / GoParser.g4
Last active November 11, 2020 08:35
Grammar that runs too slowly when converted to Perl6. See https://github.com/drforr/perl6-ANTLR4/issues/16
grammar GoParser;
sourceFile
: packageClause eos (importDecl eos)* ((functionDecl | methodDecl | declaration) eos)*
;
packageClause
: 'package' IDENTIFIER
;
@johannes-riecken
johannes-riecken / anagrams.xsl
Last active September 5, 2020 17:56
Anagram finder written in XSLT 1.0
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template name="sort">
<xsl:param name="w"/>
<!-- position in word -->
<xsl:param name="i" select="1"/>
<!-- position in output -->
<xsl:param name="j" select="1"/>
<xsl:param name="out"/>
<xsl:variable name="alpha" select="'01a02b03c04d05e06f07g08h09i10j11k12l13m14n15o16p17q18r19s20t21u22v23w24x25y26z'"/>
@johannes-riecken
johannes-riecken / urxvt_op_get_next.pl
Created August 21, 2020 19:46
Emulates bash's Ctrl-O for any console app
my $last_cmd = '';
my $up_cnt;
sub up {
if ($last_cmd ne 'up') {
$up_cnt = 0;
}
`sleep 0.2s;xte 'key Up'`;
$last_cmd = 'up';
$up_cnt++;