Skip to content

Instantly share code, notes, and snippets.

View hawkw's full-sized avatar
🛠️
recently edited these files

Eliza Weisman hawkw

🛠️
recently edited these files
View GitHub Profile
@hawkw
hawkw / default.nix
Created September 3, 2024 15:47
linkerd2-proxy nix-shell
scope@{ pkgs ? import <nixpkgs> { } }:
let locale = "en_US.UTF8";
in with pkgs;
buildEnv {
name = "linkerd2-proxy-env";
paths = with pkgs;
[
git
bash
#; eliza at theseus in omicron-stress on  main is 📦 v0.1.0 using ⚙️ v1.78.0 took 57s
:; cargo run -- --num-test-instances 8 --num-test-snapshots 0 --num-test-disks 0 --threads-per-instance 8 --server-errors-fatal
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.18s
Running `target/debug/omicron-stress --num-test-instances 8 --num-test-snapshots 0 --num-test-disks 0 --threads-per-instance 8 --server-errors-fatal`
2024-08-08T20:00:31.557667Z INFO omicron_stress::client: 41: Nexus URI host=https://recovery.sys.madrid.eng.oxide.computer
2024-08-08T20:00:31.557807Z INFO omicron_stress::client: 77: hosts.toml file does not exist
2024-08-08T20:00:31.557829Z INFO omicron_stress::client: 88: reading OXIDE_TOKEN from environment
2024-08-08T20:00:31.602947Z INFO omicron_stress: 35: Checking for existing stress project
2024-08-08T20:00:31.946758Z INFO omicron_stress: 37: Project already exists
2024-08-08T20:00:31.946799Z INFO omicron_stress: 48: Checking for IPs in default IP pool
@hawkw
hawkw / shell.nix
Last active January 29, 2024 23:47
omicron nix shell environment
scope@{ pkgs ? import <nixpkgs> { } }:
with pkgs; mkShell.override { stdenv = clangStdenv; } {
name = "buildomat";
buildInputs =
[
stdenv
cmake
rustup
pkg-config
@hawkw
hawkw / README.md
Created October 12, 2023 02:16
tries to print a string but accidentally prints its environment variables instead

a super obvious dangling pointer to locals. clang++ does warn you not to do this, but it doesn't care enough to stop you.

on my machine, with whatever version of clang i have, this does the extremely funny behavior of reading into the caller's stack frame and then into env vars. you may or may not be this lucky, it might just segfault or something. who can say!

@hawkw
hawkw / httproute-timeout-demo.yml
Created June 21, 2023 15:40
Linkerd edge-23.6.2 HTTPRoute timeouts demo
---
# `podinfo` deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: podinfo
spec:
replicas: 1
minReadySeconds: 3
revisionHistoryLimit: 5
@hawkw
hawkw / console-roadmap.md
Created December 17, 2021 02:13
tokio-console roadmap

/!\ this is just a sketch to write down the roadmap items, should be made nice before publishing!

  • more warnings --- get feedback from people, find what common bugs or gotchas we can detect!
  • richer warnings system
    • it would be good to have web docs explaining different warnings in detail, how they can be fixed, etc, like clippy's
  • toggle warnings on and off, configure thresholds for warnings
@hawkw
hawkw / default.nix
Created November 2, 2021 17:52
nix-env to build cloudflare/boring
{ pkgs ? import <nixos-unstable> { } }:
with pkgs;
buildEnv {
name = "boring";
paths = [
binutils
cacert
clang
git
use std::future::Future;
use std::mem;
use std::pin::Pin;
use std::sync::Arc;
use futures::task::{Context, Poll};
use tokio::sync::{Mutex, OwnedMutexGuard};
use tower_service::service::Service;
pub struct CloneableService<S> {
inner: Arc<Mutex<S>>,
Finished release [optimized + debuginfo] target(s) in 0.02s
Running: `qemu-system-x86_64 -drive format=raw,file=/home/eliza/code/mycelium/target/x86_64-mycelium/debug/deps/bootimage-mycelium_kernel-dcc986d72e1bd985.bin -device isa-debug-exit,iobase=0xf4,iosize=0x04 -serial stdio -display none`
[INFO] memory map
[INFO] |- mycelium_kernel: PAddr(0x00000000) UNKNOWN ?_? 4098 B
[INFO] |- mycelium_kernel: PAddr(0x00001000) PAGE_TABLE 16386 B
[INFO] |- mycelium_kernel: PAddr(0x00005000) BOOT 65538 B
[INFO] |- mycelium_kernel: PAddr(0x00015000) BOOT 4098 B
[INFO] |- mycelium_kernel: PAddr(0x00016000) KERNEL 561154 B
[INFO] |- mycelium_kernel: PAddr(0x0009f000) USED 4098 B
[INFO] |- mycelium_kernel: PAddr(0x000f0000) USED 65538 B
@hawkw
hawkw / my_bad_code.rs
Created July 31, 2019 18:25
here's what i've come up with
// Returns a Layout which describes the allocation required for a new block
// of the given capacity + metadata for that block, and the offset of the
// block in the allocation.
#[inline]
#[cfg(not(feature = "nightly"))]
fn calculate_layout<T>(capacity: usize) -> Option<(Layout, usize)> {
// Manual layout calculation since Layout methods are not yet stable.
fn padding_for(layout: &Layout, align: usize) -> usize {
let sz = layout.size();