Skip to content

Instantly share code, notes, and snippets.

View risicle's full-sized avatar

Robert Scott risicle

View GitHub Profile
{ lib, stdenv, buildGoModule, aws-vault, makeWrapper, yubikey-manager, git }:
buildGoModule rec {
pname = "gds-cli";
version = "5.94.0";
src = (builtins.fetchGit {
url = "ssh://git@github.com/alphagov/gds-cli.git";
ref = "v${version}";
rev = "354c379f86cbbed230456bebb8087632aa56e2aa";
allRefs = true;
{ 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
@risicle
risicle / netplan-to-nixos.jq
Created May 2, 2021 21:18
jq expression to turn netplan yaml configs into nixos network configurations, supporting bonding and vlans
{
systemd: {
network: {
netdevs: (
.network.ethernets | with_entries(.value |= {
netdevConfig: {Name: ."set-name"},
matchConfig: {MACAddress: .match.macaddress}
})
)
}
@risicle
risicle / cache_chained_calculation.py
Created March 17, 2016 16:54
Django cache work-sharing using PostgreSQL advisory locks
from django.core.cache import cache
from django.core.cache.backends.base import DEFAULT_TIMEOUT
from django.db import connection , transaction
from hashlib import md5
def cache_chained_calculation(characteristic_str, calculate_function, timeout=DEFAULT_TIMEOUT, force_update=False):
"""
Attempt to obtain result of @calculate_function, represented by @characteristic_str, through cache or calling the
function. Should only allow one caller to be calculating the value at once (enforced using postgres advisory locks),