Skip to content

Instantly share code, notes, and snippets.

View madAndroid's full-sized avatar
🏠
Working from home

Andrew Stangl madAndroid

🏠
Working from home
View GitHub Profile
@madAndroid
madAndroid / boot.ipxe
Created April 2, 2018 10:27 — forked from uyorum/boot.ipxe
Preseed for Debian stretch (Replace "root-password-crypted" line)
#!ipxe
dhcp
initrd http://ftp.jp.debian.org/debian/dists/stretch/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz
kernel http://ftp.jp.debian.org/debian/dists/stretch/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux auto=true priority=critical url=http://${dhcp-server}/preseed.cfg suite=stretch
boot
#!/usr/bin/env python
import virtinst.util
print "UUID:\t", virtinst.util.uuidToString(virtinst.util.randomUUID())
print "MAC:\t", virtinst.util.randomMAC(type="qemu")
# for one-liner
# python -c 'from virtinst.util import *; print uuidToString(randomUUID())'
# python -c 'from virtinst.util import *; print randomMAC(type="qemu")'
require 'base64'
require 'digest/md5'
key = "your public key here"
# first decode the key
key_decoded = Base64.decode64(key)
# create an md5
md5 = Digest::MD5.hexdigest(key_decoded)
# convert that hash into a readable fingerprint
# I got tired of uploading to /tmp then moving to the correct location, so these two convenience methods will save you a lot of time in the long run.
# Helper method to upload to /tmp then use sudo to move to correct location.
def put_sudo(data, to)
filename = File.basename(to)
to_directory = File.dirname(to)
put data, "/tmp/#{filename}"
run "#{sudo} mv /tmp/#{filename} #{to_directory}"
end
@madAndroid
madAndroid / deploy.rb
Created February 13, 2013 07:40 — forked from nathany/deploy.rb
set :user, 'vagrant'
set :run_method, :sudo
role :app, '33.33.33.10'
ssh_options[:keys] = `vagrant ssh_config | grep IdentityFile`.split.last
@madAndroid
madAndroid / gist:3866941
Created October 10, 2012 17:04
Fix Price vs. T&M (Time and Material) Contracts

Some time ago the development team at my firm staged a revolt against the sales team and senior management: our demand was that no SOW* (Statement of Work) was to be sent to a customer without first being reviewed by a member of the development team. The message was clear “We refuse to be held responsible to deliver on terms in which we had no say”. Today it's not uncommon for a senior member of the development team to author an SOW in its entirety. IT people are good with documents and detail oriented. They are good at breaking down large ideas into small, manageable chunks and great at finding loopholes. In many ways IT people are better equipped than sales staff to write an SOW.  However, today I would like to explore an important aspect of any Statement of Work: the pricing model.

Though there are countless pricing models in use throughout the world, the two that are most prevalent in the IT world are:

Fixed Price (also referred to as Fixed Fee): Here both the price and the scope of wor

@madAndroid
madAndroid / psqlfix.txt
Created September 5, 2012 13:21
Change postgres default template0 to UTF8 encoding
mike@rbci:~$ psql -U postgres
psql (9.0.3)
Type "help" for help.
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';
UPDATE 1
postgres=# \c template0
You are now connected to database "template0".
template0=# update pg_database set datistemplate = FALSE where datname = 'template1';
UPDATE 1
@madAndroid
madAndroid / gem-fetch-dependencies
Created July 28, 2012 15:45 — forked from Milly/gem-fetch-dependencies
Extend 'gem fetch' command. Fetch all dependencies.
#!/usr/bin/ruby
require 'rubygems'
require 'rubygems/commands/fetch_command'
class Gem::Commands::FetchCommand
def add_version_option_with_fetch_depends
add_version_option_without_fetch_depends
add_option('-y', '--[no-]dependencies',
"Fetch dependent gems") do |value, options|