Skip to content

Instantly share code, notes, and snippets.

View cterrykenzan's full-sized avatar

Christopher Terry cterrykenzan

View GitHub Profile
@cterrykenzan
cterrykenzan / delete_jobs.groovy
Created April 13, 2018 16:49
jenkins dsl delete jobs with regex
// https://gist.github.com/nextrevision/d11b2df4e8b229c6855b
def matchedJobs = Jenkins.instance.items.findAll { job ->
job.name =~ /my_regex_here/
}
matchedJobs.each { job ->
println job.name
//job.delete()
}
@cterrykenzan
cterrykenzan / oneliners.sh
Created October 13, 2016 20:25
One-liners
# Get a clean list of processes with listeners. Provides process name, pid, address, and port
sudo lsof -P | grep LISTEN | tr -s " " | cut -d " " -f 1,2,9- | sed -e s/TCP\ //g | sort -u
@cterrykenzan
cterrykenzan / ec2-startup-and-dns
Last active August 9, 2022 21:03
AWS EC2 - Start up a single instance and update its DNS record
#!/bin/bash
#In early development, sometimes you've got a hand-built instance, but you also don't want to leave it up all the time
# We've got an m4xl instance running Spinnaker (http://spinnaker.io) but we only really need it during the day
# As a cost-saving measure, we shut it down overnight. However, we want it to be consistently accessible
# So this script is in a Jenkins job that runs every morning,
# starting up the instance then updating its DNS record to the new IP.
#If you have multiple DNS records for a single instance,
# you can safely run a second copy of the script with the ZONEID and RECORDSET updated appropriately.