Skip to content

Instantly share code, notes, and snippets.

param(
[string]$type=$(Throw "Parameter Missing: -type ?barebone/webserver/database?"),
[string]$machinename=$(Throw "Parameter missing: -machinename <MACHINENAME>"),
[string]$size=$(Throw "Parameter missing: -size ?small/medium/large?"),
[string]$vlan=$(Throw "Parameter missing: -vlan ?TRAF-TRU/TRAF-TEST/TRAF-DMZ?"),
[string]$creator=$(Throw "Parameter missing: -creator <CREATOR>")
)
#set numCPU and memory according to size
Switch ($size)
@thattommyhall
thattommyhall / DeployServer.ps1
Created October 6, 2010 15:20
Citrix script
param(
[string]$type=$(Throw "Parameter Missing: -type ?barebone/webserver/database?"),
[string]$machinename=$(Throw "Parameter missing: -machinename <MACHINENAME>"),
[string]$size=$(Throw "Parameter missing: -size ?small/medium/large?"),
[string]$vlan=$(Throw "Parameter missing: -vlan ?TRAF-TRU/TRAF-TEST/TRAF-DMZ?"),
[string]$creator=$(Throw "Parameter missing: -creator <CREATOR>"),
[string]$ipaddress=$(Throw "Parameter missing: -ip <IPADDRESS>")
)
$vms = Get-VM
@thattommyhall
thattommyhall / gist:706994
Created November 19, 2010 19:24
FULL OF WIN
> map <- expression({
+ lapply(seq_along(map.values),function(r){
+ x <- runif(map.values[[r]])
+ rhcollect(map.keys[[r]],c(n=map.values[[r]],mean=mean(x),sd=sd(x)))
+ })
+ })
>
> z <- rhmr(map, ofolder="/tmp/test", inout=c('lapply','sequence'),
+ N=10,mapred=list(mapred.reduce.tasks=0),jobname='test')
Error: could not find function "rhmr"
#sort out GPG shiz (I did it for the cloudera stuff too)
gpg --keyserver pgp.mit.edu --recv-key E2A11821
gpg -a --export E2A11821 | sudo apt-key add -
#add to /etc/sources.list.d/
#R.list
deb http://rh-mirror.linux.iastate.edu/CRAN/bin/linux/ubuntu hardy/
apt-get install r-base r-base-dev pkg-config littler
@thattommyhall
thattommyhall / filter_standard_in.rb
Created February 2, 2011 16:00
Not bothering to learn Sed and Awk
#!/usr/bin/env ruby
ARGF.each_with_index do |line, i|
puts line if line =~ /AirPort/ and i % 5 == 0
end
@thattommyhall
thattommyhall / john.rb
Created February 10, 2011 15:25
The AI for the ScroobyDoll
class John
def like_your_work
puts 'I like your work'
end
def x_your_face x
puts "I'll #{x} your face"
end
end
@thattommyhall
thattommyhall / create_contact.rb
Created February 16, 2011 23:27
Create a contact in FreeAgent using freeagent_api from https://github.com/aaronrussell/freeagent_api
require 'freeagent_api'
include Freeagent
Freeagent.authenticate({
:domain => 'tthuk.freeagentcentral.com',
:username => 'tom@tthuk.com',
:password => 'NotMyRealPassword'})
Contact.new({ :first_name => 'Tom',
:last_name => 'Hall',
@thattommyhall
thattommyhall / sinatraHTML5
Created February 18, 2011 17:11
Getting Sinatra to output nice HTML5
configure do
set :haml, { :attr_wrapper => '"', :format => :html5 }
end
@thattommyhall
thattommyhall / sig-rescue-E.rb
Created February 24, 2011 16:37
Playing with signals in Ruby
puts "I have PID #{Process.pid}"
Signal.trap("USR1") {puts "prodded me"}
loop do
begin
puts "doing stuff"
sleep 10
rescue Exception => e
puts e.inspect
@thattommyhall
thattommyhall / hive.conf
Created March 9, 2011 18:22
Upstart script for hive
start on runlevel [2345]
stop on runlevel [06]
respawn
expect fork
script
export HOME="/home/deploy"
export JAVA_HOME="/usr/lib/jvm/java-6-sun"
export HIVE_HOME="/usr/lib/hive"