Skip to content

Instantly share code, notes, and snippets.

@pkutzner
pkutzner / vboxvmservice@.service
Last active February 10, 2018 04:14
systemd service for starting headless VirtualBox guests on boot
[Unit]
Description=VirtualBox Virtual Machine %i Service
Requires=systemd-modules-load.service
After=systemd-modules-load.service vboxdrv.service
[Service]
User=vbox
Group=vboxusers
ExecStart=/usr/bin/VBoxHeadless -s %i
ExecStop=/usr/bin/VBoxManage controlvm %i acpipowerbutton
@pkutzner
pkutzner / override.conf
Created February 10, 2018 04:15
Drop this in /etc/systemd/system/getty@tty1.service.d/ to start htop on tty1 instead of login screen
[Service]
ExecStart=
ExecStart=-/usr/bin/htop
StandardInput=tty
StandardOutput=tty
@pkutzner
pkutzner / attachiso.sh
Created February 10, 2018 04:30
Attach ISO image to VirtualBox headless guest
#!/bin/bash
if [[ $# -lt 2 ]]; then
echo "Usage $0 'VM_NAME' /path/to/image.iso"
exit 1
fi
VMNAME="$1"
ISOIMAGE="$2"
@pkutzner
pkutzner / socat-pipe
Created February 10, 2018 04:35
Script for connecting to VirtualBox host pipe file in terminal
#!/bin/bash
[ "$1" ] || { echo "usage: $0 PIPE"; exit 1; }
echo "Press Ctrl+Q to quit..."
trap "stty sane" 0 1 2 3 15
sudo -u vbox socat unix-connect:$1 stdio,raw,echo=0,escape=0x11,icanon=0
@pkutzner
pkutzner / resticbackup.sh
Created February 10, 2018 04:55
Script for cron-able backups via restic
#!/usr/bin/env bash
# Fail early if we weren't given enough parameters
if [[ $# -lt 2 ]]; then
echo "Usage: $0 <path_to_env_vars> <action> [debug]"
exit 1
fi
## === DEFAULTS === ##
RESTICPATH="/opt/restic"
@pkutzner
pkutzner / restic.env
Created February 10, 2018 05:01
Environment file for resticbackup.sh
# API credentials
#
# Amazon S3:
#AWS_ACCESS_KEY=<MY_ACCESS_KEY>
#AWS_SECRET_ACCESS_KEY=<MY_SECRET_ACCESS_KEY>
#
# Backblaze B2:
B2_ACCOUNT_ID=<B2_ACCOUNT_ID>
B2_ACCOUNT_KEY=<B2_ACCOUNT_KEY>
#
@pkutzner
pkutzner / gist:744ca34c4aab4b9c6d5872fa0bf9135a
Created April 25, 2018 20:27
Create ISO from AppStore download of macOS installer
Open Terminal, then run the following commands one at a time:
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/BaseSystem.dmg
hdiutil detach /Volumes/install_app
#!/usr/bin/python
#
# Copyright (c) Citrix Systems 2007-2011
# Author: Gianni Tedesco and Dave Scott
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; version 2.1 only. with the special
# exception on linking described in file LICENSE.
#
#!/bin/bash -
#===============================================================================
#
# FILE: csb_updated.sh
#
# USAGE: ./csb_updated.sh
#
# DESCRIPTION: Updated version of Client SQL Backup (csb) script.
#
# OPTIONS: ---
@pkutzner
pkutzner / shodan_ips.txt
Created March 11, 2019 20:32
shodan_ips
198.20.69.74
198.20.69.98
198.20.70.114
198.20.99.130
93.120.27.62
66.240.236.119
71.6.135.131
66.240.192.138
71.6.167.142
82.221.105.6