Skip to content

Instantly share code, notes, and snippets.

Naming Conventions in Code

Verify

Tests if some subject (object or data) passes the correctness definition for some type. Returns true if the test passes, and false otherwise.

Validate

Tests if some subject (object or data) passes the correctness definition for some type. Throws an exception if the subject did not pass the test. The test is not required to return any meainingful value if the test pases.

@dhl
dhl / nixos-install-encrypted-root.sh
Created October 31, 2018 02:41 — forked from sveitser/nixos-install-encrypted-root.sh
Installs nixos on encrypted root from live CD.
#!usr/bin/env bash
#
# Installs nixos with full disk encrypted root partition.
#
# - Prompts for password initially, after that no interaction should
# be required.
# - At the end it will prompt for a root password, could not make
# echo-ing it into nixos-install work.
# - Reserves 550MB for boot partition, rest for the root volume.
# - After booting, log in as root user and set password for normal user.
@dhl
dhl / default.nix
Last active April 3, 2019 02:19
Compiling rust against musl target with Nix. Adapted from https://github.com/mozilla/nixpkgs-mozilla/issues/91#issuecomment-464483970
{ pkgsPath ? <nixpkgs>, crossSystem ? null }:
let
mozOverlay = import (
builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz
);
pkgs = import pkgsPath {
overlays = [ mozOverlay ];
inherit crossSystem;
};
======================================================================
ERROR: test_run_hello_workflow_incompatible_0_request_through_stdin (tests.functional.test_cli.TestCliWithHelloWorkflow)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/nix/store/8h7vxyym56zxf03bb3w8dwifr9pv2pan-python2.7-parameterized-0.7.0/lib/python2.7/site-packages/parameterized/parameterized.py", line 518, in standalone_func
return func(*(a + p.args), **p.kwargs)
File "/build/source/tests/functional/test_cli.py", line 149, in test_run_hello_workflow_incompatible
p = subprocess.Popen([self.command_name], env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
File "/nix/store/gy3r9y4rvs7rlxm88az4lxqsrr2020f2-python-2.7.15/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
#!/usr/bin/perl
$f = $ARGV[0];
$pagestart = 0;
$charstart = 0;
$kernstart = 0;
$s = "<?xml version=\"1.0\"?>\n<font>\n";
open(F, $f);