Skip to content

Instantly share code, notes, and snippets.

View voutilad's full-sized avatar
🥸

Dave Voutila voutilad

🥸
View GitHub Profile
@voutilad
voutilad / .profile
Created June 7, 2017 21:19
KSH PS1 settings for ok color
export PS1="$(printf "\033[1;32m%s\033[;37m@\033[1;33m%s\033[0m$ " $(logname) $(hostname -s))"
@voutilad
voutilad / tar_exclude.sh
Created June 9, 2017 01:01
POSIX `tar` excluding a file/directory
tar -cvf ../standalone/mybackup.tar $(ls /var/postgresql/data | grep -v -e 'pg_xlog')
@voutilad
voutilad / fstab
Created September 17, 2017 00:42
Alpine Example /etc/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 / smtpd.conf
Last active December 5, 2017 02:23
Example smtpd.conf for relay different Gmail accounts
# $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 / 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)" \
@voutilad
voutilad / npmlink.md
Created March 18, 2018 12:12
npm link failure
@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 / 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 / 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 / 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"