Skip to content

Instantly share code, notes, and snippets.

// 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() {
package main
import (
"fmt"
"github.com/pkg/errors"
"github.com/rancher/go-rancher-metadata/metadata"
)
func main() {
@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 / 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())
// 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 February 24, 2018 17:53
Example traversed tree of the Rancher metadata service
/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 February 19, 2016 20:22
Jenkins groovy script to delete builds x through y for a specific job
# 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 January 27, 2016 15:38
vagrant #6895 debug logs
# 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 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 / readinglist2json.js
Created December 2, 2015 16:07
Script to convert Safari's reading list to JSON
# 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++) {