Did you know that it is rather easy to setup a VM to test your NixOs configuration?
# flake.nix
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";| { lib | |
| , stdenv | |
| , jdk | |
| , gradle | |
| , mavenRepo | |
| }: | |
| stdenv.mkDerivation { | |
| pname = "built-with-gradle"; | |
| version = "0.0"; |
| { | |
| inputs = { | |
| nixpkgs.url = github:nixos/nixpkgs/nixos-unstable; | |
| flake-utils.url = github:numtide/flake-utils; | |
| rust-overlay.url = github:oxalica/rust-overlay; | |
| }; | |
| outputs = { nixpkgs, flake-utils, rust-overlay, ... }: | |
| flake-utils.lib.eachSystem ["x86_64-linux"] (system: let | |
| pkgs = import nixpkgs { |
Or, more precisely, why are two separate but otherwise seemingly identical errors created by Go's errors.New function not equal according to the == operator?
Consider the output of the following small program (Go Playground link) which compares Go's error values for equality:
package main| # Sample from @citizen428 https://dev.to/citizen428/comment/6cmh | |
| FROM golang:alpine as build | |
| RUN apk add --no-cache ca-certificates | |
| WORKDIR /build | |
| ADD . . | |
| RUN CGO_ENABLED=0 GOOS=linux \ | |
| go build -ldflags '-extldflags "-static"' -o app | |
| FROM scratch | |
| COPY --from=build /etc/ssl/certs/ca-certificates.crt \ |
| namespace fsharp_websocket | |
| module WebsocketHelpers = | |
| open System | |
| open System.Net.WebSockets | |
| open System.Threading | |
| open Hopac | |
| let readMessage buffer messageType (stream : #IO.Stream) (socket : WebSocket) = job { |
| # Hello, and welcome to makefile basics. | |
| # | |
| # You will learn why `make` is so great, and why, despite its "weird" syntax, | |
| # it is actually a highly expressive, efficient, and powerful way to build | |
| # programs. | |
| # | |
| # Once you're done here, go to | |
| # http://www.gnu.org/software/make/manual/make.html | |
| # to learn SOOOO much more. |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |