Skip to content

Instantly share code, notes, and snippets.

View andrewspiers's full-sized avatar

Andrew Spiers andrewspiers

  • Melbourne, Australia
View GitHub Profile
import sys
def seconds(line):
"""
convert a string like 5:32
which means five minutes 32 seconds
to one like 332 (seconds)
"""
splitted = line.split(":")
assert len(splitted) == 2
@andrewspiers
andrewspiers / speedjenkins.sh
Created October 16, 2013 15:49
speed jenkins with puppet for centos 6
#!/bin/bash
#install puppet
rpm -ivh http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-7.noarch.rpm
#puppet one liner to install java (works as well as yum -y install)
puppet apply -e 'package {"java-1.7.0-openjdk": ensure => installed, }'
#grab someone else's code to install jenkins:
puppet module install maestrodev/jenkins
#use it
puppet apply -e 'include jenkins'
@andrewspiers
andrewspiers / BuildingOfflineDocumentationForSetuptools
Last active January 1, 2016 16:08
Building Offline Documentation for Setuptools
Building Offline Documentation for Setuptools
---------------------------------------------
1. Download setuptools from pypi
2. Navigate to the top level directory, that contains setup.py
3. >>> python setup.py build-sphinx
There is a Makefile in the docs directory
that gets used to build the documentation, but it cannot be used directly
from that directory.
@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'
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)
import socket
def dnsdomainname():
"""return the dns domain name of the current host."""
return '.'.join(socket.getfqdn().split('.')[1:])
@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'
@andrewspiers
andrewspiers / change-idrac-password.rst
Last active October 22, 2018 07:30
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:

<<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 / 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}