Skip to content

Instantly share code, notes, and snippets.

View xenithorb's full-sized avatar

Michael Goodwin xenithorb

View GitHub Profile
@xenithorb
xenithorb / README.md
Last active January 18, 2021 03:16
KeePass 2.x favorite triggers for saving and syncing
  1. If the file %HOME%/Nextcloud/keepass/{DB_NAME}[^1][^2] does not exist, then it exports the db there to create a new file
  2. If the file %HOME%/Nextcloud/keepass/{DB_NAME}[^1][^2] does exist, then it synchronizes the current database with that file

This way you don't have to worry about saving or moving around copies into your synced storage, and the normal sync trigger won't error out on a file that does not exist

The first trigger, Save new if file doesn't exist turns off the following Sync if file exists trigger to avoid a loop, the third trigger turns the sync trigger back on so that on any subsequent saves, it sync to the file as well.

[1]: %HOME% in keepass expands to $HOME on linux - might expand to %HOME% on Windows, too.
[2]: {DB_NAME} in keepass expands to the database's name + extension.

@xenithorb
xenithorb / keybase.md
Created April 26, 2017 17:04
keybase.md

Keybase proof

I hereby claim:

  • I am xenithorb on github.
  • I am xenithorb (https://keybase.io/xenithorb) on keybase.
  • I have a public key ASA6tAuN_Ww3nuVJWiVdOzT5ZrdTxNBCSBBXj3d9oc2pdwo

To claim this, I am signing this object:

@xenithorb
xenithorb / kanboard-beanstalkd-worker.service
Last active June 5, 2017 21:57
Kanboard worker service (beanstalkd)
# /etc/systemd/system/kanboard-beanstalk-worker.service
[Unit]
Description=Kanboard background worker (beanstalkd)
Wants=beanstalkd.service postgresql.service
After=postgresql.service
[Service]
Type=simple
User=apache
Group=apache
@xenithorb
xenithorb / github-backup.sh
Last active May 14, 2017 11:57
A helper script for python-github-backup that also handles backing up github gists
#!/bin/bash
#
# github-backup.sh: A helper script for python-github-backup that also
# handles backing up github gists
#
# Author: Mike Goodwin
# Date: 20170429
#
# Usage Example:
#
@xenithorb
xenithorb / virsh_offline_vm_xfer.sh
Last active March 10, 2018 17:40
Move a libvirt VM from one host to another
#!/bin/bash
#
# Usage: ./virsh_offline_vm_xfer.sh <domain> <host>
#
# Requirements
# 1. The same user on the local and remote machine that are able to sudo
# 2. Both normal users belong to the libvirt group respectively or have
# global libvirtd access. (can access qemu:///system)
# 3. Assumes image paths can remain identical during transfer
#
@xenithorb
xenithorb / dns_updown_script.sh
Last active June 12, 2017 00:33
Ash OpenVPN up/down scrupt for OpenWRT + DNSMasq to use dhcp-option DNS nameservers from VPN
#!/bin/ash
# Copyright (c) 2017 Michael Goodwin
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
@xenithorb
xenithorb / mkovpn.sh
Last active April 26, 2021 20:05
OpenVPN EasyRSA companion to output OVPN files (.ovpn) that contain embedded certs and keys
#!/bin/bash
# Generate OVPN files (single config w/ certs and keys) for OpenVPN
# from EasyRSA tool's pki folder output
#
# - Tool expects to be in easy-rsa's pki fodler ( after `easy-rsa init-pki` )
# - outputs to ovpn-out folder
# Expected usage:
# $ # First install easy-rsa with your pkg manager
# $ mkdir ~/openvpn # new folder
# $ cd ~/openvpn
@xenithorb
xenithorb / borg_cron.sh
Last active February 23, 2018 23:40
Simple generic backup script for borg
#!/bin/bash
#
# Simple cron-intended script for Borg Backup
#
# Author: Michael Goodwin Date: 2018-02-23
# Exit on error immediately
# This is important if you want to make sure that each step
# only runs if the previous step exited with a 0 status.
# Like a universal && everywhere.
@xenithorb
xenithorb / docker_aliases.sh
Created June 6, 2017 20:16
Useful docker aliases for cleaning things up
# These should go in ~/.bashrc or an equivalent area that is sourced into your shell environmemnt
# Remove all docker containers running and exited
alias docker-rma='__drma() { docker ps -aq "$@" | xargs -r docker rm -f; }; __drma'
# Remove all docker images
alias docker-rmia='__drmia() { docker images -q "$@" | xargs -r docker rmi -f; }; __drmia'
# Remove all custom docker networks
alias docker-rmnet='__drmnet() { docker network ls -q -f type=custom "$@" | xargs -r docker network rm; }; __drmnet'
# Remove all unused volumes
alias docker-rmvol='__drmvol() { docker volume ls -q "$@" | xargs -r docker volume rm; }; __drmvol'
@xenithorb
xenithorb / piwik-nginx.conf
Last active August 22, 2018 11:52
Piwik flat-file nginx configuration
#-*- mode: nginx; mode: flyspell-prog; mode: autopair; ispell-local-dictionary: "american" -*-
## Define a zone for limiting the number of simultaneous
## connections nginx accepts. 1m means 32000 simultaneous
## sessions. We need to define for each server the limit_conn
## value refering to this or other zones.
## ** This syntax requires nginx version >=
## ** 1.1.8. Cf. http://nginx.org/en/CHANGES. If using an older
## ** version then use the limit_zone directive below
## ** instead. Comment out this
## ** one if not using nginx version >= 1.1.8.