Skip to content

Instantly share code, notes, and snippets.

View Zeerg's full-sized avatar
💾
⃐ ⃑ ⃒ ⃓ ⃔ ⃕ ⃖ ⃗ ⃘ ⃙ ⃚ ⃛ ⃜ ⃡ ⃥ ⃦ ⃧ ⃨ ⃩ ⃪ ͣ ͨ ͩ ͤ ͪ ͥ ͫ ͦ ͬ ͭ ͧ ͮ ͯ

Tom Zeerg

💾
⃐ ⃑ ⃒ ⃓ ⃔ ⃕ ⃖ ⃗ ⃘ ⃙ ⃚ ⃛ ⃜ ⃡ ⃥ ⃦ ⃧ ⃨ ⃩ ⃪ ͣ ͨ ͩ ͤ ͪ ͥ ͫ ͦ ͬ ͭ ͧ ͮ ͯ
View GitHub Profile
@Zeerg
Zeerg / purge-jobs.groovy
Created December 21, 2020 20:27
Remove bulk jobs using Jenkins Script Console
import jenkins.model.*
def matchedJobs = Jenkins.instance.items.findAll { job ->
job.name =~ "regex of jobs"
}
matchedJobs.each { job ->
println job.name
//job.delete() Remove the comment to run the purge
}
@Zeerg
Zeerg / aws_cli.groovy
Created July 8, 2019 19:12
Jenkins AWS CLI Examples
#### Get Network ACLS from the AWS API using aws cli
def p = 'aws ec2 describe-network-acls --output text'.execute() | 'grep NETWORKACLS'.execute() | ['awk', '{ print $3 }'].execute()
p.waitFor()
return p.text.tokenize()
### More to come
@Zeerg
Zeerg / json_to_fer.py
Created March 1, 2019 21:55
A lambda to convert a json object to a sumologic field extraction rule.
json_body = {}
print(*map(lambda x: f"| parse \"{x}\\\":\\\"*\\\"\" as {x}\n", json_body))

Keybase proof

I hereby claim:

  • I am zeerg on github.
  • I am zeerg (https://keybase.io/zeerg) on keybase.
  • I have a public key ASCafB_XfSTlPs_IN1K6-sY4zYaAeY22MfUATNbKDue32wo

To claim this, I am signing this object:

0xc0880E06398Cc310762D8c5D0388def0f1a83478
import json
import urllib2
bitcoinurl = "http://api.coindesk.com/v1/bpi/currentprice/allcurrencies.json?showex=1&calc=1"
openurl = urllib2.urlopen(bitcoinurl)
result = json.load(openurl)
print "Current Bitcon Price Is :", result['bpi']['USD']['rate']
@Zeerg
Zeerg / jobpull.py
Created November 29, 2016 15:44
Added a few more places
#!/usr/bin/env python
#Import These Modules
import json
import urllib2
import feedparser
import datetime as dt
#Setup date variables
today = dt.date.today()
@Zeerg
Zeerg / testing.py
Created November 28, 2016 17:45
python job thing
#!/usr/bin/env python
import json
import urllib2
import feedparser
from datetime import datetime
url = {'remoteok': "https://remoteok.io/index.json?description=&location=Remote&tags=sys%20admin",'stackrss': "http://stackoverflow.com/jobs/feed?tl=sysadmin"}
openurl = urllib2.urlopen(url['remoteok']).read()
result = json.loads(openurl)
@Zeerg
Zeerg / newcert.py
Last active March 21, 2024 17:22
Python script to generate CSR/Self Signed Cert. Needs pyOpenssl and python-whois
#!/usr/bin/python
from OpenSSL import crypto
import os
import sys
import datetime
import whois
#Variables
TYPE_RSA = crypto.TYPE_RSA
TYPE_DSA = crypto.TYPE_DSA
#!/usr/bin/env python
import os.path
import yum
import random
import string
# Global Vars
yb = yum.YumBase()