Its contents have been moved to the NixOS wiki here, where they are being kept up to date. Please follow the instructions there instead!
The original post is below for posterity.
#!/bin/sh | |
# | |
PING="/sbin/ping" | |
PACKET_SIZE=64 | |
PACKET_COUNT=10 | |
PING_INTERVAL=1 | |
TIMEOUT=2 | |
BASE_COST=200 |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys, time, threading, abc | |
from optparse import OptionParser | |
def parse_options(): | |
parser = OptionParser() | |
parser.add_option("-t", action="store", type="int", dest="threadNum", default=1, | |
help="thread count [1]") |
Its contents have been moved to the NixOS wiki here, where they are being kept up to date. Please follow the instructions there instead!
The original post is below for posterity.
newServer('127.0.0.1:4201') | |
addLocal('127.0.0.1:53') | |
addLocal('10.1.0.1:53', true, true, 0) | |
addLocal('203.0.113.42:53', true, true, 0) | |
setACL('0.0.0.0/0') | |
internalDomains = newSuffixMatchNode(); | |
internalDomains:add(newDNSName("alpha.example.com.")) | |
internalDomains:add(newDNSName("beta.example.com.")) | |
addAction(RegexRule('^(alpha|beta)\\.example\\.com$'), AllowAction()) | |
addAction(AndRule({NotRule(makeRule('10.0.0.0/8')), SuffixMatchNodeRule(internalDomains)}), RCodeAction(dnsdist.REFUSED)) |
fix
function - https://github.com/NixOS/nixpkgs/blob/9f087964709174424bca681b600af8ee8e763df5/lib/fixed-points.nix#L19 , https://en.m.wikipedia.org/wiki/Fixed_point_(mathematics) , point where x = f(x) = f(f(f(f....f(x)....)))
rec { a = 1; b = a + 1; }
is the same as fix (self: { a = 1; b = self.a + 1; })
builtins.trace
- https://github.com/NixOS/nixpkgs/blob/9f087964709174424bca681b600af8ee8e763df5/lib/debug.nix#L4 trace has different flavors, http://hackage.haskell.org/package/base-4.12.0.0/docs/Debug-Trace.html#v:trace all lazy languages have trace
builtins.seq
- in lazy languages data is represented as thunks (IF data has not been yet evaluated THEN it's pointer on function that should produce this data ELSE it's pointer on data), builtins.seq
forces first layer of data to evaluate (evaluates it to WHNF?), builtins.deepSeq
is recursive variant of seq
, it forces whole data to evaluate (evaluates it to NF?), (more https://wiki.haskell.org/Seq, https://www.google.com/amp/s/amp.reddit.