Skip to content

Instantly share code, notes, and snippets.

View smklein's full-sized avatar
💩
DOMA, DOMA, DOMADOMADOMA!

Sean Klein smklein

💩
DOMA, DOMA, DOMADOMADOMA!
View GitHub Profile
@smklein
smklein / benchmark_fs.sh
Created July 20, 2017 22:13
Hacky Filesystem Benchmarking scripts
#!/usr/bin/env sh
# Copyright 2017 The Fuchsia Authors
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT
set -eu
@smklein
smklein / serial.py
Last active May 25, 2021 20:19
PORT=12400 INSTANCE=$(./omicron/tools/oxapi_demo project_list_instances myproject | jq -r '.items[].id') python instance_serial.py
import json
import fcntl
import os
import requests
import select
import sys,tty,termios
import time
port = os.environ.get("PORT")
instance = os.environ.get("INSTANCE")
let g:ycm_language_server =
\ [
\ {
@smklein
smklein / cte.sql
Created September 8, 2022 15:57
Testing out some CTEs...
/*
*
* TAKEN FROM DBINIT.SQL
*
*/
/* dbwipe.sql */
CREATE DATABASE IF NOT EXISTS omicron;
CREATE USER IF NOT EXISTS omicron;
ALTER DEFAULT PRIVILEGES FOR ROLE root REVOKE ALL ON TABLES FROM omicron;
@smklein
smklein / llvm-lines.txt
Last active November 13, 2023 21:36
cargo llvm-lines -p omicron-nexus --bin nexus
Compiling omicron-nexus v0.1.0 (/home/smklein/repos/oxide/omicron/nexus)
Finished dev [unoptimized + debuginfo] target(s) in 2.94s
Lines Copies Function name
----- ------ -------------
80410 (100%) 4307 (100%) (TOTAL)
2978 (3.7%) 96 (2.2%) core::result::Result<T,E>::map
2664 (3.3%) 88 (2.0%) core::result::Result<T,E>::map_err
2509 (3.1%) 123 (2.9%) <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
2430 (3.0%) 27 (0.6%) <toml_edit::de::value::ValueDeserializer as serde::de::Deserializer>::deserialize_any
2059 (2.6%) 29 (0.7%) <serde::__private::de::content::ContentDeserializer<E> as serde::de::Deserializer>::deserialize_identifier
@smklein
smklein / ledger_check.sh
Last active July 2, 2024 18:25
One-liner to check for disk ledgers
# Try running this from the switch zone. I used it on Jeeves for the dogfood rack, and it worked.
# To test: I also tried removing the ledgers on a sled, and saw that the sled with
# manual modifications failed as expected.
#
# I recommend running 'omdb' and 'pilot' first, just to check that they exist.
# omdb: Grab the in-service sleds,
# grep: remove the header line,
# awk: remove whitespace
# cut: grab the serial number of the sled