Skip to content

Instantly share code, notes, and snippets.

@ejhayes
ejhayes / install_puppet_agent_windows.cmd
Created July 17, 2012 17:22
Puppet windows bootstrap
echo This is a test
pause
@ejhayes
ejhayes / install_puppet_agent_ubuntu.sh
Created July 13, 2012 03:16
Install puppet agent silently
#!/bin/bash
function check_fail {
if [[ $? -ne 0 ]]; then
echo "[FAIL] $1"
exit 1
fi
}
# Check puppet information
@ejhayes
ejhayes / dummyPackage.pp
Created July 3, 2012 18:35
Install a debian package locally using puppet
class dummyPackage {
package { 'yourpackagename':
ensure => installed|absent,
provider => dpkg,
source => '/path/to/file.deb',
}
}
class { 'dummyPackage': }
@ejhayes
ejhayes / install_puppet_ubuntu_10.04.sh
Created July 3, 2012 18:06
ubuntu 10.04 puppet update and install
#!/bin/sh
echo -e "deb http://apt.puppetlabs.com/ lucid main\ndeb-src http://apt.puppetlabs.com/ lucid main" >> /etc/apt/sources.list.d/puppet.list
apt-key adv --keyserver keyserver.ubuntu.com --recv 4BD6EC30
apt-get update
apt-get install puppet
@ejhayes
ejhayes / README.md
Created June 6, 2012 01:12
Debugging Hubot Scripts using Node Inspector

About

Use node-inspector to debug hubot!

sudo npm install -g node-inspector

Run Hubot in Debug Mode

coffee --nodejs --debug $(which hubot)

@ejhayes
ejhayes / extract_regex_elements.pl
Created March 6, 2012 03:02
Using perl to extract elements from regex into an array
use Data::Dumper;
$s = "1-19A";
@a = $s =~ m/(\d+)\-(\d+)([A-Z])?/i;
print Dumper(@a)
@ejhayes
ejhayes / readme.md
Created February 7, 2012 00:03
Using rsync to show progress of copying files (even if it is just locally)

Using rsync to show progress on copying files locally

rsync - --progress /path/TO/copy /path/TO/dest

@ejhayes
ejhayes / regex.ps
Created December 14, 2011 01:33
Powershell Matching Regex
([regex]'\/([\w|\.]+)$').matches("http://somerandomwebsite.com/branches/4.8release")[0].Groups[1].Value
sub versions {
my ($s) = @_;
# get a summary of the actions for this build (in some cases all versions will be the same)
my $sth = BS::db::action->db_Main->prepare(<<SQL);
select max(action_id) from actions where build_id = ? group by branch_id, revision, storm_branch_id, storm_revision, build_id;
SQL
$sth->execute($s->id);
return BS::db::action->sth_to_objects($sth);
sub duplicateAction {
my ($s, $context) = @_;
my ($oldAction, $newAction) = eval {
# verify correct arguments specified
map { if(!exists($Form->{$_})) { die "invalid arguments"; } } qw(build type target);
BS::db::action->do_transaction(sub{
my $actionType = BS::db::actionType->find_or_create( name => $Form->{type} );
my $target = BS::db::target->find_or_create( name => $Form->{target} );