Skip to content

Instantly share code, notes, and snippets.

View risicle's full-sized avatar

Robert Scott risicle

View GitHub Profile
services.postgresql = {
enable = true;
enableTCPIP = true;
ensureDatabases = [
"concourse"
];
ensureUsers = [
{
name = "concourse";
ensurePermissions = {
@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}
})
)
}
=================================== 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]])
{ lib
, stdenvNoCC
, fetchFromGitHub
, awscli
, coreutils
, makeWrapper
, gnugrep
, gnused
, jq
, which
-------------------------------------
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]
@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 = '{}'
);
@risicle
risicle / extra-binfmt-flags.nix
Last active December 19, 2024 22:21
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'
''
);
})