Skip to content

Instantly share code, notes, and snippets.

View stemid's full-sized avatar

Stefan Midjich stemid

View GitHub Profile
@stemid
stemid / make_backup.sh
Created June 25, 2018 12:30
Backup script for my personal laptop
#!/usr/bin/env bash
# Simple backup script for borg. http://borgbackup.readthedocs.io/en/stable/
# Install on Fedora: sudo dnf install borgbackup
#
# Configure BORG_REPO below to match some path on your own system. In my case
# it points to an autofs mount on my network backup device.
# Configure your own borg_excludes.
# by Stefan Midjich <swehack at gmail dot com>
export BORG_REPO="/media/nas/backups/$(hostname -s)-borgbackup"
@stemid
stemid / brew.py
Created July 24, 2012 14:07
Homebrew module for ansible
#!/usr/bin/python -tt
# (c) 2012, Stefan Midjich
# Written by Stefan Midjich <swehack@gmail.com>
#
# This module was written for Ansible.
# It doesn't support all of Homebrew yet.
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@stemid
stemid / sex.c
Last active January 13, 2024 11:49
/*sex.c*/
/* Original author unknown. Presumably this is public domain by now.
* If you are the original author or know the original author, please
* contact <freebsd@spatula.net>
*
* Orphan code cleaned up a bit by Nick Johnson <freebsd@spatula.net>
* Completely rewrote how word wrapping works and added -w flag.
*/
@stemid
stemid / password.go
Last active September 4, 2020 08:26
Create encrypted versions of passwords in go
// build: go build password.go
// run: ./password -password='clear text'
// use HISTCONTROL=ignoreboth and indent commands with one space to avoid
// saving passwords in your shell history.
package main
import (
"os"
"fmt"
@stemid
stemid / siptrack.py
Last active July 11, 2019 15:12
Ansible inventory script for Siptrack (https://github.com/sii/siptrackweb)
#!/usr/bin/env python
# Siptrack dynamic inventory script for Ansible.
# Depends on siptracklib
# * https://github.com/sii/siptracklib
#
#http://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html
#
# by Stefan Midjich <swehack at gmail dot com>
@stemid
stemid / tsm.pm
Created May 27, 2015 13:45
Simple TSM perl interface made by an old co-worker
#!/usr/bin/perl -w
# Oskar Liljeblad 2008-10-17
package TSM;
use strict;
use Encode;
$TSM::dsmadmc = 'dsmadmc';
$TSM::username = 'admin';
@stemid
stemid / defaults.cfg
Last active June 7, 2018 11:38
Boilerplate logging class I use in most my applications
# AppLogger specific config.
[logging]
log_format = %(asctime)s %(name)s[%(process)s] %(levelname)s: %(message)s
log_debug = True
log_level = INFO
# Handler can be one of file, stdout or syslog
log_handler = stdout
# Can use this to log directly to another server if need be
@stemid
stemid / pyvmomi_example1.py
Last active November 29, 2017 07:02
pyVmomi template script that demonstrates traversing objects from vcenter.
#!/usr/bin/env python
# This is sort of a template script for most operations that might have to
# recursively traverse the vcenter objects looking for something.
#
# by Stefan Midjich <swehack@gmail.com>
#
# See comments further down in the code to understand more.
# It's important to know the object structure of your vcenter so look into
# your own MOB first. It's found at https://10.11.12.13/mob on your vcenter
# server.

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

#!/usr/bin/env bash
# {{ ansible_managed }}
# vim: set filetype=bash
#
# WARNING: Have you run xtrabackup_prepare.sh first?
# WARNING: You must know what you're doing or the backup will be ruined!
shopt -s nullglob
backup_dir=/var/backups/xtrabackup