Skip to content

Instantly share code, notes, and snippets.

View alexforster's full-sized avatar

Alex Forster alexforster

View GitHub Profile
@alexforster
alexforster / hh.py
Created September 25, 2023 20:42
Streaming Heavy Hitters
#!/usr/bin/env python3
import sys
import random
from typing import *
from dataclasses import dataclass
from ipaddress import IPv4Address
@alexforster
alexforster / keybase-proof.md
Last active September 11, 2023 21:02
Keybase proof

Keybase proof

I hereby claim:

  • I am alexforster on github.
  • I am alexforster (https://keybase.io/alexforster) on keybase.
  • I have a public key whose fingerprint is DE68 F2DF 9089 C924 BCD7 A5FC FD5B F187 E54B 78C0

To claim this, I am signing this object:

@alexforster
alexforster / xsk_ring.rs
Last active April 13, 2020 17:08
Rust xsk ring implementation
// Copyright (c) Cloudflare, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@alexforster
alexforster / instructions.txt
Last active September 4, 2020 21:12
Ubuntu 16.04 Preseed
1) Format a USB stick as mbr w/ bootable/primary/active fat32 partition and install syslinux onto it
2) Copy these files onto the USB stick
http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/hd-media/initrd.gz
http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/hd-media/vmlinuz
http://old-releases.ubuntu.com/releases/16.04.0/ubuntu-16.04-server-amd64.iso
^ important part is to get the 16.04.0 iso when using dists/xenial/main initrd & vmlinuz OR to use the latest iso when from dists/xenial-updates/main
^ fwiw an apt-get upgrade is performed at the end of installation via preseed
@alexforster
alexforster / uudecode.cs
Last active June 7, 2017 20:14
C# simple uudecode implementation
public static Byte[] UUDecode(StreamReader input)
{
var result = new MemoryStream();
for(String ascii; (ascii = input.ReadLine()) != null;)
{
var encodedBuffer = Encoding.ASCII.GetBytes(ascii);
if(encodedBuffer[0] == 0x60) break;
@alexforster
alexforster / lxcon.md
Last active June 18, 2023 12:51
LXD: accessing container's consoles
~# lxc profile device show default
# (...sic...)
console:
  path: /dev/console
  type: unix-char
tty:
  path: /dev/tty
  type: unix-char
tty0: