Skip to content

Instantly share code, notes, and snippets.

View halkeye's full-sized avatar

Gavin Mogan halkeye

View GitHub Profile
#!/bin/bash
set -e
set -x
# Assuming "anonymous read access" has been enabled on your Jenkins instance.
# JENKINS_URL=[root URL of Jenkins master]
JENKINS_URL=https://ci.blueocean.io
# JENKINS_URL=https://jenkins.gavinmogan.com
# JENKINS_CRUMB is needed if your Jenkins master has CRSF protection enabled as it should
JENKINS_CRUMB=`curl -qs "$JENKINS_URL/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)"`
curl -q -X POST -H $JENKINS_CRUMB -F "jenkinsfile=<Jenkinsfile" $JENKINS_URL/pipeline-model-converter/validate
@halkeye
halkeye / boxstarter.ps1
Last active April 29, 2019 19:21 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Gavin Mogan <gavin@saucelabs.com>
# Last Updated: 2018-03-08
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
folder('github_projects') {
['nfg', 'aliaoca', 'authorized', 'authenticated'].each {
permission("Jenkins.READ", it.name)
permission("hudson.model.Item.READ", it.name)
permission("hudson.model.Item.DISCOVER", it.name)
}
displayName('Github Projects')
description('All the github projects')
}
@halkeye
halkeye / chats.md
Last active November 1, 2018 05:52

Community Chats

Shared Community Slack

People

  • Any and all people could stop by the channel(s)
@halkeye
halkeye / storage.sh
Last active February 27, 2018 06:52
Simple script to install external-storage to typhoon
set -x
set -e
export KUBECONFIG=$HOME/.secrets/clusters/nemo/auth/kubeconfig
test -f external-storage || git clone git@github.com:kubernetes-incubator/external-storage.git
cat external-storage/digitalocean/manifests/digitalocean-secret.yaml | perl -pi -e "s{<DigitalOcean token>}{$(python -c "import base64; print base64.b64encode(open('$HOME/.config/digital-ocean/token', 'r').read().strip().replace('\n', ''))")}" | kubectl create -f -
kubectl create -f external-storage/digitalocean/manifests/rbac
cat external-storage/digitalocean/manifests/digitalocean-provisioner.yaml | perl -pi -e 's{apps/v1beta2}{apps/v1}' | kubectl create -f -
cat external-storage/digitalocean/manifests/digitalocean-flexplugin-deploy.yaml | perl -pi -e "s{apps/v1beta2}{apps/v1};s{<flex volume plugin dir, default: /usr/libexec/kubernetes/kubelet-plugins/volume/exec/>}{/var/lib/kubelet/volumeplugins/}" | kubectl create -f -
import sys
import time
try:
import RPi.GPIO as GPIO
except RuntimeError:
print(
"Error importing RPi.GPIO! " +
"This is probably because you need superuser privileges. " +
"You can achieve this by using 'sudo' to run your script")
#!/bin/bash
set -e
cd /storage/games/minecraft
./bin/mcmap -from -50 -50 -to 50 50 -info servers/new_craft/map_info.json -file servers/new_craft/map.png servers/new_craft/world >/dev/null
rm servers/new_craft/map.zip
zip --quiet -9 -r servers/new_craft/map.zip servers/new_craft/world
s3cmd --acl-public -c .s3cfg put servers/new_craft/map.png s3://minecraft-gavinmogan/
s3cmd --acl-public -c .s3cfg put servers/new_craft/map.zip s3://minecraft-gavinmogan/

Keybase proof

I hereby claim:

  • I am halkeye on github.
  • I am gavinmogan (https://keybase.io/gavinmogan) on keybase.
  • I have a public key ASB_j6WSukAVQi_kZTmTMcpFgu3CziPcH0p9pV80cSZn2Ao

To claim this, I am signing this object:

@halkeye
halkeye / production.rb
Created June 7, 2014 05:05
For production Capistrano deploys, we can't use our own internal git server because the one off amazon box doesn't have access to the internal network. Hacked in a solution to create a port forward to talk back to our network. Works in this case so sharing.
require 'net/ssh'
#set :ssh_options, :verbose => :debug
set :user, 'labuser'
set :repo_url, "ssh://eti@localhost:9000/#{fetch(:application)}.git"
$gateway_ssh = {}
namespace :ssh do
task :git_start do
on roles(:all) do
hostname = host.hostname.to_s
@halkeye
halkeye / selenium.py
Last active February 17, 2017 21:32
Simple simple selenium script
#!/usr/bin/env python
import requests
import json
import os
from requests.auth import HTTPBasicAuth
browsers = json.loads(os.environ['SAUCE_ONDEMAND_BROWSERS'] or '[{ "browser": "firefox", "platform":"MAC", "browser-version": "latest" }]' )
auth=HTTPBasicAuth(os.environ['SAUCE_USER_NAME'], os.environ['SAUCE_ACCESS_KEY']);
for browser in browsers: