Skip to content

Instantly share code, notes, and snippets.

@nextrevision
nextrevision / deleteJenkinsJobs.groovy
Created December 3, 2015 17:30
Groovy script to delete all jenkins jobs that match a regex pattern
import jenkins.model.*
def matchedJobs = Jenkins.instance.items.findAll { job ->
job.name =~ /my_regex_here/
}
matchedJobs.each { job ->
println job.name
//job.delete()
}
@nextrevision
nextrevision / pulp_upload.py
Last active September 9, 2023 12:08
Upload RPM to Pulp Repository and Publish
#!/usr/bin/env python
import os
import sys
import requests
import argparse
import json
import time
pulp_user = 'admin'
@nextrevision
nextrevision / extract_iso.sh
Created March 19, 2015 16:02
Uses isoinfo to extract all contents of an ISO to the given output directory
#!/bin/bash
# Description:
# Extracts all contents of an ISO to the given output directory
# Requires:
# Packages: genisoimage
ISO=$1
OUTDIR=${2:-"./out"}
usage() {
@nextrevision
nextrevision / Dockerfile
Last active April 2, 2021 00:58
Sempl Workflow with Docker Container
FROM ubuntu:trusty
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y apache2 wget
RUN wget -O /usr/local/bin/sempl \
https://raw.githubusercontent.com/nextrevision/sempl/0.2.1/sempl
RUN chmod 755 /usr/local/bin/sempl
ADD index.html.tmpl /app/index.html.tmpl
// from http://stackoverflow.com/a/34520110
node {
echo "I am a "+getClass().getName()
echo "PARAMETERS"
echo "=========="
echo getBinding().getVariables().getClass().getName()
def myvariables = getBinding().getVariables()
for (v in myvariables) {
echo "${v} " + myvariables.get(v)
@nextrevision
nextrevision / jenkinsBuildWithParams.groovy
Created November 23, 2016 16:19
Builds Jenkins jobs matching a certain regex with optional parameters
import jenkins.model.*
def matchedJobs = Jenkins.instance.items.findAll { job ->
job.name =~ /job_regex_here/
}
matchedJobs.each { job ->
println job.name
// without parameters
//job.scheduleBuild(new Cause.UserIdCause())
@nextrevision
nextrevision / jenkinsGetJobParameters.groovy
Created November 23, 2016 16:35
Loops through jobs by regex printing the job name and the value of the parameter PARAM1
import jenkins.model.*
def matchedJobs = Jenkins.instance.items.findAll { job ->
job.name =~ /job_regex_here/
}
matchedJobs.each { job ->
def latest = job.getLastSuccessfulBuild()
def name = job.name
@nextrevision
nextrevision / udpflood_scapy.py
Created March 2, 2015 13:56
Send a flood of UDP packets to a specific UDP port
#!/usr/bin/env python
#
# Requires:
# - scapy
# - tcpreplay
import sys
from scapy.all import *
if len(sys.argv) != 6:
@nextrevision
nextrevision / docker_pulp_env.sh
Created March 22, 2015 13:56
Configures a complete pulp environment with docker-machine
#!/bin/bash
ACTION=$1
PULP_IMAGES=(
pulp/mongodb
pulp/qpid
pulp/base
pulp/worker
pulp/apache
// how_much_netflix.js
// A script that looks through your Netflix viewing activity and
// tallys up how much time you've spent watching Netflix
//
// INSTRUCTIONS TO USE:
// Open https://www.netflix.com/WiViewingActivity and the developer console
// Copy and paste this script into the developer console and press enter
//
(function() {
var fetchAllViewedItems = function() {