Skip to content

Instantly share code, notes, and snippets.

View trishume's full-sized avatar

Tristan Hume trishume

View GitHub Profile
trishume /
Created September 11, 2023 05:26
perf script to chrome trace
set -eu
TIMESTAMP=`date '+%Y-%m-%d-%H:%M:%S'`;
perf buildid-cache --add /usr/local/lib/
perf buildid-cache --add /usr/local/lib/xrdp/
perf buildid-cache --add /usr/lib/xorg/modules/
perf buildid-cache --add `which xrdp`
perf probe --del 'sdt_librfxcodec:*' || true
trishume /
Last active December 7, 2023 10:35
GDB scripting with GEF
import re
import argparse
import re
class InstrTraceBreakpoint(gdb.Breakpoint):
def __init__(self, location, nb_args, *args, **kwargs):
super(InstrTraceBreakpoint, self).__init__(location, gdb.BP_BREAKPOINT, internal=True)
self.silent = True
self.nb_args = nb_args
trishume / etrace.el
Last active October 25, 2020 21:43
See new Github Repo version: - Emacs Latency Tracing for the Chromium Catapult Trace Event Format.
View etrace.el
;; This gist has been superseded by a Github repo, new activity will
;; happen at
;;; etrace.el --- Emacs Lisp Tracer -*- lexical-binding: t -*-
;; Released under the MIT license, Copyright Jane Street Group, LLC
;; This module modifies the instrumentation profiler included with
;; Emacs called "elp" to also record trace events for the beginning
;; and end of function calls, and provides a function to write out
;; those events in Chromium JSON trace format.
trishume / LatencyTester.ino
Last active July 13, 2021 16:12
Latency Tester and Foot Pedals Teensyduino sketch
View LatencyTester.ino
// Tristan's Foot Pedals and Latency Tester Arduino Program
// Provides 5 buttons: left click, right click, scroll up, scroll down, latency test
// If you don't want all of these you can comment out the buttons you don't need.
#include <Bounce2.h>
#include "Keyboard.h"
const int scrollInterval = 80;
trishume / Flagsifier.ipynb
Created May 14, 2018 02:45
DEF CON Quals 2018 Flagsifier Notebook
View Flagsifier.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
trishume / burn.rb
Created July 18, 2017 19:31
CPU load tester for Sublime
View burn.rb
# Sublime load test for
# On my 15" 2016 rMBP:
# 4 is not noticeable
# 8 is noticeable and just barely keeps up with typing
# 20 lags way behind my typing
def compute_things()
sum = 0
10_000.times do |i|
trishume /
Created July 5, 2017 15:53
Faster Rust benchmark that still gives no information
pub fn suffix_vec_ref(s: &str) -> Vec<&str> {
let mut vec = Vec::with_capacity(s.len());
let mut slice = &s[1..];
while !slice.is_empty() {
slice = &slice[1..];
trishume / merlin-sublime-popups.patch
Created March 30, 2017 00:12
Patch to add type inference and definition popups to Sublime Text's Merlin plugin
View merlin-sublime-popups.patch
diff --git a/Packages/Merlin/ b/Packages/Merlin/
--- a/Packages/Merlin/
+++ b/Packages/Merlin/
@@ -248,6 +248,57 @@
opened_view.run_command("insert_code", { "arg": sig })
+class MerlinInfoPopup:
+ """
+ Pop up a menu at a point describing an expression
trishume / unix201.txt
Created March 22, 2017 23:36
CS Club Unix 201 Content
View unix201.txt
Unix 201:
☐ Man pages (including searching)
☐ The internet
Customizing your prompt:
☐ Basic PS1
☐ Fancy stuff
☐ Basics
☐ ranger-cd
trishume /
Last active January 4, 2017 23:32
PackageJsonForCompilers/Esy and Nix

This is a response to a tweet by @jordwalke asking me about Nix and PackageJsonForCompilers. Twitter is too short form to answer well, so I wrote up some thoughts here. I might turn this into a blog post at some point.


Nix is a package manager, but also a meta-build system and deployment system. It works based off a global /nix/store/ folder where everything is stored keyed by a hash of its description and the description of all its dependencies. This way you can have multiple versions of any package, and not only that different copies of the same version compiled against different versions of its dependencies or with different compile flags. All dependencies must be fully specified and the way the building works enforces this completely. This way completed binaries can be served from a "cache" with no issue. This gives the best of source-based package managers and binary ones.

The way it handles build vs. runtime depe