Skip to content

Instantly share code, notes, and snippets.

View benjaminws's full-sized avatar

Benjamin W. Smith benjaminws

View GitHub Profile
@dchw
dchw / spinnaker-session-token-ms.sh
Last active September 7, 2018 22:28
Get a Spinnaker session cookie when using MS OAuth
echo "Authorizing with MS"
curl -s --request POST \
--url https://login.microsoftonline.com/$AZURE_TENANT_ID/oauth2/token \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode "grant_type=password" \
--data-urlencode "resource=https://graph.windows.net" \
--data-urlencode "client_id=$SPINNAKER_CLIENT_ID" \
--data-urlencode "password=$BUILD_PASSWORD" \
--data-urlencode "client_secret=$SPINNAKER_CLIENT_SECRET" \
--data-urlencode "username=$BUILD_USER" \
@valdemon
valdemon / config.yml
Last active May 9, 2019 13:11
Enable ECR (AWS) registries for Spinnaker with Kubernetes provider
# A part of the Halyard config file declaring the ECR registries.
# There can be multiple registries, each in different AWS account.
# In this example there are 3 "stages" accounts - dev, stage & live.
# NOTE: The declared password files must exist and provide valid base64 encoded values,
# otherwise Halayrd will endup with an exception during deployment.
# The values can be fake, they will be updated later by the Kubernetes Job (see 2-nd attached file).
# NOTE: replace ${YOUR_DEV_AWS_ACCOUNT_ID} ${YOUR_DEV_AWS_REGION}
# with appropriate values (same for STAGE & LIVE).
dockerRegistry:

Setting up netboot.xyz with an EdgeRouter

This document covers how to setup netboot.xyz, a service that provides iPXE-based installation and live boot of a bunch of operating systems, on a Ubiquiti EdgeRouter.

Assumptions

I've made a few assumptions throughout this document that will probably be different for your setup:

@cleverdevil
cleverdevil / contacts.py
Last active May 31, 2022 12:03
Integrate Mac OS X Contacts database with mutt for auto-completion of email addresses
#!/usr/bin/env python
'''
A script to search the Mac OS X Address Book via PyObjC bridge, and
then output the results in a format suitable for integration with
mutt.
Add the following to your `.muttrc`:
set query_command = "~/.mutt/contacts.py '%s'"
@ftrain
ftrain / rhymes.clj
Last active July 14, 2023 22:20
Annotated rhyming dictionary
;; This is at: https://gist.github.com/8655399
;; So we want a rhyming dictionary in Clojure. Jack Rusher put up
;; this code here:
;;
;; https://gist.github.com/jackrusher/8640437
;;
;; I'm going to study this code and learn as I go.
;;
;; First I put it in a namespace.
@dysinger
dysinger / easy-ubuntu-openvpn.sh
Created August 28, 2013 18:22
Create a VPN on EC2 in 30 seconds
#!/bin/sh
# linux firewall/forwarding
modprobe iptable_nat
echo 1 | tee /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 10.10.10.1/2 -o eth0 -j MASQUERADE
# install openvpn
apt-get update && apt-get install -y openvpn
cd /etc/openvpn/
INSTANCE=$(curl http://169.254.169.254/latest/meta-data/public-hostname)
openvpn --genkey --secret ${INSTANCE}.key
function table() {
case "$1" in
flip)
echo "(╯°□°)╯︵ ┻━┻ "
;;
set)
echo "┬─┬ ノ( ゜-゜ノ)"
;;
man)
echo "(╯°Д°)╯︵ /(.□ . \)"
@dctrwatson
dctrwatson / nginx.conf
Last active April 28, 2024 10:26
Caching PyPi packages locally with nginx
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@garnaat
garnaat / gist:5154370
Created March 13, 2013 17:35
Configure a internet-connected VPC from scratch
import boto.vpc
import time
REGION_NAME = 'us-west-2'
AMI_ID = 'ami-8e27adbe' # Amazon Linux AMI
conn = boto.vpc.connect_to_region(REGION_NAME)
# Create a VPC
vpc = conn.create_vpc('10.0.0.0/16')
@zspencer
zspencer / .rvmrc
Last active December 12, 2015 07:28
A parser that takes tweets and builds relationships between tweeters.
rvm use system@network-graph --create