Skip to content

Instantly share code, notes, and snippets.

@robballou
robballou / gist:1706299
Created January 30, 2012 19:55
Jenkins error
WARNING: Caught exception evaluating: it.isTagged(). Reason: java.lang.NullPointerException
java.lang.NullPointerException
at hudson.scm.SubversionTagAction.isTagged(SubversionTagAction.java:157)
at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.commons.jexl.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:258)
at org.apache.commons.jexl.parser.ASTMethod.execute(ASTMethod.java:104)
at org.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:83)
at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:57)
@robballou
robballou / svnup.py
Created November 23, 2011 14:30
'svn up' all the directories
"""
Update all directories in the svn directory
"""
import sys
import os
import subprocess
def svnup(directory):
items = os.listdir(directory)
for item in items:
@robballou
robballou / gist:1358548
Created November 11, 2011 17:01
Get the instance DNS names for an AWS security group using boto
from boto.ec2.connection import EC2Connection
ec2 = EC2Connection()
reservations = ec2.get_all_instances(None, {'group-name': 'Your Group Name'})
dns_names = [instance[0].dns_name for instance in [reservation.instances for reservation in reservations]]
@robballou
robballou / gist:1319600
Created October 27, 2011 13:55
Mac Shell Customization trials
# Place in your ~/.[bash_]profile file
#
# display "username:path $ " with path in green
#
# currently works well with multiple lines, but does sometimes get a bit wonky when
# paging through history with the arrow keys:
export PS1="\u:\[\e[32;1;32m\]\W\[\e[m\] \$ "
@robballou
robballou / instance_name.py
Created October 17, 2011 16:55
Get the EC2 instance name
"""
Get the EC2 instance name (tag "Name") for the instance
Usage:
python instance_name.py [instance id]
On an EC2 instance, you can run:
python instance_name.py `ec2metadata --instance-id`
# your merge test command
svn merge --dry-run -r 100:HEAD http://example.com/svn/repo/trunk .
# go ahead and run it after everything looks ok...
^--dry-run ^^
@robballou
robballou / gist:1040490
Created June 22, 2011 16:36
Rotatelib EC2 example
import datetime
import rotatelib
"""
When you call list_archives or remove_items with an ec2snapshots argument, the library
will look in your environment variables for AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
If you do not want to use environment variables, you can pass those in as keyword args
(aws_access_key_id and aws_secret_access_key).
"""
@robballou
robballou / sha.py
Created May 31, 2011 21:06
Hash strings using a number of different algorithms
#!/usr/bin/env python
"""
Output hash for a string
If not string is specified, then prompt for one (good for passwords). By default
the script will use SHA1, but you can specify any of the following:
--all (or -a)
--base64 (or -b)
@robballou
robballou / gist:929564
Created April 19, 2011 20:31
Example python of how to add DNS entries to Amazon's Route 53 with the boto library
from boto.route53.connection import Route53Connection
# your amazon keys
key = ""
access = ""
if __name__ == '__main__':
zones = {}
route53 = Route53Connection(key, access)
@robballou
robballou / channels.sh
Created February 25, 2011 15:59
Find the number of channels in an audio file
#!/bin/bash
#
# Usage:
# ./channels.sh [filename]
#
echo "$1: " `ffmpeg -i "$1" 2>&1 | awk '/[[:digit:]] channels?/ {print "Channels:",$7}'`