This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"log" | |
"os" | |
// We use pretty instead of the common go-spew or pretty-printing because, | |
// go-spew is vendored in client-go and causes problems | |
"github.com/kr/pretty" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func createRBDStorage() error { | |
// Runs the equivalent of rbd --pool ffledgling-pool ls | |
// Contains basic connection logic that's reusable | |
log.Println("Function started...") // We have this because connection setup etc take a while. | |
// If like me, you tried this first and expected it to work, it doesn't: | |
/* | |
conn, _ := rados.NewConn() | |
args := []string{"--name", "client.ffledgling", "--conf", "/home/ffledgling/ceph.conf"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func listRBDVols() error { | |
// Runs the equivalent of rbd --pool ffledgling-pool ls | |
// Contains basic connection logic that's reusable | |
log.Println("Function started...") // We have this because connection setup etc take a while. | |
// If like me, you tried this first and expected it to work, it doesn't: | |
/* | |
conn, _ := rados.NewConn() | |
args := []string{"--name", "client.ffledgling", "--conf", "/home/ffledgling/ceph.conf"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func listOSDPools() { | |
// Runs the equivalent of ceph osd lspools | |
// Contains basic connection logic that's reusable | |
log.Println("Function started...") // We have this because connection etc take a while. | |
// If like me, you tried this first and expected it to work, it doesn't: | |
/* | |
conn, _ := rados.NewConn() | |
args := []string{"--name", "client.ffledgling", "--conf", "/home/ffledgling/ceph.conf"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ji = Jenkins.instance | |
def job_pattern = /.*/ //Job Name pattern, used to select jobs we want to select | |
def script_pattern = /http:\/\/influx.mydomain.com:8086\/write\?db=k8s-vm-parity/ | |
def matchedJobs = ji.items.findAll { job -> | |
job.name =~ job_pattern | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//def hi = hudson.model.Hudson.instance | |
// Just use Jenkins.instance, it's the same thing | |
def ji = Jenkins.instance | |
def param_name = "GERRIT_REFSPEC" | |
def job_pattern = /.*/ //Job Name pattern, used to select jobs we want to select | |
def param_value_filter = /.*/ // Pattern to select values of | |
def matchedJobs = ji.items.findAll { job -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Calculate primes upto the first 10^6 numbers | |
* Checked and tested the first 1000 primes for sanity sake | |
*/ | |
#define PRIME_SIZE 500000 // Half of 10^6, we really don't need to store even numbers | |
#define PRIME_SIZE_ROOT 708 // precomputed sqrt(PRIME_SIZE) | |
#include<iostream> | |
#include<cstdio> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a makefile to use the default fedora cloud image to start a container. | |
# It lets you create projects and save them separately, based off of a common base image | |
# Define and declare variables | |
SHELL := /bin/bash | |
IMG_STORE := /spare/local/$(USER)/.qemu-kvm-image-store | |
#IMG_NAME := Fedora-Cloud-Base-24-1.2.x86_64.qcow2 | |
IMG_NAME := Fedora-Cloud-Base-22-20150521.x86_64.qcow2 | |
#IMG_URL := https://download.fedoraproject.org/pub/fedora/linux/releases/24/CloudImages/x86_64/images/$(IMG_NAME) | |
IMG_URL := https://dl.fedoraproject.org/pub/fedora/linux/releases/22/Cloud/x86_64/Images/$(IMG_NAME) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yamlls() { | |
local f | |
local t | |
local _color | |
declare -A types=() | |
for f in *.*.yaml; do | |
t=${f%.yaml} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create file to accumulate errors | |
errfile=$(mktemp) | |
echo "Error File is ${errfile}" | |
# Have fd 3 point to where fd 2 points currently | |
exec 3>&2 | |
# wrapper function |