Skip to content

Instantly share code, notes, and snippets.

#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ByteVectorEventProtocolMarker;
impl fidl::endpoints::ServiceMarker for ByteVectorEventProtocolMarker {
type Proxy = ByteVectorEventProtocolProxy;
type RequestStream = ByteVectorEventProtocolRequestStream;
const DEBUG_NAME: &'static str = "(anonymous) ByteVectorEventProtocol";
}
@bprosnitz
bprosnitz / notify_long_running.bash
Last active November 19, 2021 18:55
bash: notify when long running command has finished
DURATION_FOR_NOTIFY=10
PROMPT_ID=$RANDOM
preexec () {
date +%s > /tmp/.time${PROMPT_ID}
echo $1 > /tmp/.cmd${PROMPT_ID}
}
postexec() {
OLD_TS=$(cat /tmp/.time${PROMPT_ID})
if [[ OLD_TS -eq "" ]]; then
return
@bprosnitz
bprosnitz / config.h
Last active May 24, 2016 04:27
dwm-6.0 config
/* See LICENSE file for copyright and license details. */
/* appearance */
static const char font[] = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#444444";
static const char normbgcolor[] = "#222222";
static const char normfgcolor[] = "#bbbbbb";
static const char selbordercolor[] = "#005577";
static const char selbgcolor[] = "#005577";
static const char selfgcolor[] = "#eeeeee";
@bprosnitz
bprosnitz / debugging_vdl_encoder.go
Created May 11, 2016 20:33
A vdl encoder that prints debug messages (doesn't wrap)
package vdl
import (
"fmt"
"os"
"strings"
)
func encoderDebugMsg(method string, depth int, args ...interface{}) {
argStrs := make([]string, len(args))
@bprosnitz
bprosnitz / vdl Encoder and Decoder Wrappers
Last active May 11, 2016 20:32
debug_encoder_decoder.go
package vdl
import (
"fmt"
"strings"
)
type DebugDecoder struct {
Depth int
Prefix string
@bprosnitz
bprosnitz / debugging_vdl_target.go
Last active March 23, 2016 17:05
A vdl target that pretty prints calls to the interface
package vom
import (
"fmt"
"os"
"strings"
"v.io/v23/vdl"
)
func targetDebugMsg(method string, depth int, args ...interface{}) {
@bprosnitz
bprosnitz / cpu-default-mode.sh
Created March 15, 2016 17:37
Reset the CPU speed to "ondemand" after benchmarks
#!/bin/bash
# sudo apt-get install cpufrequtils
sudo cpufreq-set -c 0 -g ondemand
sudo cpufreq-set -c 1 -g ondemand
sudo cpufreq-set -c 2 -g ondemand
sudo cpufreq-set -c 3 -g ondemand
sudo cpufreq-set -c 4 -g ondemand
sudo cpufreq-set -c 5 -g ondemand
@bprosnitz
bprosnitz / cpu-bench-mode.sh
Created March 15, 2016 17:36
Set CPU clock speed to "performance" for benchmarks
#!/bin/bash
# sudo apt-get install cpufrequtils
sudo cpufreq-set -c 0 -g performance
sudo cpufreq-set -c 1 -g performance
sudo cpufreq-set -c 2 -g performance
sudo cpufreq-set -c 3 -g performance
sudo cpufreq-set -c 4 -g performance
sudo cpufreq-set -c 5 -g performance
@bprosnitz
bprosnitz / quick_line_diff.go
Created March 1, 2016 17:26
Helper to diff lines for debugging multi-line output
func diffLines(a, b string) {
fmt.Printf("len(a) %d len(b) %d\n", len(a), len(b))
sa := bufio.NewScanner(strings.NewReader(a))
sb := bufio.NewScanner(strings.NewReader(b))
index := 0
for {
index++
var readSomething bool
var aline string
@bprosnitz
bprosnitz / cloneobjectstring.js
Last active March 10, 2016 06:52
Generate javascript code that will create a clone of a given javascript object
function buildValMap(obj, m) {
if (typeof obj !== 'object' || obj === null) {
return '';
}
if (obj === Object.prototype || obj === Array.prototype) {
return '';
}
if (m.has(obj)) {
return '';
}