Skip to content

Instantly share code, notes, and snippets.

View chrix2's full-sized avatar

Christian Ramírez Arévalo chrix2

View GitHub Profile
@chrix2
chrix2 / pkcs7.py
Created November 29, 2012 19:40
Padding PKCS7 on python
import binascii
import StringIO
class PKCS7Encoder(object):
def __init__(self, k=16):
self.k = k
## @param text The padded text for which the padding is to be removed.
# @exception ValueError Raised when the input padding is missing or corrupt.
def decode(self, text):
@chrix2
chrix2 / gist:2232656
Created March 29, 2012 02:34
Get parent build Jenkins
def myJob = hudson.model.Hudson.instance.getItem("My_Job")
def lastBuild = myJob.getLastBuild()
def cause = lastBuild.getCause(hudson.model.Cause$UpstreamCause)
def parentBuildNum = cause.upstreamBuild
def parentJobName = cause.upstreamProject
def parentJobUrl = cause.upstreamUrl
println(parentBuildNum)
println(parentJobName)
println(parentJobUrl)