Skip to content

Instantly share code, notes, and snippets.

View algesten's full-sized avatar
😀
barcelona!

Martin Algesten algesten

😀
barcelona!
View GitHub Profile
//! # Proposed API Changes for str0m
//!
//! Type-state pattern enforcing correct API usage at compile time.
//!
//! ## Core Principles
//!
//! 1. **Time is driven externally** — caller provides `now: Instant`
//! 2. **Every mutation requires poll-to-timeout** — type system enforces this
//! 3. **All state changes are mutations** — media writes, DirectApi, SDP
//!

Probe Clusters in str0m

This document outlines a plan for implementing probe clusters in str0m, matching libWebRTC's bandwidth probing approach.

Scope

This plan covers probe clusters for existing media RTX/padding only. Pre-media SSRC 0 probing is out of scope and will be addressed in a separate PR that builds on this infrastructure.

Current State

@algesten
algesten / blah.rs
Created August 7, 2022 13:22
Unhelpful tracing macro error
use tracing::{info_span, Span};
pub struct Blah {
pub span: Span,
}
impl Blah {
pub fn new(name: &str) -> Self {
Blah {
span: info_span!(name),
stokast v0.1.0 (/Users/martin/dev/stokast)
├── alg v0.1.0 (/Users/martin/dev/alg)
│ ├── gcd v2.0.1
│ └── log v0.4.14
│ └── cfg-if v1.0.0
├── arrayvec v0.7.1
├── cortex-m v0.6.7
│ ├── aligned v0.3.5
│ │ └── as-slice v0.1.5
│ │ ├── generic-array v0.12.4
@algesten
algesten / aws.rs
Last active June 1, 2021 09:00
ureq aws sign
use chrono::{DateTime, Utc};
use hmac::{Hmac, Mac, NewMac};
use once_cell::sync::Lazy;
// notice this is percent_encoding=1.0.1 since I haven't bothered to
// fix this for latter versions of the crate.
use percent_encoding::{define_encode_set, utf8_percent_encode, SIMPLE_ENCODE_SET};
use sha2::{Digest, Sha256};
use std::env;
use std::fmt::Write;
@algesten
algesten / README.md
Last active April 10, 2018 12:17
Investigate CTFontCopyDefaultCascadeListForLanguages

Apple provides CTFontCopyDefaultCascadeListForLanguages to get a set of fallback font names for a certain ISO language code. I want to know how much these vary.

main.swift is a quick hack to dump a JSON of all codes with the fallbacks. The test assumes Menlo 12.0 as the starting point.

output.json is the full output from running the swift hack.

Finally I used nodejs to crunch the json to buckets that have different lists of fallbacks. code is in crunch.js

buckets.json has the result of running the crunch.

@algesten
algesten / tmux.conf
Created May 14, 2017 08:30
A tmux.conf with pbcopy
# propagate titles to the window
set -g set-titles on
# Minimalist window title "0:bash"
set -g set-titles-string "#I:#W"
# show colors
set -g default-terminal "screen-256color"
@algesten
algesten / start-tmux.sh
Created May 14, 2017 07:59
start tmux in bashrc
# TMUX
# test if tmux is available
if type tmux >/dev/null 2>&1; then
# if not inside a tmux session, and if no session is started, start a new session
# I only want this on my mac laptop.
if [ -z "$TMUX" -a `uname` == Darwin ]; then
# attach to session "martin" if there
exec tmux -2 -f ~/.tmux-osx.conf new-session -A -s martin
fi
fi
# Stateful
class MyComponent extends React.Component
constructor: (props) ->
super
render: =>
div class:'mycomponent', ->
span 'Hej'
const MyThing = () => {
return _react2.default.createElement('div',
_react2.default.createElement(Title),
_react2.default.createElement(Counter, {panda:42}),
_react2.default.createElement(ButtonCounterInc),
_react2.default.createElement(ButtonTitle)
);
};