Skip to content

Instantly share code, notes, and snippets.

View mlbright's full-sized avatar

Martin-Louis Bright mlbright

  • Toronto
  • 21:32 (UTC -04:00)
View GitHub Profile
@mlbright
mlbright / build.go
Created October 25, 2014 19:11
shell script-ish example
package main
import (
"io/ioutil"
"log"
"os"
"os/exec"
)
const compile_script = "run.sh"
// This script is for Jenkins' Groovy console, and sets a timeout
// strategy for any job which doesn't have one.
// Based on http://janmaterne.wordpress.com/2010/07/11/how-to-check-if-all-hudson-jobs-have-a-timeout/
// Updated and modified by Sean Flanigan.
String describe(strat) {
if (strat instanceof hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy) {
return "Elastic(${strat.timeoutPercentage}, ${strat.numberOfBuilds}, ${strat.timeoutMinutesElasticDefault})"
} else if (strat instanceof hudson.plugins.build_timeout.impl.AbsoluteTimeOutStrategy) {
return strat.timeoutMinutes
#!/usr/bin/python
# take a master css file and inject @import css files into it.
import re, os, sys
bigcss = []
path = sys.argv[1]
output = sys.argv[2]
#!/bin/bash
# remove all svn:external references
# in a bunch of numbered directories
for i in {2..17}
do
echo $i
svn propdel svn:externals package.$i/build
done
#!/usr/bin/python
# read an svn parent page and export everything
import re
import urllib2
from BeautifulSoup import BeautifulSoup
from subprocess import call
import os
subversion = 'http://subversion.tigris.org/'
#!/bin/bash
# rsync pull from remote to local
rsync -azv --rsync-path=/usr/local/bin/rsync --delete --force jira@<some ip>:attachments/ /var/jira/jira-data/attachments/
#!/usr/bin/python
# vim settings python
print "yes"
# vim: set et ts=4 sw=4 tw=72 nu:
#!/bin/bash
# better grep if you use svn
# Copyright 2004 Ben Reser <ben@reser.org>
# Licensed under the terms subversion ships under or GPLv2.
# Useful for greping in a subversion working copy.
# Essentially it behaves the same way your grep command does (in fact it
# ultimately calls the grep command on your path) with a few exceptions.
# Ignores the subversion admin directories (.svn) and vi(m) backup files.
#!/usr/bin/python
# Ou bouffer a Paris
import urllib2
import re
import time
import random
import sys
try:
import json
#!/usr/bin/python
# primes up to 10000
# Steve Krenzel's code
r,e,a = range,enumerate,all
for i,x in e(i for i in r(4,10**4) if a(i%j!=0 for j in r(3,i))):
print x