Skip to content

Instantly share code, notes, and snippets.

View brandocorp's full-sized avatar

Brandon Raabe brandocorp

View GitHub Profile
@brandocorp
brandocorp / jenkins_password.rb
Last active August 29, 2015 14:21
Encrypt or decrypt a stored password from a Jenkins config file
#
# All credit to belongs to the original author here:
# http://xn--thibaud-dya.fr/jenkins_credentials.html
#
# This is merely a ruby implementation of the code found here:
# https://github.com/tweksteen/jenkins-decrypt/blob/master/decrypt.py
#
require 'openssl'
require 'base64'
@brandocorp
brandocorp / jenkins_credentials.sh
Created May 26, 2015 19:29
Jenkins Global Credentials Management
#!/bin/bash
USERNAME=${1:-"u$(date +%s)"}
PASSWORD=${2:-'password'}
# the CLI jar file location
JENKINS_CLI_JAR=/tmp/jenkins-cli.jar
# the private key to use for authenticating
JENKINS_ROBOT_PRIVATE_KEY=$HOME/.ssh/devops_robot
@brandocorp
brandocorp / cookbook_reverse_dependencies.rb
Last active August 29, 2015 14:25
Reverse Cookbook Dependencies
require 'ridley'
class Cookbook
class DownstreamDependencyList
attr_reader :target_cookbook, :target_version
def initialize(cookbook, version)
@target_cookbook = cookbook
@target_version = version
@brandocorp
brandocorp / octokit_examples.rb
Created August 26, 2015 00:29
Octokit Examples
# Build our client object
client = Octokit::Client.new(:access_token => ENV['GITHUB_API_TOKEN'])
# Connect and get our User object
user = client.user
# Get a listing of this user's personal repos
user_repos = user.rels[:repos].get.data
user_repos.each do |repo|
puts repo.name, repo.clone_url
end
@brandocorp
brandocorp / _JENKINS_SESSION_AFFINITY.md
Last active November 19, 2015 16:02
jenkins_session_affinity

Jenkins Session Affinity

This gist contains an example for creating an HAProxy reverse proxy balancing connections between any number of Jenkins master nodes, while maintaining individual user sessions across the same master.

@brandocorp
brandocorp / k8s-docker.yml
Last active April 19, 2016 20:45
k8s-docker.yml
k8s_docker:
image: rancher/os-docker:v0.3.3
labels:
io.rancher.os.scope: system
io.rancher.os.after: console
net: host
pid: host
ipc: host
uts: host
privileged: true
@brandocorp
brandocorp / hw.cpp
Last active September 18, 2015 16:37
#include <iostream>
#include <string>
using namespace std;
int main()
{
int quantity;
double total;
@brandocorp
brandocorp / counting.cpp
Last active October 19, 2015 01:39
counting.cpp
#include <iostream>
using namespace std;
int countingArray(float list[], int arraySize, bool countNegative);
void countingArray(float list[], int arraySize, int &numOfNegatives, int &numOfPositives);
int main() {
const int arraySize = 7;
@brandocorp
brandocorp / srelay.rb
Last active November 4, 2015 02:44
srelay formula
require "formula"
class Srelay < Formula
homepage "http://socks-relay.sourceforge.net"
url "https://downloads.sourceforge.net/project/socks-relay/socks-relay/srelay-0.4.8/srelay-0.4.8b6.tar.gz"
sha1 "f5002394c9447bda340831ddabf339e88eab9f24"
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
@brandocorp
brandocorp / brewtstrap.sh
Last active November 19, 2015 15:50
Bootstrap OSX with Brew
#!/bin/bash
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install caskroom/cask/brew-cask
brew cask install chefdk
sudo chown -R $(whoami): /opt
chef-client -z -o 'workstation::setup'