Skip to content

Instantly share code, notes, and snippets.

View psftw's full-sized avatar
👽

Peter Salvatore psftw

👽
View GitHub Profile
@psftw
psftw / gist:7093327
Created October 22, 2013 00:33
Example of HTTP 500 error
GET /data-production/53f79439de04cf3eb98623c06c0ada91b931cfd6?filename=axis2-adb-0.95.jar HTTP/1.1
User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Host: 966b.http.dal05.cdn.softlayer.net
Accept: */*
Via: 1.1 mai01-iprxy-01p.clairmail.local (squid/3.3.8)
X-Forwarded-For: unknown
Cache-Control: max-age=0
Connection: keep-alive
HTTP/1.1 500 Internal Server Error
@psftw
psftw / gist:7044973
Created October 18, 2013 17:30
ansible apt_repository info on Mint 14 and 15
$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from aptsources import distro
>>> d = distro.get_distro()
>>> d.description
u'Linux Mint 15 Olivia'
>>> isinstance(d, distro.DebianDistribution)
False
@psftw
psftw / gist:6563872
Created September 14, 2013 17:29
quick hack to verify checksums when moving to new artifactory server, preceded by dependency:copy-dependencies and followed by vimdiff
import os
import os.path as osp
import hashlib
data = []
for path, dirnames, fnames in os.walk('.'):
if path.endswith('art'):
for fname in fnames:
sha1 = hashlib.sha1(open(osp.join(path, fname)).read()).hexdigest()
@psftw
psftw / gist:6127652
Created August 1, 2013 01:04
jenkins mass fix subversion credentials
from glob import glob
import xml.etree.ElementTree as ET
credentials = {"example.com": ("username", "jumbledpassword") }
for cfile in glob("jobs/*/subversion.credentials"):
tree = ET.parse(cfile)
entries = tree.findall('//entry')
for entry in entries:
url = entry.find('string')
@psftw
psftw / gist:6127618
Created August 1, 2013 00:57
queue 56 jobs at once
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
1 0 98 0 0 0| 219k 300k| 0 0 | 102B 134B| 806 1227
13 16 47 23 0 0| 163M 3444k| 842k 932k| 0 0 |5471 4033
7 16 58 20 0 0| 180M 1680k| 106k 188k| 0 0 |4999 3946
1 6 55 38 0 0| 46M 90M| 38k 55k| 0 0 |1868 1618
0 12 69 18 0 0| 126M 40M| 28k 34k| 0 0 |3124 2820
1 2 59 39 0 0|2692k 125M| 32k 45k| 0 0 |1014 822
0 1 50 48 0 0|4096k 6916k| 13k 16k| 0 0 |1134 839
1 3 42 55 0 0|4480k 130M| 17k 19k| 0 0 | 953 955
@psftw
psftw / gist:6090377
Created July 26, 2013 16:45
hmmm... what were those commonly used sed commands?
$ grep -h "sed" jobs/*/config.xml | sed s/\&apos\;/\'/ | sed s/\&quot\;/\"/ | sort | uniq | less
@psftw
psftw / gist:6067973
Created July 24, 2013 03:58
cap jenkins retention policies and identify those without policies at all
from glob import glob
import xml.etree.ElementTree as ET
# fix bad retention policies
maxkeep = 20
maxakeep = 20
nopolicy = []
for cfile in glob("jobs/*/config.xml"):
tree = ET.parse(cfile)
@psftw
psftw / gist:6067799
Created July 24, 2013 03:05
check for build jobs without sane retention policies
import os
from glob import glob
# check for build jobs without sane retention policies
data = []
for bdir in glob("jobs/*/builds"):
walkgen = os.walk(bdir)
dirpath, dirnames, filenames = walkgen.next()
data.append((len(dirnames), bdir))
from glob import glob
bullshit = "<hudson.plugins.statusmonitor.MonitorPublisher/>"
for cfile in glob("jobs/*/config.xml"):
ftxt = open(cfile).read()
ftxt = ftxt.replace(bullshit, "\n")
f = open(cfile, 'w')
f.write(ftxt)
f.close()
@psftw
psftw / gist:5787035
Created June 15, 2013 05:30
jenkins configuration slicing
Status Code: 500
Exception:
Stacktrace:
java.lang.NullPointerException
at configurationslicing.BooleanSlice.get(BooleanSlice.java:39)
at configurationslicing.BooleanSlicer.transform(BooleanSlicer.java:36)
at configurationslicing.BooleanSlicer.transform(BooleanSlicer.java:8)
at configurationslicing.ConfigurationSlicing$SliceExecutor.transform(ConfigurationSlicing.java:135)
at configurationslicing.ConfigurationSlicing$SliceExecutor.doSliceconfigSubmit(ConfigurationSlicing.java:179)