Skip to content

Instantly share code, notes, and snippets.

View voutilad's full-sized avatar
🥸

Dave Voutila voutilad

🥸
View GitHub Profile
@voutilad
voutilad / dmesg
Created May 24, 2020 01:01
Alpine 3.11.6 with custom Linux 5.4.42 kernel built for OpenBSD hypervisor
[ 0.000000] BIOS-e820: [mem 0x000000000009f800-0x000000000009ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000efffdfff] usable
[ 0.000000] BIOS-e820: [mem 0x00000000efffe000-0x00000000efffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000010fffffff] usable
[ 0.000000] NX (Execute Disable) protection: active
[ 0.000000] SMBIOS 2.4 present.
[ 0.000000] DMI: OpenBSD VMM, BIOS 1.11.0p2-OpenBSD-vmm 01/01/2011
[ 0.000000] Hypervisor detected: OpenBSD VMM
@voutilad
voutilad / another-run.txt
Last active May 17, 2020 01:35
investigating a ghost in the machine
(gdb) p i8253_channel [22/1216]
$4 = {{ts = {tv_sec = 128267, tv_nsec = 181506930}, start = 32767, olatch = 0,
ilatch = 32767, last_r = 1 '\001', last_w = 0 '\000', mode = 4 '\004', rbs = 0 '\000',
timer = {ev_next = {tqe_next = 0x0, tqe_prev = 0x0}, ev_active_next = {tqe_next = 0x0,
tqe_prev = 0xba9f9cb8810}, ev_signal_next = {tqe_next = 0x0, tqe_prev = 0x0},
min_heap_idx = 0, ev_base = 0xba9a852d000, ev_fd = -1, ev_events = 0, ev_ncalls = 0,
ev_pncalls = 0xbaa0149b76a, ev_timeout = {tv_sec = 128267, tv_usec = 20
@voutilad
voutilad / egdb-output.txt
Created May 17, 2020 00:14
investigating a ghost in the machine
Thread 3 hit Breakpoint 1, event_queue_insert (base=0xba9a8534800,
ev=0xba76e0afeb0 <i8253_channel+32>, queue=1) at event.c:879
879 event_errx(1, "%s: %p(fd %d) already on queue %x", __func__,
(gdb) l
874 if (ev->ev_flags & queue) {
875 /* Double insertion is possible for active events */
876 if (queue & EVLIST_ACTIVE)
877 return;
878
879 event_errx(1, "%s: %p(fd %d) already on queue %x", __func__,
@voutilad
voutilad / doom.json
Created May 6, 2020 18:12
Doom (or rather Groom) data model export
{
"metadata": {
"title": "Groom",
"dateCreated": "1585243751657",
"dateUpdated": "1588788283205",
"description": "The Doom Graph Model",
"notes": "See https://github.com/voutilad/groom",
"tags": [],
"customers": [],
"owners": [
@voutilad
voutilad / pptx2pdf.ps1
Created April 30, 2020 12:26
PowerShell to convert directory of PowerPoints into PDFs. Adapted from http://mike.clackjones.com/convert-directory-of-pptx-into-pdf-in-powershell/
$ppt = new-object -com powerpoint.application
$opt = [Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType]::ppSaveAsPDF
foreach($ifile in $(Get-ChildItem '.' -Filter '*.pptx')) {
$ifile = $ifile.FullName
$pres = $ppt.Presentations.Open($ifile)
$pathname = split-path $ifile
$filename = split-path $ifile -leaf
$file = $filename.split(".")[0]
$ofile = $pathname + "\\" + $file + ".pdf"
@voutilad
voutilad / journey-01-data.cypher
Last active November 7, 2019 01:54
Measuring Journeys in Neo4j
// Run this first on an empty Neo4j database.
// Note: the "type" properties are only added to make JSON
// results read better and aren't needed. The "at" property
// is used to create unique Views.
MERGE (u1:User {name:'dave'})
MERGE (u2:User {name:'not dave'})
MERGE (p1:Page {page:'/page1.html'})
MERGE (p2:Page {page:'/page2.html'})
MERGE (p3:Page {page:'/page3.html'})
@voutilad
voutilad / sendfile.c
Last active August 28, 2019 22:54
A quick/crappy sendfile(2) stub example for OpenBSD
// Copyright 2019 Dave Voutila <dave@sisu.io>
// Under no circumstances should you consider this safe/correct code.
// Use at your own risk.
//
// Consider it under ISC license.
#include <stdio.h>
#include <fcntl.h>
#include <err.h>
#include <netdb.h>
@voutilad
voutilad / audit.rules
Created August 23, 2018 10:30 — forked from Neo23x0/audit.rules
Linux Auditd Best Practice Configuration
# ___ ___ __ __
# / | __ ______/ (_) /_____/ /
# / /| |/ / / / __ / / __/ __ /
# / ___ / /_/ / /_/ / / /_/ /_/ /
# /_/ |_\__,_/\__,_/_/\__/\__,_/
#
# Linux Audit Daemon - Best Practice Configuration
# /etc/audit/audit.rules
#
# Compiled by Florian Roth
@voutilad
voutilad / npmlink.md
Created March 18, 2018 12:12
npm link failure
@voutilad
voutilad / table_counts.sh
Last active January 20, 2018 12:26
Helper script to dump table counts from Attivio 5.x
#!/bin/sh
curl -s \
-H "Accept:application/json" \
-G "http://amrvwp000002474:17000/rest/searchApi/simpleCgi" \
--data-urlencode "workflows=search" \
--data-urlencode "q=*:*" \
--data-urlencode "q.type=simple" \
--data-urlencode "hits=0" \
--data-urlencode "facet=table(maxnumbuckets=100)" \