Skip to content

Instantly share code, notes, and snippets.

{{ define "slack.default.title" }}
[ {{ .Status | toUpper }} ]
{{ end }}
{{ define "slack.default.message" }}
{{ range . }}
{{ if gt (len .Annotations.summary) 0 }}Alert Summary: {{ .Annotations.summary }} {{ end }}
{{ if gt (len .Annotations.runbook_url) 0 }}Alert Runbook: {{ .Annotations.runbook_url }} {{ end }}
Labels:
@smoser
smoser / README.md
Last active March 14, 2025 03:24
qemu to linux mapping of smbios / dmi information

Mappings for DMI/SMBIOS to Linux and dmidecode

Information can be put into dmi tables via some qemu-system hosts (x86_64 and aarch64). That information is exposed in Linux under /sys/class/dmi/id and can be read with dmidecode. The names are very annoyingly inconsistent. The point of this doc is to map them.

Mappings

Example qemu cmdline:

qemu-system-x86_64 -smbios type=<type>,field=value[,...]

qemu-system-x86_64 -smbios type=0,vendor=superco,version=1.2.3
@colematt
colematt / .Adding-Sections-to-Elf-Binaries.md
Last active February 10, 2025 14:33
[Add a section to an ELF binary] #llvm

Adding Sections to ELF Binaries

Suppose you need to add a section to an ELF binary to contain information gathered at compile time, but to be used at link time or run time. Here's how to add a section named .okdata and either populate it with data either after or before emitting the ELF binary.

Adding a Section After Emitting

In this case, you'll add file’s contents to an already existing binary. objcopy copies and translates object files, such that adding a new section is a matter of writing that new section’s contents into the ELF file.

(Optional) Create a simple program’s object file.

@ritchie46
ritchie46 / rnn_minibatch.py
Created June 20, 2018 09:28
minibatches in pytorch
"""
How to do minibatches for RNNs in pytorch
Assume we feed characters to the model and predict the language of the words.
"""
def prepare_batch(x, y):
# determine the maximum word length per batch and zero pad the tensors
n_max = max([a.shape[0] for a in x])