Skip to content

Instantly share code, notes, and snippets.

View mr-salty's full-sized avatar

Todd Derr mr-salty

  • Bandcamp
  • Pittsburgh, PA
View GitHub Profile
data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxvZ28iIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAyNDggMjA0IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNDggMjA0OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2ZpbGw6IzFEOUJGMDt9Cjwvc3R5bGU+CjxnIGlkPSJMb2dvXzFfIj4KCTxwYXRoIGlkPSJ3aGl0ZV9iYWNrZ3JvdW5kIiBjbGFzcz0ic3QwIiBkPSJNMjIxLjk1LDUxLjI5YzAuMTUsMi4xNywwLjE1LDQuMzQsMC4xNSw2LjUzYzAsNjYuNzMtNTAuOCwxNDMuNjktMTQzLjY5LDE0My42OXYtMC4wNAoJCUM1MC45NywyMDEuNTEsMjQuMSwxOTMuNjUsMSwxNzguODNjMy45OSwwLjQ4LDgsMC43MiwxMi4wMiwwLjczYzIyLjc0LDAuMDIsNDQuODMtNy42MSw2Mi43Mi0yMS42NgoJCWMtMjEuNjEtMC40MS00MC41Ni0xNC41LTQ3LjE4LTM1LjA3YzcuNTcsMS40NiwxNS4zNywxLjE2LDIyLjgtMC44N0MyNy44LDExNy4yLDEwLjg1LDk2LjUsMTAuODUsNzIuNDZjMC
@mr-salty
mr-salty / volume_test.cpp
Last active June 11, 2021 06:05
Prints a table mapping Windows volume level (0-100) to dB for the default audio device
// volume_test.cpp: prints a level (0-100) to dB table for the default audio device
// I just built this as a console app in VS2019.
// Original code from https://github.com/shubham-theway/Codes-here-there/blob/master/volctrl.cpp
//
// TODO: error checking, device selection, print more device info, ?
#include <stdio.h>
#include <windows.h>
#include <mmdeviceapi.h>
#include <endpointvolume.h>
@mr-salty
mr-salty / clean-bazel-cache.sh
Last active January 21, 2024 21:55
script to clean up files in the bazel cache
#! /bin/bash -e
#
# clean up everything in CACHE_DIR last accessed more than DAYS days ago.
# also removes files with bogus timestamps in the future.
#
# -----------------------------------------------------------------------
# Copyright 2021 Todd Derr (todd.derr@gmail.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@mr-salty
mr-salty / bits
Last active January 2, 2021 05:17
script to convert numbers/expressions to hex/oct/dec/binary
#! /usr/bin/perl
sub Usage {
$0 =~ s#.*/##g;
die <<EOM;
Usage: $0 [-hodsbn] expr [...]
expr may contain decimal/hex/octal numbers and operators, unless expr
is suffixed with b, in which case it is interpreted as a binary number
and operators are not allowed.