Skip to content

Instantly share code, notes, and snippets.

John Patterson nextrevision

Block or report user

Report or block nextrevision

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View how_much_netflix.js
// 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() {
View mdtest.go
package main
import (
"fmt"
"github.com/pkg/errors"
"github.com/rancher/go-rancher-metadata/metadata"
)
func main() {
@nextrevision
nextrevision / jenkinsGetJobParameters.groovy
Created Nov 23, 2016
Loops through jobs by regex printing the job name and the value of the parameter PARAM1
View jenkinsGetJobParameters.groovy
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 / jenkinsBuildWithParams.groovy
Created Nov 23, 2016
Builds Jenkins jobs matching a certain regex with optional parameters
View jenkinsBuildWithParams.groovy
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())
View jenkins-workflow-dump-environment
// 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 / example-rancher-metadata-tree
Last active Feb 24, 2018
Example traversed tree of the Rancher metadata service
View example-rancher-metadata-tree
/containers
/containers/0
/containers/0/create_index :
/containers/0/health_state :
/containers/0/host_uuid : da4aa4b0-ee2f-4ad3-8ded-b09917821cfa
/containers/0/hostname : dockermachine
/containers/0/ips
/containers/0/ips/0 : 10.42.176.231
/containers/0/labels
/containers/0/name : Network Agent
@nextrevision
nextrevision / deleteJobBuildRange
Last active Feb 19, 2016
Jenkins groovy script to delete builds x through y for a specific job
View deleteJobBuildRange
# from http://superuser.com/a/589532
Jenkins.instance.getItemByFullName('jobName').builds.findAll { it.number > 1 && it.number < 100 }.each { it.delete() }
@nextrevision
nextrevision / vagrant_up_vb4.3
Created Jan 27, 2016
vagrant #6895 debug logs
View vagrant_up_vb4.3
# using an image with NetworkManager disabled from starting
INFO global: Vagrant version: 1.8.1
INFO global: Ruby version: 2.2.3
INFO global: RubyGems version: 2.4.5.1
INFO global: VAGRANT_VAGRANTFILE="/home/ubuntu/project/Vagrantfile.rhel-project"
INFO global: VAGRANT_LOG="debug"
INFO global: VAGRANT_OLD_ENV_HOME="/home/ubuntu"
INFO global: VAGRANT_OLD_ENV_XDG_SESSION_ID="78"
INFO global: VAGRANT_OLD_ENV_PWD="/home/ubuntu/project"
INFO global: VAGRANT_OLD_ENV_GOPATH="/home/ubuntu/Projects/go"
@nextrevision
nextrevision / deleteJenkinsJobs.groovy
Created Dec 3, 2015
Groovy script to delete all jenkins jobs that match a regex pattern
View deleteJenkinsJobs.groovy
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 / readinglist2json.js
Created Dec 2, 2015
Script to convert Safari's reading list to JSON
View readinglist2json.js
# Usage: npm install plist-json && node readinglist2json.js
var plist = require('plist-json');
plist.parse(process.env.HOME + '/Library/Safari/Bookmarks.plist', function(err, json) {
if (err) {
console.log(err);
return;
}
for (i=0; i<json.Children.length; i++) {
You can’t perform that action at this time.