namerefs (introduced in bash 4.0) act as aliases for other variables
var=meow
declare -n ref=var
echo $ref # prints meow
ref=moo
echo $var # prints moonamerefs (introduced in bash 4.0) act as aliases for other variables
var=meow
declare -n ref=var
echo $ref # prints meow
ref=moo
echo $var # prints mooThis blog post is about the Linear Least Squares Problem. This method is credited back to Legendre and Gauss, some of my favorite mathematicians. Why are they such inspiring people? Here is a passage from a post that goes into more depth about Gauss's application of least squares:
The 24-year-old Gauss tackled the orbit problem, assuming only Kepler’s three laws of planetary motion, with his newly discovered error distributions and his method of least squares for three months. He spent over 100 hours performing intensive calculations by hand without any mistakes (and without the luxury of today’s computers!). He had to estimate the six parameters of the orbit (as shown in Figure 7) from only 19 data points, subject to random measurement errors. He even invented new techniques such as the Fast Fourier Transform for interpolating trigonometric series, which produced efficient numerical approximations o
| unpacking channels... | |
| error: infinite recursion encountered | |
| at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:256:21: | |
| 255| (regularModules ++ [ internalModule ]) | |
| 256| ({ inherit lib options config specialArgs; } // specialArgs); | |
| | ^ | |
| 257| in mergeModules prefix (reverseList collected); | |
| (use '--show-trace' to show detailed location information) |
| # Module for configuring libvirt with static NixOS networking | |
| # instead of using libvirt managed bridge. | |
| { config, lib, pkgs, ... }: | |
| with lib; | |
| let | |
| cfg = config.virtualisation.libvirtd.networking; | |
| v6Enabled = cfg.ipv6.network != null; | |
| v6PLen = toInt (elemAt (splitString "/" cfg.ipv6.network) 1); |
I wanted to write a module that generates multiple systemd services and timers to scrub some zfs pools at certain intervals. The default scrub config does not support individual scrub intervals for each pool.
I want the config to look like this:
{
services.zfs-auto-scrub = {
tank = "Sat *-*-* 00:00:00";This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.
Agree? Disagree? Feel free to let me know at @JanStette.
Keep it simple, stupid. You ain't gonna need it.
| [ | |
| { | |
| "depth":1, | |
| "nodes":8, | |
| "fen":"r6r/1b2k1bq/8/8/7B/8/8/R3K2R b KQ - 3 2" | |
| }, | |
| { | |
| "depth":1, | |
| "nodes":8, | |
| "fen":"8/8/8/2k5/2pP4/8/B7/4K3 b - d3 0 3" |
Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-goption.
| module Ova | |
| # autovivifying map from [class][method][signature] to Method | |
| @@Ova = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) } | |
| # Wrap #respond_to? for parity with Class#===. | |
| Responder = Struct.new(:method) do | |
| def === obj | |
| obj.respond_to?(method) | |
| end | |
| end |
| #!/bin/bash -eu | |
| LOG_FILE=$1 | |
| SB="stdbuf -i0 -oL" | |
| shift | |
| tput sc | |
| $@ 2>&1 | $SB tee $LOG_FILE | $SB cut -c-$(tput cols) | $SB sed -u 's/\(.\)/\\\1/g' | $SB xargs -0 -d'\n' -iyosi -n1 bash -c 'tput rc;tput el; printf "\r%s" yosi' | |
| EXIT_CODE=${PIPESTATUS[0]} | |
| tput rc;tput el;printf "\r" # Delete the last printed line | |
| exit $EXIT_CODE |