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 / 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();
@hawkw
hawkw / README.md
Last active May 29, 2019 18:45
linkerd h2 long path bug (linkerd/linkerd2#2859)

Reproduced using https://gist.github.com/tanuck/43282a75d2915bd4e1ebff63cf1c8611. stern-short.log is a smaller section of the logs, beginning with when the outbound client connection is initiated, while stern-all.log is the complete output of

stern 'linkerd-grafana-c59b86cf4-tkm77|nginx-5bbc' -c linkerd-proxy --all-namespaces --exclude admin > stern-all.log

I excluded log messages with the string 'admin' to reduce noise caused by metrics scrapes etc.

@hawkw
hawkw / mfw stacks.txt
Last active January 23, 2019 22:58
some good type errors (looks better with line wrapping)
error[E0277]: `(dyn transport::io::internal::Io + 'static)` cannot be shared between threads safely
--> src/app/main.rs:534:22
|
534 | .push(buffer::layer(MAX_IN_FLIGHT))
| ^^^^ `(dyn transport::io::internal::Io + 'static)` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `(dyn transport::io::internal::Io + 'static)`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<(dyn transport::io::internal::Io + 'static)>`
= note: required because it appears within the type `std::boxed::Box<(dyn transport::io::internal::Io + 'static)>`
= note: required because it appears within the type `transport::io::BoxedIo`