Skip to content

Instantly share code, notes, and snippets.

View edef1c's full-sized avatar

edef edef1c

  • Earth
View GitHub Profile
@jboner
jboner / latency.txt
Last active May 5, 2024 03:12
Latency Numbers Every Programmer Should Know
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
@edolstra
edolstra / nix-lang.md
Last active May 2, 2024 23:39
Nix language changes

This document contains some ideas for additions to the Nix language.

Motivation

The Nix package manager, Nixpkgs and NixOS currently have several problems:

  • Poor discoverability of package options. Package functions have function arguments like enableFoo, but there is no way for the Nix UI to discover them, let alone to provide programmatic ways to
@tangrs
tangrs / bin2elf.sh
Last active April 15, 2024 02:34
Convert a memory dump/raw binary image into an ELF file
#!/bin/sh
# Convert a raw binary image into an ELF file suitable for loading into a disassembler
cat > raw$$.ld <<EOF
SECTIONS
{
EOF
echo " . = $3;" >> raw$$.ld
@steeve
steeve / _readme.md
Last active March 7, 2024 12:38
How to cross compile Go with CGO programs for a different OS/Arch

How to cross compile Go with CGO programs for a different OS/Arch

It is possible to compile Go programs for a different OS, even though go build says otherwise.

You'll need:

@Ruben-E
Ruben-E / edgerouter-x.md
Last active January 25, 2024 23:12
Configure EdgeRouter X for KPN fiber / glasvezel

Setup interface eth1 and configure the DHCP/DNS server

configure
 
set interfaces ethernet eth1 address 192.168.2.254/24
set interfaces ethernet eth1 description "eth1 - LAN"
set interfaces ethernet eth1 duplex auto
set interfaces ethernet eth1 speed auto
 
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverlappingInstances #-}
module Main where
import Control.Monad.Free
{ config, lib, ... }:
with lib;
let
cfg = config.services.nixBinaryCacheCache;
nginxCfg = config.services.nginx;
@tarcieri
tarcieri / semiprivate.md
Last active January 18, 2023 01:08
Ed25519-based semi-private keys

Semiprivate Keys

🚨 DANGER: INSECURE! 🚨

This may have seemed like a great idea in 2013, but the repeated "set/clear bits", a.k.a. clamping phases at each level of the hierarchy slowly subtract key strength.

Don't use this as described. Check out Ristretto.

Original text

Semi-private keys are an expansion of the traditional idea

@ecin
ecin / goarena.go
Created August 31, 2012 17:34
Dtrace probes in your Golang code
package main
/*
Ping vs Pong: A Gladiatorial Match
Two goroutines enter, only one leaves...
*/
/*
#cgo LDFLAGS: -lprobes -L/usr/local/lib
#include "probes.h"
@vizanto
vizanto / hardware-configuration.nix
Created March 19, 2016 14:28
NixOS 16 on LX brand
{ config, lib, pkgs, ... }:
{
imports = [ ];
### SmartOS Linux Branded Zone specific configuration
nix.extraOptions = ''
build-users-group =
'';