Skip to content

Instantly share code, notes, and snippets.

@flaub
flaub / monitor.py
Created September 29, 2024 22:11
USB Monitor
import time
from usbmonitor import USBMonitor
from usbmonitor.attributes import ID_MODEL, ID_MODEL_ID, ID_VENDOR_ID
def device_info_str(device_info):
model ="unknown"
if ID_MODEL in device_info:
model = device_info[ID_MODEL]
return f"{model} ({device_info[ID_MODEL_ID]} - {device_info[ID_VENDOR_ID]})"
@flaub
flaub / risc-zero-stark-to-snark-prover_attestation.log
Created April 7, 2024 14:36
Attestation for RISC Zero STARK-to-SNARK Prover MPC Phase 2 Trusted Setup ceremony
Hey, I'm flaub-111859 and I have contributed to the RISC Zero STARK-to-SNARK Prover MPC Phase2 Trusted Setup ceremony.
The following are my contribution signatures:
Circuit # 1 (stark_verify)
Contributor # 10
Contribution Hash: 7c6832b2 50b9c208 0fa748ee cd2d4d8a
552e37f3 301ecb49 f72622a9 04720e5e
cfa26453 2f358f0b 6fa2aa95 3f7c0c69
59a803a6 c924398d f2b47096 5421a0fe
@flaub
flaub / risc-zero-groth16-verifier_attestation.log
Created December 1, 2023 23:25
Attestation for RISC Zero Groth16 Verifier MPC Phase 2 Trusted Setup ceremony
Hey, I'm flaub-111859 and I have contributed to the RISC Zero Groth16 Verifier MPC Phase2 Trusted Setup ceremony.
The following are my contribution signatures:
Circuit # 1 (verify)
Contributor # 4
Contribution Hash: ecd14c8e 9d9400a5 3c6848a6 29a883ca
3d2c942e 3b7c38d4 90485068 22dc4e27
e697fb8d 04d5bd95 0f7d7511 a7458b6c
33880325 dcd13346 904e9ded d0624c26
@flaub
flaub / prof.rs
Created October 19, 2022 22:20
ProfLayer
use std::time::{Duration, Instant};
use tracing_core::{span, subscriber::Subscriber};
use tracing_subscriber::{
fmt::{self, format::FmtSpan},
layer::Context,
prelude::*,
registry::LookupSpan,
EnvFilter, Layer,
};
@flaub
flaub / ffi_example.c
Created June 4, 2020 20:48
EDSL language binding C API
#include "plaidml/edsl/ffi.h"
void ffi_example() {
int64_t dims[4] = {1, 2, 3, 4};
plaidml_error err;
plaidml_edsl_init(&err);
if (err.code) {
// This is an example of how to check for errors and how to report them.
const char* str = plaidml_string_ptr(err.msg);
@flaub
flaub / lowering.cc
Created January 5, 2020 22:58
Experiment with DRR + DialectConversion
struct LoweringPass : public mlir::ModulePass<LoweringPass> {
void runOnModule() final {
// Set up target (i.e. what is legal)
// ...
// Setup rewrite patterns
OwningRewritePatternList patterns;
populateWithGenerated(&getContext(), patterns);
// Run the conversion
@flaub
flaub / linux_arm_32v7.config
Created February 22, 2019 22:54
crosstool-ng config for linux_arm_32v7
#
# Automatically generated file; DO NOT EDIT.
# Crosstool-NG Configuration
#
CT_CONFIGURE_has_static_link=y
CT_CONFIGURE_has_wget=y
CT_CONFIGURE_has_curl=y
CT_CONFIGURE_has_stat_flavor_GNU=y
CT_CONFIGURE_has_make_3_81_or_newer=y
CT_CONFIGURE_has_libtoolize_2_4_or_newer=y
@flaub
flaub / Compiler.md
Created June 29, 2018 22:00
Compiler passes
  • BindProgram
    • TypeCheck
      • ApplyDefines (pre-processor expansion)
      • foreach Input
        • Check Input is bound
        • Ensure shapes match
        • foreach Dim
          • Add/Lookup binding
      • foreach Op
  • Add const bindings
@flaub
flaub / windows.py
Created June 1, 2018 05:07
git-big windows
# experimental impl for core.symlinks = false
class WindowsFileSystem(FileSystem):
def islink(self, path, start=None):
if start:
path = os.path.relpath(path, start)
files = git('ls-files', '-s', path)
lines = files.splitlines()
if lines:
first_line = lines[0]
parts = first_line.split()
@flaub
flaub / SqliteContext.cs
Created March 16, 2015 08:21
SQLite EF 6 Database Initializer
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Data.SQLite;
using System.Linq;
namespace SQliteEF6
{
class SqliteContext : DbContext