This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import a class from outside of Jenkins, so that we can get | |
// The external class loader being used. In our case, we're using | |
// a class from the MySQL Connector/J library, which we have in | |
// file:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext | |
import com.mysql.jdbc.Util | |
// Get a reference to the global class laoder that was used | |
/// for that class | |
def loader = Util.class.getClassLoader() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import time | |
from random import randint | |
import gc | |
import subprocess | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import division | |
import random | |
class Die(object): | |
"""The Gambler's Fallacy made manifest""" | |
def __init__(self, size): | |
self.size = size | |
self.state = [1 for i in xrange(size)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set showcmd " Show (partial) command in status line. | |
set showmatch " Show matching brackets. | |
set smartcase " Do smart case matching | |
set incsearch " Incremental search | |
set mouse=a " Enable mouse usage (all modes) | |
set encoding=utf-8 " Set default file encoding | |
syntax on " Enable syntax highlighting | |
filetype plugin indent on " When loading a syntax plugin, load filetype indent rules | |
" These are default on our servers but not necessarily elsewhere |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
gifts = ("partridge in a pear tree", "turtle doves", "french hens", | |
"calling birds", "golden rings", "geese-a-laying", "swans-a-swimming", | |
"maids-a-milking", "ladies dancing", "lords-a-leaping", "pipers piping", | |
"drummers drumming",) | |
for i in xrange(1,len(gifts)+1): | |
print "On the {} day of Christmas, my true love gave to me:".format( | |
str(i)+("th" if 4<=i%100<=20 else {1:"st",2:"nd",3:"rd"}.get(i%10, "th"))) | |
for j, gift in list(enumerate(gifts[:i],1))[::-1]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> start = time.gmtime(time.time()-(3600*24*10)) | |
>>> end = time.gmtime() | |
>>> downtimes = p.downtimesFor(p.checks[0],start,end) | |
>>> for downtime in downtimes: | |
... print downtime | |
... | |
{'duration': 0, 'to': (2009, 7, 28, 19, 0, 0.0), 'from': (2009, 7, 27, 19, 0, 0.0)} | |
{'duration': 0, 'to': (2009, 7, 29, 19, 0, 0.0), 'from': (2009, 7, 28, 19, 0, 0.0)} | |
{'duration': 0, 'to': (2009, 7, 30, 19, 0, 0.0), 'from': (2009, 7, 29, 19, 0, 0.0)} | |
{'duration': 0, 'to': (2009, 7, 31, 19, 0, 0.0), 'from': (2009, 7, 30, 19, 0, 0.0)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> for state in p.states: | |
... print state | |
... | |
{'checkName': 'webserver 1', 'checkState': 'CHECK_UP', 'lastCheckTime': (2009, 8, 6, 19, 3, 13.0)} | |
{'checkName': 'webserver 1 ssl', 'checkState': 'CHECK_UP', 'lastCheckTime': (2009, 8, 6, 19, 2, 59.0)} | |
{'checkName': 'imap server', 'checkState': 'CHECK_UP', 'lastCheckTime': (2009, 8, 6, 19, 3, 27.0)} | |
{'checkName': 'incoming smtp', 'checkState': 'CHECK_UP', 'lastCheckTime': (2009, 8, 6, 18, 58, 39.0)} | |
{'checkName': 'outgoing smtp', 'checkState': 'CHECK_UP', 'lastCheckTime': (2009, 8, 6, 18, 57, 41.0)} | |
{'checkName': 'DNS server 1', 'checkState': 'CHECK_UP', 'lastCheckTime': (2009, 8, 6, 19, 2, 38.0)} | |
{'checkName': 'DNS server 2', 'checkState': 'CHECK_UP', 'lastCheckTime': (2009, 8, 6, 19, 2, 39.0)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import pingdom | |
>>> p = pingdom.Pingdom("user@example.com","your_password","your_api_key") | |
>>> p.locations | |
['Dallas, TX, USA', 'Dallas 2, TX, USA', 'Singapore', 'Sydney, Australia', 'Mumbai, India', 'Gloucester, England', 'Sacramento, CA, USA', 'Amsterdam, Holland', 'San Francisco, CA, USA', 'Vasteras, Sweden', 'Berkeley, CA, USA', 'Vasteras 2, Sweden', 'Dallas 3, TX, USA', 'Houston, TX, USA', 'Reading, England', 'Stockholm, Sweden', 'Stockholm 2, Sweden', 'Stockholm 3, Sweden', 'Houston 2, TX, USA', 'Montreal, Canada', 'London, UK', 'Dallas 4, TX', 'Herndon, VA', 'Paris, France', 'Houston 3, TX', 'Amsterdam 2, Netherlands', 'London 2, UK'] | |
>>> p.checks | |
['webserver 1', 'webserver 1 ssl', 'imap server', 'incoming smtp', 'outgoing smtp', 'DNS server 1', 'DNS server 2', 'staging webserver', 'staging DB server', 'webserver 2', 'webserver 3'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from SOAPpy import WSDL | |
WSDLFILE = 'http://www.xmethods.net/sd/2001/TemperatureService.wsdl' | |
class wsdl(object): | |
def __init__(self,apikey): | |
self._server = WSDL.Proxy(WSDLFILE) | |
f = wsdl("blah blah blah") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Proxy balancer://fantasyappcluster> | |
BalancerMember http://fantasyweb1int retry=2 | |
BalancerMember http://fantasyweb2int retry=2 | |
BalancerMember http://fantasyweb3int retry=2 | |
BalancerMember http://fantasyweb5int retry=2 | |
BalancerMember http://fantasyweb6int retry=2 | |
BalancerMember http://fantasyweb7int retry=2 | |
</Proxy> |
NewerOlder