Skip to content

Instantly share code, notes, and snippets.

View protocol7's full-sized avatar
🤡
Cat herding

Niklas Gustavsson protocol7

🤡
Cat herding
View GitHub Profile
@protocol7
protocol7 / gist:474207
Created July 13, 2010 17:30
Groovy script for listing build timeouts and suggested timeouts for all builds
hudsonInstance = hudson.model.Hudson.instance
allItems = hudsonInstance.items
activeJobs = allItems.findAll{job -> job.isBuildable()}
println "Cur | Est | Name"
activeJobs.each { job ->
wrapper = job.getBuildWrappersList().findAll{it instanceof hudson.plugins.build_timeout.BuildTimeoutWrapper }[0]
currentTimeout = (wrapper != null) ? wrapper.timeoutMinutes : ""
hudsonInstance = hudson.model.Hudson.instance
allItems = hudsonInstance.items
activeJobs = allItems.findAll{job -> job.isBuildable()}
defaultFailBuild = false
println "Cur | Est | Name"
activeJobs.each { job ->
// Get the Timeout-PlugIn
wrapper = job.getBuildWrappersList().findAll{it instanceof hudson.plugins.build_timeout.BuildTimeoutWrapper }[0]
NamingEnumeration<NameClassPair> e = kivSchema.list("AttributeDefinition");
while(e.hasMore()) {
String kivAttributeName = e.next().getName();
String fullName = "AttributeDefinition/" + kivAttributeName;
Attributes attributes = kivSchema.getAttributes(fullName);
String attrName = (String) attributes.get("NAME").get();
if(attrName.startsWith("hsa")) {
System.out.println(attrName);
import org.apache.pdfbox.examples.fdf.PrintFields;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
import org.apache.pdfbox.pdmodel.interactive.form.PDCheckbox;
import org.apache.pdfbox.pdmodel.interactive.form.PDTextbox;
public class Main {
Random rnd = new Random();
int wins = 0;
int runs = 100000;
for(int r = 0; r<runs; r++) {
boolean[] doors = new boolean[3];
doors[rnd.nextInt(3)] = true;
int choosen = rnd.nextInt(3);
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<generator version="3.3.3 (.3 5)">Alfresco (Enterprise)</generator>
<title>VGR Published documents feed for content modified between Fri, 04 Feb 2011 12:04:21 GMT and Fri, 04 Feb 2011 13:34:21 GMT</title>
<updated>2011-02-04T14:34:21.165+01:00</updated>
<icon>http://vgdb0206.vgregion.se:8080/alfresco/images/logo/AlfrescoLogo16.ico</icon>
<author>
<name>unknown</name>
</author>
</feed>
[03/24/11 21:59:38] [SSH] Opening SSH connection to minerva.apache.org:22.
[03/24/11 21:59:41] [SSH] Authenticating as hudson with /home/hudson/.ssh/id_rsa.
[03/24/11 21:59:41] [SSH] Authentication successful.
[03/24/11 21:59:41] [SSH] The remote users environment is:
BASH=/bin/bash
BASHOPTS=cmdhist:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
SVN_REPO=https://svn.apache.org/repos/asf/incubator/deft/sandbox/
export SVN_REPO
GIT_REPO=https://github.com/rschildmeijer/deft.git
export GIT_REPO
# init to set SSL cert if needed
svn log -l 1 $SVN_REPO
git svn clone $SVN_REPO
@protocol7
protocol7 / gist:3216865
Created July 31, 2012 12:51
Göteborg kids programming meetups
* Kids (at least mine) loves computers and being able to make them do things
* Meetup group, loosly formed (no "förening" or like that)
** http://coderdojo.com/ and/or http://www.meetup.com/
* Monthyly or so events
* Locate events at different hosts: library, schools, (parents) companies
* Soft drinks+pizza, rely on parent employer sponsorship?
* Target ~6-15 year olds
** Require parents below a certain age, coderdojo uses 12 years
import time
import httplib2
url = "http://heads.spotify.com/head/aff58dfd20368dbc5e43855d3a74508a546dc99f"
h = httplib2.Http()
while True:
resp, content = h.request(url)
print(resp)