Skip to content

Instantly share code, notes, and snippets.

@apemberton
apemberton / Geolocation on IE9 - IP.txt
Created February 14, 2011 18:16
Geolocation on IE9 through VMWare (no wireless support)
POST https://inference.location.live.net/inferenceservice/v21/Pox/GetLocationUsingFingerprint HTTP/1.1
Accept: */*
Accept-Language: en-us
Content-Type: text/xml
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host: inference.location.live.net
Content-Length: 595
Connection: Keep-Alive
Cache-Control: no-cache
@apemberton
apemberton / Geolocation on IE9 - Internal Wireless.txt
Created February 14, 2011 18:18
Geolocation on IE9 (with wireless support)
POST https://inference.location.live.net/inferenceservice/v21/Pox/GetLocationUsingFingerprint HTTP/1.1
Accept: */*
Accept-Language: en-us
Content-Type: text/xml
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host: inference.location.live.net
Content-Length: 1066
Connection: Keep-Alive
Cache-Control: no-cache
@apemberton
apemberton / jenkins-quick-start.sh
Last active August 27, 2015 14:18
A quick snippet that disables some network services for a quick, local Jenkins startup
export JENKINS_HA=false && java -DJENKINS_HOME=/Users/apemberton/JENKINS_HOMES/1.609 -Dhudson.udp=-1 -Dhudson.DNSMultiCast.disabled=true -Djava.awt.headless=true -Xmx1024m -Xms256m -XX:MaxPermSize=1024m -Xdebug -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n -jar jenkins.1.609.1.1.war
@apemberton
apemberton / flow.groovy
Last active September 16, 2015 14:47
Docker Workflow snippet
stage 'Build Source'
node('docker') {
docker.image('maven:3.3.3-jdk-8') {
git 'https://github.com/cloudbees/mobile-deposit-api.git'
sh 'mvn clean package'
}
}
node('docker') {
docker.withServer('tcp://docker.beedemo.net:2376', 'docker-beedemo-creds'){
stage 'build'
node {
git 'https://github.com/cloudbees/todo-api.git'
withEnv(["PATH+MAVEN=${tool 'm3'}/bin"]) {
sh "mvn -DskipTests=true clean package"
}
stash excludes: 'target/*', includes: '**', name: 'source'
}
stage 'test'
/*** BEGIN META {
"name" : "Count executors",
"comment" : "Shows the total number of nodes and executors on Jenkins",
"parameters" : [ ],
"core": "1.350",
"authors" : [
{ name : "Andy Pemberton" }
]
} END META**/
import jenkins.model.Jenkins
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1' )
import static groovyx.net.http.Method.GET
import static groovyx.net.http.ContentType.*
def http = new groovyx.net.http.HTTPBuilder('http://stats.jenkins-ci.org/')
def plugins
http.request(GET,HTML) { req ->
uri.path = '/plugin-installation-trend/'
[{
"type": "OperationsCenter",
"name": "OperationsCenter",
"url": "http://jenkins.beedemo.net/",
"cores": 2,
"nodes": [
{
"type": "MasterComputer",
"name": "master",
"executors": 2
@apemberton
apemberton / count-cjoc-json.groovy
Created January 25, 2016 13:57
A single, CJOC script that counts executors, nodes, clouds, & cores across masters and on CJOC itself.
import com.cloudbees.opscenter.server.model.*;
import com.cloudbees.opscenter.server.clusterops.steps.*;
import hudson.remoting.*;
def cjoc = getHost(new LocalChannel(), OperationsCenter.class.simpleName, OperationsCenter.class.simpleName)
cjoc.masters = []
Jenkins.instance.getAllItems(ConnectedMaster.class).each {
cjoc.masters.add(getHost(it.channel, it.class.simpleName, it.encodedName))
}
import com.cloudbees.opscenter.server.model.*;
import com.cloudbees.opscenter.server.clusterops.steps.*;
import hudson.remoting.*;
def cjoc = getHost(new LocalChannel())
cjoc.masters = []
Jenkins.instance.getAllItems(ConnectedMaster.class).each {
cjoc.masters.add(getHost(it.channel))
}