Skip to content

Instantly share code, notes, and snippets.

View risicle's full-sized avatar

Robert Scott risicle

View GitHub Profile
@risicle
risicle / extra-binfmt-flags.nix
Last active June 16, 2024 11:51
nixpkgs overlay for supplying extra flags to the qemu used in nixos' `boot.binfmt.emulatedSystems`. Note these specific flags used in this example are architecture-specific, but the flags are applied globally so this wouldn't work if emulating multiple architectures at once on the same system.
(final: prev: {
wrapQemuBinfmtP = name: emulator:
prev.wrapQemuBinfmtP name (
pkgs.runCommand "${name}-arg-wrapper" {
nativeBuildInputs = [ final.pkgsStatic.makeBinaryWrapper ];
} ''
makeWrapper ${emulator} $out --add-flags '-cpu max,pauth-impdef=on'
''
);
})
@risicle
risicle / hash_agg.sql
Last active June 4, 2024 12:37
Rolling-hash aggregator for PostgreSQL, allowing fast exact comparison of columns across tables/databases
CREATE FUNCTION hash_agg_tfunc(bytea, anyelement) RETURNS bytea AS $$
SELECT sha256(convert_to($2::text, 'UTF8') || $1)
$$ LANGUAGE SQL;
CREATE AGGREGATE hash_agg (anyelement) (
sfunc = hash_agg_tfunc,
stype = bytea,
initcond = '{}'
);
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: python3.11 [11605]
Path: /Volumes/VOLUME/*/python3.11
Identifier: python3.11
Version: ???
Code Type: ARM-64 (Native)
Parent Process: Exited process [11324]
{ lib
, stdenvNoCC
, fetchFromGitHub
, awscli
, coreutils
, makeWrapper
, gnugrep
, gnused
, jq
, which
=================================== FAILURES ===================================
______________________________ test_verify_cases _______________________________
[gw12] linux -- Python 3.11.7 /nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/bin/python3.11
lib/python3.11/site-packages/scipy/linalg/tests/test_decomp_polar.py:89: in test_verify_cases
verify_polar(a)
a = [[1, 2, 3]]
lib/python3.11/site-packages/scipy/linalg/tests/test_decomp_polar.py:77: in verify_polar
evals = eigh(p, eigvals_only=True)
a = [[1, 2, 3]]
aa = array([[1, 2, 3]])
@risicle
risicle / netplan2nixos.jq
Created November 18, 2023 22:03
`jq` script to convert a netplan config file (converted from yaml) to nixos-importable json. Does not support all netplan features obviously.
{
systemd: {
network: {
netdevs: (
.network.ethernets | with_entries(.value |= {
netdevConfig: {Name: ."set-name"},
matchConfig: {MACAddress: .match.macaddress}
})
)
}
services.postgresql = {
enable = true;
enableTCPIP = true;
ensureDatabases = [
"concourse"
];
ensureUsers = [
{
name = "concourse";
ensurePermissions = {
unpacking sources
unpacking source archive /nix/store/mw664kgniq3ch73i66zlgbg7krksizlp-source
source root is source
patching sources
updateAutotoolsGnuConfigScriptsPhase
configuring
no configure script, doing nothing
building
build flags: SHELL=/nix/store/a7f7xfp9wyghf44yv6l6fv9dfw492hd3-bash-5.2-p15/bin/bash
[CC] buffer.o
unpacking sources
unpacking source archive /nix/store/ydb6n6fghhx32izg0pdk8x0bkrmnd61k-source
source root is source
patching sources
updateAutotoolsGnuConfigScriptsPhase
Updating Autotools / GNU config script to a newer upstream version: ./nng/extern/msquic/submodules/openssl/krb5/src/config/config.sub
Updating Autotools / GNU config script to a newer upstream version: ./nng/extern/msquic/submodules/openssl/krb5/src/config/config.guess
configuring
fixing cmake files...
cmake flags: -GNinja -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/csi69820lpy04q1rc610qkm3k7cxs7i8-nanomq-0.18.2/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/csi69820lpy04q1rc610qkm3k7cxs7i8-nanomq-0.18.2/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/csi69820lpy04q1rc610qkm3k7cxs7i8-nanomq-0.18.2/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/csi69820lpy04q1rc610qkm3k7cxs7i8-nanomq-0.18.2/share
unpacking sources
unpacking source archive /nix/store/m51ns7p2rjn91lzr1021b05z57176d3y-root_v5.34.38.source.tar.gz
source root is root
setting SOURCE_DATE_EPOCH to timestamp 1520866180 of file root/etc/gitinfo.txt
patching sources
applying patch /nix/store/xzi1l7qs3ms4bsc1qnrsjv723rv0frdn-sw_vers_root5.patch
patching file build/unix/compiledata.sh
patching file cmake/modules/SetUpMacOS.cmake
patching file config/root-config.in
patching file cint/ROOT/CMakeLists.txt