Skip to content

Instantly share code, notes, and snippets.

View brianjriddle's full-sized avatar

Brian Riddle brianjriddle

View GitHub Profile
@brianjriddle
brianjriddle / set_vncpasswd.rb
Created March 12, 2012 08:28
puppet snippet to create a vncpasswd in jenkins home directory
exec {'set-vncpasswd':
command => "mkdir $jenkins_home/.vnc && /bin/echo -e \"vncpasswd\\nvncpasswd\" > /tmp/pass && vncpasswd $jenkins_home/.vnc/passwd < /tmp/pass && rm /tmp/pass",
creates => "$jenkins_home/.vnc/passwd",
logoutput => true,
path => ["/bin", "/usr/bin"],
require => File[$jenkins_home],
user => $jenkins_username,
}
@brianjriddle
brianjriddle / installed-jenkins-plugins.txt
Created March 20, 2012 08:21
currently installed jenkins plugins
ant http://wiki.jenkins-ci.org/display/JENKINS/Ant+Plugin
javadoc http://wiki.jenkins-ci.org/display/JENKINS/Javadoc+Plugin
Hudson Xvnc plugin http://wiki.hudson-ci.org/display/HUDSON/Xvnc+Plugin
Maven Integration plugin http://wiki.jenkins-ci.org/display/JENKINS/Maven+2+Project+Plugin
Jenkins Rake plugin http://wiki.jenkins-ci.org/display/JENKINS/Rake+Plugin
Jenkins ruby metrics plugin http://wiki.jenkins-ci.org/display/JENKINS/Ruby+Metrics+Plugin
CVS Plugin http://wiki.jenkins-ci.org/display/JENKINS/CVS+Plugin
Hudson Ruby Plugin http://wiki.hudson-ci.org/display/HUDSON/Ruby+Plugin
Radiator View Plugin http://wiki.jenkins-ci.org/display/JENKINS/Radiator+View+Plugin
Jenkins Subversion Plug-in http://wiki.jenkins-ci.org/display/JENKINS/Subversion+Plugin
@brianjriddle
brianjriddle / dn.html
Created March 30, 2012 12:16
autodiscorvery
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>daniel nyström [danielnystrom.se]</title>
<meta name="author" content="Daniel Nyström" />
<link rel="stylesheet" type="text/css" href="/css/style.css">
<link rel="alternate" href="/atom.xml" type="application/atom+xml"/>
</head>
@brianjriddle
brianjriddle / definition.rb
Created April 18, 2012 12:06
centos 60 veewee definition
Veewee::Session.declare({
:cpu_count => '1', :memory_size=> '2048',
:disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off',
:os_type_id => 'RedHat_64',
:iso_file => "CentOS-6.0-x86_64-minimal.iso", :iso_src => "http://vault.centos.org/6.0/isos/x86_64/CentOS-6.0-x86_64-minimal.iso", :iso_md5 => "b9fff4dad7aad0edaa564d7a251cb971", :iso_download_timeout => 1000,
:iso_download_instructions => "We can not download the ISO , you need to download it yourself and put it in the iso directory\n"+
"- URL: http://isoredirect.centos.org/centos/6/isos/x86_64/ ",
:boot_wait => "10", :boot_cmd_sequence => [
'<Tab> text ks=http://%IP%:%PORT%/ks.cfg<Enter>'
],
@brianjriddle
brianjriddle / who_did_it.rb
Created April 25, 2012 08:36
what happened and when in a git repo
#!/usr/bin/env ruby
git_dir=ARGV[0].nil? ? "." : ARGV[0]
since=ARGV[1].nil? ? 7: ARGV[1]
git_log = ""
Dir.chdir(git_dir) do
git_log = %x{git log --since="#{since} days ago" --format=%an | sort | uniq -c}
end
git_data = git_log.split("\n")
total_authors = git_data.size
total_commits = 0
@brianjriddle
brianjriddle / image-checker.rb
Created April 25, 2012 13:16
checks if a page is missing alt attribute on img tags
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open(ARGV[0]))
doc.xpath('//img').each do |img|
puts img if img["alt"].nil?
end
@brianjriddle
brianjriddle / regenerate-jaxb-classes.sh
Created May 5, 2012 08:06
shell script to generate jaxb bindgs for xml
#!/bin/bash
# Requirements
# trang found here http://code.google.com/p/jing-trang/
# xjc found in in jdk 6 and above.
SOURCE_XML=src/test/resources/se/tv4/vman/api
TARGET_XSD=src/main/java/se/tv4/vman/api
for i in `echo asset category productGroups`; do
echo "generating java for $TARGET_XSD/$i"
@brianjriddle
brianjriddle / atom.xsd
Created May 5, 2012 09:52
trang xsd from my atom.xml
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/2005/Atom" xmlns:atom="http://www.w3.org/2005/Atom">
<xs:element name="feed">
<xs:complexType>
<xs:sequence>
<xs:element ref="atom:title"/>
<xs:element ref="atom:link"/>
<xs:element ref="atom:updated"/>
<xs:element ref="atom:id"/>
<xs:element ref="atom:author"/>
@brianjriddle
brianjriddle / post-merge.sh
Created May 30, 2012 09:34
git post commit hook to trigger if commit message has a key word that starts with %
#!/bin/sh
#will priint out a message if a commit contains a keyword prefixed with %
#
MARKERS="%\w+"
RELEASE=$(git log $(git reflog -n 1 | cut -d ":" -f1) | grep -Pio "$MARKERS"| sort -fu | tr '\n' ' ')
if [ "$RELEASE" != "" ];
then
@brianjriddle
brianjriddle / Asset.java
Created June 1, 2012 18:57
Parsing xml so my eyes don't bleed
import org.apache.commons.lang.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.*;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import se.tv4.teknik.vman.api.XmlDataReader;
import javax.xml.parsers.*;
import javax.xml.xpath.XPathConstants;
import java.io.*;