Skip to content

Instantly share code, notes, and snippets.

View aaronpuchert's full-sized avatar

Aaron Puchert aaronpuchert

View GitHub Profile
@aaronpuchert
aaronpuchert / .bashrc
Last active October 4, 2025 22:20
Disassembly helpers
alias diff="diff -u --color=always"
disas() {
objdump --disassemble --no-show-raw-insn --visualize-jumps=color --disassembler-color=color $@ | less
}
disas-fn() {
SYMBOL=$1
shift
objdump --disassemble=$SYMBOL --no-show-raw-insn --visualize-jumps=color --disassembler-color=color $@ | less
}
@aaronpuchert
aaronpuchert / diag-level.sh
Created September 10, 2025 23:02
Rudimentary script to find unbalanced warning pragmas in preprocessed source
#!/bin/bash
grep -n -E "#pragma $1 diagnostic (push|pop)" $2 | \
awk "BEGIN { FS = \":\" }
\$2 == \"#pragma $1 diagnostic push\" { ++level; print \$1, level}
\$2 == \"#pragma $1 diagnostic pop\" { --level; print \$1, level}"
@aaronpuchert
aaronpuchert / opensuse.db
Last active March 19, 2021 01:44
Generic Squid `store_id_program` for openSUSE mirrors
^http:\/\/.*\/([^:/]+\/(?:[^:/]+:\/)*(?:[^:/]+\/){3}[^/]+.rpm) http://opensuse.squid.internal/$1
@aaronpuchert
aaronpuchert / terminal-colors.sh
Created January 24, 2021 22:27
Testing terminal typesetting
#!/bin/bash
echo -e '\\e[1m \e[1mbold\e[21m \\e[21m'
echo -e '\\e[3m \e[3mitalic\e[23m \\e[23m'
echo -e '\\e[4m \e[4munderline\e[24m \\e[24m'
echo -e '\\e[5m \e[5mblinking\e[25m \\e[25m'
echo -e '\\e[9m \e[9mstrikethrough\e[29m \\e[29m'
echo -e '\\e[53m \e[53moverline\e[55m \\e[55m'
echo -e '\\e[XXm'
for i in $(seq 30 38)
@aaronpuchert
aaronpuchert / clean-ast
Last active April 10, 2021 21:07
Remove some clutter from Clang's AST dump
#!/usr/bin/sed -f
# Remove hard-coded typedefs in the beginning.
2,+13d
# Remove addresses from Stmts, Attrs, Comments.
s/\o033\[0m\o033\[0;1;35m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;1;35m\1\o033[0m\o033[0;33m/g
s/\o033\[0m\o033\[0;1;34m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;1;34m\1\o033[0m\o033[0;33m/g
s/\o033\[0m\o033\[0;34m\([A-Za-z]*\)\o033\[0m\o033\[0;33m 0x[0-9a-f]*/\o033[0m\o033[0;34m\1\o033[0m\o033[0;33m/g
# Remove source locations and ranges.
s/ <\o033\[0;33m[^\o033]*\o033\[0m>//g
s/ <\o033\[0;33m[^\o033]*\o033\[0m, \o033\[0;33m[^\o033]*\o033\[0m>//g
@aaronpuchert
aaronpuchert / CMakeLists.txt
Last active May 30, 2023 21:17
Build LLVM mono repository from root directory
add_subdirectory(llvm)
@aaronpuchert
aaronpuchert / sierpinksi.ps
Created January 6, 2016 18:36
Sierpinski triangle in PostScript
%!PS-Adobe-3.0
%%Creator: Aaron Puchert
%%Title: The Spierpinski triangle
%%Pages: 1
%%PageOrder: Ascend
%%BeginProlog
% PAGE SETTINGS
/pageset {
28.3464566 28.3464566 scale % set cm = 1
@aaronpuchert
aaronpuchert / .Rprofile.R
Last active December 21, 2015 23:09
Initialize "parallel" cluster on R startup
require("utils")
require("parallel")
# do not start in RStudio
if (Sys.getenv("RSTUDIO_USER_IDENTITY") == "" && !file.exists(".cluster")) {
cat(Sys.getpid(), file=".cluster")
Cluster <- makeCluster(detectCores())
}
.First <- function() source("src/main.r") # should load all other sources
@aaronpuchert
aaronpuchert / german.md
Last active November 20, 2022 00:10
Deutsche Wörter im Englischen Sprachgebrauch
@aaronpuchert
aaronpuchert / group_concat.sql
Created July 21, 2013 17:22
This is a group_concat(int) replacement for PostgreSQL.
CREATE OR REPLACE FUNCTION group_concat_iterate(_state INTEGER[], _value INTEGER)
RETURNS INTEGER[] AS
$BODY$
SELECT
CASE
WHEN $1 IS NULL THEN ARRAY[$2]
ELSE $1 || $2
END
$BODY$
LANGUAGE SQL VOLATILE;