Skip to content

Instantly share code, notes, and snippets.

View flavorjones's full-sized avatar

Mike Dalessio flavorjones

View GitHub Profile
@flavorjones
flavorjones / README.md
Last active December 28, 2025 19:13
patch of mkdocs-material search plugin to support rdoc

I should really make this into a real plugin when I get time. But for now it will do.

@flavorjones
flavorjones / ci.yml
Created January 31, 2025 19:18
Using qemu and Docker for hardware emulation on Github Actions
jobs:
s390x: # run https://hub.docker.com/r/s390x/ubuntu under qemu
name: "s390x bigendian"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -v $PWD:/work -w /work \
--platform linux/s390x s390x/ubuntu:oracular \
#!/usr/local/bin/ruby
require 'rubygems'
require 'twitter'
require 'open-uri'
require 'nokogiri'
TARGET_USER = "aplusk"
TARGET_COUNT = 1_000_000
URL = "http://twitter.com/#{TARGET_USER}"
ID = '#follower_count'
@flavorjones
flavorjones / Makefile
Last active August 11, 2023 21:10
2023-08-11 reproduction of libxml2 encoding behavior changes
CFLAGS=$(shell ./local/bin/xml2-config --cflags)
LDFLAGS=$(shell ./local/bin/xml2-config --libs)
foo: foo.o
$(CC) -o foo foo.o $(LDFLAGS)
foo.o: foo.c
$(CC) $(CFLAGS) -c -o foo.o foo.c
clean:
#! /usr/bin/env ruby
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "builder"
gem "nokogiri"
gem "benchmark-ips"
end
@flavorjones
flavorjones / Makefile
Last active April 30, 2023 13:05
repro of libxml2 memory leak in v2.11.0
CFLAGS=$(shell ./local/bin/xml2-config --cflags)
LDFLAGS=$(shell ./local/bin/xml2-config --libs)
foo: foo.o
$(CC) -o foo foo.o $(LDFLAGS)
foo.o: foo.c
$(CC) $(CFLAGS) -c -o foo.o foo.c
clean:
@flavorjones
flavorjones / redos-radar.rb
Created May 9, 2022 12:36
rough script to examine Ruby regexp literals with https://makenowjust-labs.github.io/recheck/
#! /usr/bin/env ruby
# coding: utf-8
# Copyright 2022 Mike Dalessio
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
CFLAGS = -std=c89
default: run
benchmark-O0.o: benchmark.c
$(CC) -O0 $(CFLAGS) -c -o benchmark-O0.o benchmark.c
lib-O0.o: lib.c
$(CC) -O0 $(CFLAGS) -c -o lib-O0.o lib.c
# String Encoding, Nokogiri and You: A Primer
## First: A Few Thing To Consider
1. It is common for HTML pages to declare
1. Without information instructing it differently, Nokogiri's core library ([libxml2][]) will
[libxml2]: http://xmlsoft.org/
[meta-bug]: https://bugzilla.gnome.org/show_bug.cgi?id=579317