Skip to content

Instantly share code, notes, and snippets.

Avatar

Dave Voutila voutilad

View GitHub Profile
@voutilad
voutilad / doom.json
Created May 6, 2020
Doom (or rather Groom) data model export
View doom.json
{
"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 Apr 30, 2020
PowerShell to convert directory of PowerPoints into PDFs. Adapted from http://mike.clackjones.com/convert-directory-of-pptx-into-pdf-in-powershell/
View pptx2pdf.ps1
$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 Nov 7, 2019
Measuring Journeys in Neo4j
View journey-01-data.cypher
// 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 Aug 28, 2019
A quick/crappy sendfile(2) stub example for OpenBSD
View sendfile.c
// 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 Aug 23, 2018 — forked from Neo23x0/audit.rules
Linux Auditd Best Practice Configuration
View audit.rules
# ___ ___ __ __
# / | __ ______/ (_) /_____/ /
# / /| |/ / / / __ / / __/ __ /
# / ___ / /_/ / /_/ / / /_/ /_/ /
# /_/ |_\__,_/\__,_/_/\__/\__,_/
#
# Linux Audit Daemon - Best Practice Configuration
# /etc/audit/audit.rules
#
# Compiled by Florian Roth
@voutilad
voutilad / npmlink.md
Created Mar 18, 2018
npm link failure
View npmlink.md
@voutilad
voutilad / table_counts.sh
Last active Jan 20, 2018
Helper script to dump table counts from Attivio 5.x
View table_counts.sh
#!/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)" \
@voutilad
voutilad / smtpd.conf
Last active Dec 5, 2017
Example smtpd.conf for relay different Gmail accounts
View smtpd.conf
# $OpenBSD: smtpd.conf,v 1.9 2016/05/03 18:43:45 jung Exp $
# This is the smtpd server system-wide configuration file.
# See smtpd.conf(5) for more information.
table aliases file:/etc/mail/aliases
table secrets file:/etc/mail/secrets
# To accept external mail, replace with: listen on all
#
@voutilad
voutilad / fstab
Created Sep 17, 2017
Alpine Example /etc/fstab
View fstab
UUID=700e8051-4707-4ad4-b8c9-cee9ca8fbd7c / ext4 rw,relatime,data=ordered 0 0
UUID=2eb35135-0ce4-42ff-bbe6-aa9c1ce1234c /boot ext4 rw,relatime,data=ordered 0 0
UUID=2a912f13-7e3b-4a15-935d-e9710f8d2c9e swap swap defaults 0 0
UUID=2fc3aff6-5a80-4ef7-809b-33de8a3ceb17 /data ext4 rw,relatime,user 0 0
/dev/cdrom /media/cdrom iso9660 noauto,ro 0 0
/dev/fd0 /media/floppy vfat noauto 0 0
/dev/usbdisk /media/usb vfat noauto 0 0
@voutilad
voutilad / tar_exclude.sh
Created Jun 9, 2017
POSIX `tar` excluding a file/directory
View tar_exclude.sh
tar -cvf ../standalone/mybackup.tar $(ls /var/postgresql/data | grep -v -e 'pg_xlog')