Skip to content

Instantly share code, notes, and snippets.

View andrewspiers's full-sized avatar

Andrew Spiers andrewspiers

  • Adelaide, Australia
View GitHub Profile
# Use those functions to enumerate all interfaces available on the system using Python.
# found on <http://code.activestate.com/recipes/439093/#c1>
# WARNING! Only returns interfaces with an address!
import socket
import fcntl
import struct
import array
virt-install -l http://ftp.iinet.com.au/pub/debian/debian/dists/squeeze/main/installer-amd64 --ram 512 --graphics none --name squeeze --disk /dev/vg_2012/lv_squeeze --extra-args='console=tty0 console=ttyS0,115200n8' --os-type=linux --os-variant=debiansqueeze
#!/usr/bin/python
import os
import sys
import time
purpose = "Print the age of a file rounded to the nearest second.\n"
usage = "Usage: " + sys.argv[0] + " <FILENAME>\n"
@andrewspiers
andrewspiers / iptables-dump.sh
Created May 4, 2014 23:06
iptables-dump.sh
#!/bin/bash
#dump iptables rules to a timestamped file
#requires iptables-save which is in Redhat based distributions.
set -x
set -e
DESTDIR="/root/iptables-saves"
mkdir -p ${DESTDIR}
<<COMMENT
NICE DATES
==========
I frequently want to make timestamped files.
The 'date' command built in formats all contain spaces and
colons and things I don't want in a file name.
So it is necessary to construct something.
I find myself needing to do this again and again, hopefully I can
@andrewspiers
andrewspiers / change-idrac-password.rst
Last active July 13, 2024 12:21
Change iDRAC password using OpenManage

How to change an iDRAC password using Racadm for a Dell R720 and similar servers.

TLDR:

#  racadm config -g cfgUserAdmin -o cfgUserAdminPassword -i 2 <newpassword>

This guide assumes you have OpenManage installed. It was tested with the following version of OpenManage:

@andrewspiers
andrewspiers / nodejs-wheezy-install-fail
Created March 22, 2014 10:26
Nodejs installation apt dependency failure while doing a puppet run.
Nodejs installation apt dependency failure while doing a puppet run.
notice: /Stage[main]/Etherpad::Dependencies/Package[build-essential]/ensure: ensure changed 'purged' to '
present'
notice: /Stage[main]/Etherpad::Dependencies/Package[pkg-config]/ensure: ensure changed 'purged' to 'prese
nt'
notice: /Stage[main]/Etherpad::Dependencies/Package[libssl-dev]/ensure: ensure changed 'purged' to 'prese
nt'
import socket
def dnsdomainname():
"""return the dns domain name of the current host."""
return '.'.join(socket.getfqdn().split('.')[1:])
root@wheezy71:~# gem install beaker-rspec
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: beaker requires nokogiri (= 1.5.10); fog requires nokogiri (>= 1.5.11); rbvmomi requires nokogiri (>= 1.4.1)
@andrewspiers
andrewspiers / gist:9244721
Created February 27, 2014 05:08
beaker-rspec?
root@wheezy71:/vagrant/modules/postgresql# RS_SET=debian-73-x64 rspec spec/acceptance
/usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- beaker-rspec/spec_helper (LoadError)
from /usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /vagrant/modules/puppetlabs-postgresql/spec/spec_helper_acceptance.rb:1:in `<top (required)>'
from /usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /vagrant/modules/puppetlabs-postgresql/spec/acceptance/client_spec.rb:1:in `<top (required)>'
from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:746:in `load'
from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:746:in `block in load_spec_files'
from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:746:in `map'