Skip to content

Instantly share code, notes, and snippets.

View risicle's full-sized avatar

Robert Scott risicle

View GitHub Profile
@risicle
risicle / gist:2b87aedcdf3bb59fa4fbd245228ea070
Created August 21, 2022 22:13
flask-restful test failure
_________________ APITestCase.test_exception_header_forwarded __________________
self = <tests.test_api.APITestCase testMethod=test_exception_header_forwarded>
def test_exception_header_forwarded(self):
"""Test that HTTPException's headers are extended properly"""
app = Flask(__name__)
app.config['DEBUG'] = True
api = flask_restful.Api(app)
sum by (instance) (rate(http_server_request_duration_seconds_sum{org="digitalmarketplace", space="$space", job=~"$app(-release)?"}[1m]))
#!/bin/bash
ALL_ATTRS_NIX=$(mktemp)
PKGS_PATH="."
#NIX_SYSTEM="x86_64-linux"
cat > "$ALL_ATTRS_NIX" <<EOF
{}@args: let pkgs = (import $(realpath "$PKGS_PATH") args); in with pkgs; builtins.filter (x: x != null) (builtins.map (x: if (builtins.tryEval x.drvPath).success then x else null) [
EOF
@risicle
risicle / src-inspector.nix
Last active June 3, 2025 19:22
src-inspector.nix - related to https://github.com/NixOS/nixpkgs/pull/179845 but more specialized to native binary sniffing
# nix-build -E 'let pkgs = import ./. {}; lib = pkgs.lib; attrList = builtins.fromJSON (builtins.readFile ./attrs.json); in pkgs.callPackage ./src-inspector.nix { toInspect = (lib.genAttrs attrList (x: lib.attrByPath (lib.splitString "." x) {} pkgs)); }'
# given a json array (attrs.json) of dotted attr paths
{ lib, stdenv, dpkg, unzip, toInspect }:
builtins.mapAttrs (
name: value: let
dp = builtins.tryEval value.drvPath or null;
res = if dp.success && dp.value != null then builtins.tryEval value.src or null else dp;
in if !(value.dontUnpack or false)
@risicle
risicle / _flapackmodule.c
Created March 11, 2022 22:50
scipy flapack intermediate files generated with numpy 468142495461319f06a8debf57a3c0aa2703f9df (bad)
This file has been truncated, but you can view the full file.
/* File: _flapackmodule.c
* This file is auto-generated with f2py (version:1.21.99).
* f2py is a Fortran to Python Interface Generator (FPIG), Second Edition,
* written by Pearu Peterson <[email protected]>.
* Generation date: Fri Feb 4 14:45:41 2022
* Do not edit this file directly unless you know what you are doing!!!
*/
#ifdef __cplusplus
extern "C" {
@risicle
risicle / _flapackmodule.c
Created March 11, 2022 22:45
scipy flapack intermediate files generated with numpy 26e656e7989e776a9292b9eba88cef7ec9fec5cb (good)
This file has been truncated, but you can view the full file.
/* File: _flapackmodule.c
* This file is auto-generated with f2py (version:1.21.99).
* f2py is a Fortran to Python Interface Generator (FPIG), Second Edition,
* written by Pearu Peterson <[email protected]>.
* Generation date: Fri Feb 4 14:45:41 2022
* Do not edit this file directly unless you know what you are doing!!!
*/
#ifdef __cplusplus
extern "C" {
#0 dlar1v (n=10, b1=1, bn=10, lambda=6.206329040168803e-15, d=..., l=..., ld=..., lld=..., pivmin=2.2250738585072014e-308, gaptol=0, z=..., wantnc=.TRUE., negcnt=0, ztz=<optimized out>, mingma=6.3108872417680944e-30, r=8, isuppz=..., nrminv=3.6057425056094288, resid=1.4901161193847656e-08, rqcorr=2.0984948872810358, work=...)
at dlar1v.f:405
#1 0x0000000017cc6ed9 in dlarrv (n=10, vl=-0.34647963093462386, vu=3.6057425056094288, d=..., l=..., pivmin=2.2250738585072014e-308, isplit=..., m=10, dol=1, dou=10, minrgp=0.001, rtol1=1.4901161193847656e-08, rtol2=7.4505805969238283e-11, w=..., werr=..., wgap=..., iblock=..., indexw=..., gers=..., z=..., ldz=10, isuppz=...,
work=..., iwork=..., info=0) at dlarrv.f:875
#2 0x0000000017d40767 in dstemr (jobz=..., range=..., n=10, d=..., e=..., vl=0, vu=1, il=1, iu=10, m=10, w=..., z=..., ldz=10, nzc=10, isuppz=..., tryrac=.FALSE., work=..., lwork=330, iwork=..., liwork=100, info=0, _jobz=1, _range=1) at dstemr.f:669
#3 0x0000000017d005df in dsyevr (jobz=..., r
#0 0x00000000174ef025 in dlar1v_ () from /nix/store/413dlxvbzrsfaakf00ffsgw7f1qapx3f-lapack-3/lib/liblapack.so.3
#1 0x00000000174f5ed9 in dlarrv_ () from /nix/store/413dlxvbzrsfaakf00ffsgw7f1qapx3f-lapack-3/lib/liblapack.so.3
#2 0x000000001756f767 in dstemr_ () from /nix/store/413dlxvbzrsfaakf00ffsgw7f1qapx3f-lapack-3/lib/liblapack.so.3
#3 0x000000001752f5df in dsyevr_ () from /nix/store/413dlxvbzrsfaakf00ffsgw7f1qapx3f-lapack-3/lib/liblapack.so.3
#4 0x00000000273b45e1 in f2py_rout.flapack_dsyevr () from /nix/store/gmcby9wc7c5agdilcqq8ngzvn0psz2gy-python3.9-scipy-1.8.0/lib/python3.9/site-packages/scipy/linalg/_flapack.cpython-39-x86_64-linux-gnu.so
#5 0x0000000004906aa9 in _PyObject_Call (kwargs=<optimized out>, args=(), callable=<fortran at remote 0x13e90720>, tstate=0x50589e0) at Objects/call.c:281
#6 PyObject_Call (callable=<fortran at remote 0x13e90720>, args=(), kwargs=<optimized out>) at Objects/call.c:293
#7 0x00000000048bbe0d in do_call_core (kwdict={'a': <numpy.ndarray at remote 0x40eb8900>,
@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 / word2vec.fail
Last active September 17, 2020 22:18
macos 10.14 failures
=================================== FAILURES ===================================
____________________________ test_run_word2clusters ____________________________
@pytest.mark.data
def test_run_word2clusters():
> word2vec.word2clusters(input_text, output_clusters, 10)
word2vec/tests/test_core.py:45:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
word2vec/scripts_interface.py:182: in word2clusters