Skip to content

Instantly share code, notes, and snippets.

View DavidWittman's full-sized avatar

David Wittman DavidWittman

View GitHub Profile
@DavidWittman
DavidWittman / supermicro-java-console.sh
Last active March 13, 2022 04:06
Retrieves the plaintext JNLP for the iKVM console from a SuperMicro IPMI webserver
#!/usr/bin/env bash
# Retrieves the plaintext JNLP from a SuperMicro IPMI webserver
# Usage: supermicro-java-console.sh <hostname>
# supermicro-java-console.sh 10.1.2.34 > login.jnlp
set -x
HOST="$1"
IPMI_USER=${IPMI_USER:-ADMIN}
@DavidWittman
DavidWittman / mongo-ansible.py
Last active April 18, 2023 18:16
MongoDB-backed dynamic inventory script for Ansible
#!/usr/bin/env python
#
# MongoDB-backed dynamic inventory script for Ansible
# http://docs.ansible.com/intro_dynamic_inventory.html
import os
from argparse import ArgumentParser
import pymongo
@DavidWittman
DavidWittman / cgminer-antminer-u1-usb.md
Created March 14, 2014 04:46
Mining Dogecoin/Litecoin with cgminer and the Antminer U1 USB.

Using cgminer with the Bitmain Antminer U1 USB

Download

Download the latest version of cgminer. At the time of writing, this is version 4.1.0.

$ wget http://ck.kolivas.org/apps/cgminer/cgminer-4.1.0.tar.bz2
$ tar xf cgminer-4.1.0.tar.bz2
$ cd cgminer-4.1.0
@DavidWittman
DavidWittman / 99-motd-segfaults
Last active December 31, 2015 02:29
I hope I never need this again.
#!/bin/bash
SECONDS_SINCE_LAST_SEGFAULT=$(( $(date '+%s') - $(date -d "$(fgrep segfault /var/log/syslog | tail -1 | awk '{ print $1,$2,$3 }')" '+%s') ))
echo "IT HAS BEEN"
echo -ne "\e[00;33m"
figlet -f big $SECONDS_SINCE_LAST_SEGFAULT
echo -ne "\e[00m"
echo "SECONDS SINCE THE LAST SEGFAULT!"

Create a Windows OpenStack VM with VirtualBox

0. Obtain Windows ISO

  • Use an existing ISO or copy from a CD with dd if=/dev/cdrom of=image.iso

1. Boot VirtualBox VM from Windows ISO

  • Qcow disk type
  • 40GB Root Disk
  • Load your Windows ISO to the Primary CD drive
  • Add a secondary CD drive and attach the VirtIO ISO to it
Vagrant.configure("2") do |config|
config.vm.box = "dummy"
config.vm.synced_folder './vagrant', '/vagrant'
config.ssh.private_key_path = File.expand_path("~/.ssh/id_rsa")
ENV['VAGRANT_DEFAULT_PROVIDER'] = "rackspace"
config.vm.provider :rackspace do |rs, override|
override.vm.box = 'dummy'
override.vm.box_url = 'https://github.com/mitchellh/vagrant-rackspace/raw/master/dummy.box'
@DavidWittman
DavidWittman / nova_nuke.py
Last active December 24, 2015 16:49
Nova Nuke: Forcefully removes an instance from the Nova database. Useful for cleaning up instances stuck in an 'error' or 'deleting' state.
#!/usr/bin/env python
#
# nova_nuke.py
# usage: nova_nuke.py <uuid>
#
# Forcefully removes an instance from the Nova database.
# Useful for destroying instances stuck in an 'error' or 'deleting' state.
#
# Completes the following actions:
@DavidWittman
DavidWittman / openvswitch-bridges
Last active December 24, 2015 08:19
Init script to bring up Open vSwitch bridges at boot time on Ubuntu/Debian
#!/bin/bash
#
# openvswitch-bridges
#
# Brings up Open vSwitch bridges at boot time on Ubuntu/Debian.
# Needs to start _after_ the OVS services. This usually works:
#
# update-rc.d openvswitch-bridges defaults 21
#
### BEGIN INIT INFO
@DavidWittman
DavidWittman / quantum-ovs-bridges.conf
Last active December 24, 2015 03:49
Upstart job to automatically bring up OVS bridges at boot time
description "Quantum Open vSwitch bridge ifup"
author "David Wittman <david.wittman@rackspace.com>"
start on started quantum-plugin-openvswitch-agent
console log
# Use post-start script instead of script so it only runs once
post-start script
SLEEP=10
DEPLOY_SCRIPT_URL = "https://github.com/rsoprivatecloud/openstack-chef-deploy/raw/master/deploy.sh"
Vagrant.configure("2") do |config|
config.vm.box = "dummy"
config.vm.synced_folder './vagrant', '/vagrant'
config.ssh.private_key_path = File.expand_path("~/.ssh/id_rsa")
ENV['VAGRANT_DEFAULT_PROVIDER'] = "rackspace"
config.vm.provider :rackspace do |rs, override|