Skip to content

Instantly share code, notes, and snippets.

View bixu's full-sized avatar
🦎

Blake Irvin bixu

🦎
  • Berlin
  • 22:33 (UTC +02:00)
View GitHub Profile
@bixu
bixu / circonus_httptrap_push.sh
Created January 28, 2016 17:07
Send a key:value pair to a Circonus HTTPTrap endpoint
#!/bin/bash
# Note that the -k flag here means we are ignoring cert warnings.
# If security matters you should use the Circonus cert provided
# here: http://login.circonus.com/pki/ca.crt
KEY=$1
VALUE=$2
ENDPOINT_URL=$3
@bixu
bixu / default_spec.rb
Last active December 18, 2015 14:51
default_spec for docker builds (this one is ubuntu-specific)
require 'spec_helper'
describe "Dockerfile" do
before(:all) do
image = Docker::Image.build_from_dir('.') do |v|
if (log = JSON.parse(v)) && log.has_key?("stream")
$stdout.puts log["stream"]
end
end
@bixu
bixu / spec_helper.rb
Created December 18, 2015 13:14
spec_helper for docker builds
require 'docker' # see https://rubygems.org/gems/docker-api
require 'serverspec' # see http://serverspec.org
set :backend, :exec
Excon.defaults[:write_timeout] = 1000
Excon.defaults[:read_timeout] = 1000
@bixu
bixu / deployment_annotation.sh
Created November 11, 2015 16:08
Report your deployments to Circonus
#!/bin/bash
APP_NAME="<app name>"
API_TOKEN="<api token>"
TIME=$(date +%s)
curl --user $APP_NAME:$API_TOKEN \
-H "Accept: application/json" \
-X POST \
--data-binary "{\"category\": \"Deployment\",\"title\":\"Deployed $APP_NAME\",\"description\":\"Deployed revision X.X.X\",\"start\": $TIME,\"stop\":$TIME}" \
#!/bin/bash
set -e
apt-get install -y software-properties-common
apt-add-repository -y ppa:zfs-native/stable
apt-get update
apt-get install -y ubuntu-zfs
# load zfs kernel module
@bixu
bixu / mantorrent.sh
Created August 7, 2015 13:01
Store your torrent downloads (for example, the latest Slackware Linux ISO) directly in Manta from within an `mjob` or `mlogin` session.
#!/bin/bash
# "An elegant weapon, from a more civilized age."
MAGNET_URL=$1
transmission-daemon
sleep 3
@bixu
bixu / triton_docker.sh
Created August 6, 2015 14:30
Shell functions to switch between local Docker environments and Joyent's Triton Docker hosting service
#!/bin/bash
# triton/docker
export DOCKER_TLS_VERIFY=1
function dockerlocal {
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=$HOME/.boot2docker/certs/boot2docker-vm
}
@bixu
bixu / gist:3411df6a2b7ff99095b9
Created April 1, 2015 09:07
.kitchen.yml for Test Kitchen with the kitchen-joyent driver
---
driver_plugin: joyent
driver_config:
joyent_username: <%= ENV['MANTA_USER'] %>
joyent_keyfile: "<%= ENV['HOME'] %>/.ssh/id_rsa"
joyent_keyname: <%= ENV['MANTA_KEY_ID'] %>
joyent_url: <%= ENV['JOYENT_API_URL'] %>
platforms:
- name: smartos_base64_1430
@bixu
bixu / pkgsrc_bootstrap.sh
Last active August 29, 2015 14:14
Bootstrap pkgsrc in a SmartOS global zone
#!/bin/bash
# you can test by doing
# curl -sL https://gist.github.com/bixu/e2620a2b0fcb6ed1830c/raw/pkgsrc_bootstrap.sh | bash -sx
BOOTSTRAP_TARBALL=$(curl -sLk http://pkgsrc.joyent.com/packages/SmartOS/bootstrap/ | grep href= | cut -d\" -f2 | tail -n1)
cd /
curl -k http://pkgsrc.joyent.com/packages/SmartOS/bootstrap/$BOOTSTRAP_TARBALL | gzcat | tar -xf -
@bixu
bixu / public_ssh_scan.sh
Last active August 29, 2015 14:09
scan for open public ssh ports on your hosts
#!/bin/bash
ip_list=$(knife joyent server list | awk '{print $7}' | cut -d"," -f 1 | grep -v "10.*\|192.168.*\|172.16.*")
for ip in $ip_list
do nmap -A -T4 -F $ip
done | grep "Nmap scan report\|ssh"