Skip to content

Instantly share code, notes, and snippets.

@boltronics
boltronics / euca-update-fingerprints
Last active August 29, 2015 14:10
Update ECDSA SSH fingerprints of EC2 (and probably Eucalyptus) instances based on console output from images generated via debian-image-builder.
#!/bin/bash
# You may need to adjust these.
declare -r euca_describe_instances='euca-describe-instances'
declare -r euca_get_console_output='euca-get-console-output'
declare -r known_hosts="${HOME}/.ssh/known_hosts"
# You shouldn't need to touch anything below this line.
declare -r temp_dir="$(mktemp -d /tmp/$(basename ${0}).XXXXXXXX)"
declare -r host_list="${temp_dir}/host_list"
### Keybase proof
I hereby claim:
* I am boltronics on github.
* I am adam_bolte (https://keybase.io/adam_bolte) on keybase.
* I have a public key whose fingerprint is 1C2D 178E EBBE BE08 0A5D EBE2 4D8C FD39 34A6 2048
To claim this, I am signing this object:
@boltronics
boltronics / mmap
Last active August 29, 2015 14:20
Make Me A Password
#!/usr/bin/env bash
#
# Copyright (C) 2012-2014 Jason A. Donenfeld <Jason@zx2c4.com>
# Copyright (C) 2015 SitePoint Pty Ltd.
#
# This file is licensed under the GPLv2+.
#
# Make Me A Password
#
# Generate a random password and copy it to the clipboard. Some code
@boltronics
boltronics / manage_bash_traps.sh
Last active April 6, 2022 02:53
manage_bash_traps.sh
#!/bin/bash
# Get the commands associated with a specific signal.
function get_current_trap()
{
local -r trap="${1-EXIT}"
# It does not seem possible to print commands set for ERR
if [ "${trap}" != "ERR" ]
then
@boltronics
boltronics / winedeps
Created April 16, 2016 10:31
List Wine package dependencies for a custom 64-bit installation build in conjunction with a 32-bit chroot.
#!/bin/bash
#
# Script to print out package names of dynamically-linked Wine libraries, which
# is helpful when an installed 64-bit Wine was built with the help of a 32-bit
# chroot.
#
# Horribly hacky script. Do not put much trust in it, as it does not check if
# we need to link to a 32-bit or 64-bit library, and just try to install both
# of everything, minus a few packages that are known to conflict, as well as a
# few extra packages that include libraries which don't seem to be linked
@boltronics
boltronics / vm_tracker
Last active May 25, 2016 07:06
Prototype code for tracking virtual machines and their dependencies (eg. NFS client VMs depend on a NFS server VM)
#!/usr/bin/env python
class VirtualMachines(object):
def __init__(self):
self.virtual_machines = {}
def add_vm(self, name, vm_dom, dependencies=[]):
"""Add a virtual machine domain entry
#!/bin/bash -e
#
# Copyright 2014-2016 Adam Bolte <abolte@systemsaviour.com>
#
# This program 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
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
resolvconf:
pkg:
- installed
/etc/resolvconf/resolv.conf.d/base:
file.append:
- text: search {{ salt['cmd.run'](cmd='/bin/dnsdomainname', python_shell=True) }}
- require:
- pkg: resolvconf
@boltronics
boltronics / apt-changer
Created October 4, 2017 22:59
apt-changer
#!/bin/bash -e
# Copyright (c) 2017 Adam Bolte
#
# This program 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
# (at your option) any later version.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@boltronics
boltronics / salt-pkg-builder.sh
Created July 17, 2018 02:12
Hacky script to build Salt packages for Debian with pbuilder and repo.saltstack.com packaging data
#!/bin/bash -e
# The tag name (or branch) of whatever you want to package.
declare -r tag="${1-v2017.7.5}"
declare -r pbuilder_target="${2-stretch}"
declare -r git_dir=./salt
# This makes no sense to me. Why are these different?
declare -r salt_upstream_version="${tag:1}"