Skip to content

Instantly share code, notes, and snippets.

View vbatts's full-sized avatar
🧁

Vincent Batts vbatts

🧁
View GitHub Profile
#!/usr/bin/env bash
# set this, so that we bail on errors
set -e
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
this_ruby="ruby-1.9.3-preview1"
this_gemset="testset"
@vbatts
vbatts / build.sh
Created May 16, 2012 15:04
warbler: store a local webserver jar, instead of in ~/.m2/
#!/bin/sh
ruby \
-I$(dirname $(gem which warbler)) -r warbler/web_server \
-I./ -r local_web_server \
-S warble \
--trace
@vbatts
vbatts / app.rb
Created May 23, 2012 20:48
accessing sinatra application routes
require 'rubygems'
require 'sinatra/base'
require 'json'
class MyApp < Sinatra::Base
set :routes, @routes
get '/' do
p settings.routes
settings.routes.to_json
@vbatts
vbatts / ruby-openssl-build.sh
Created July 11, 2012 14:58
building ruby with a specific openssl
#!/bin/sh
t_dir="$HOME/tmp"
mkdir -p ${t_dir}
pushd ${t_dir}
for url in \
ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.9.3-p194.tar.bz2 \
http://openssl.org/source/openssl-1.0.1c.tar.gz
@vbatts
vbatts / ssl_asn1_decode.rb
Created November 12, 2012 18:33
SSL ASN1 decoding variant from MRI to Jruby
require 'find'
require 'openssl'
ENTRUST_VERSION_OID = '1.2.840.113533.7.65.0'
def find_pem(d = '/etc')
Find.find(d) do |path|
next unless FileTest.file? path
if path.end_with? '.pem'
@vbatts
vbatts / 408-3-vhost_switch_proxypass_from_rewrite.rb
Last active August 29, 2015 13:56
vhost proxypass migration
#!/usr/bin/env oo-ruby
=begin
Author: Vincent Batts <vbatts@redhat.com>
Data: Fri Feb 28 15:42:09 EST 2014
Description: Migration script for https://trello.com/c/q1ro2vDB/408-3-use-proxy-pass-for-virtual-hosts-plugin-instead-of-mod-rewrite
NOTE: this only applies to setups that are using the vhost plugin, namely OSE
=end
require "find"
require "json"

== For a static file-system (not an interactive registry daemon)

-- Overview For use-cases of serving docker images from a registry, that is to be read-only (pull or run, no push). It is necessary to make certain aspects of the index/registry API optional. This way the HTTP GET's made for pulling an image and layers, are provided by a basic file system server and no added logic.

Presently, there are a few custom headers that are expected of the registry, by the docker tool. If the headers are not present, then the pull of the image fails. The functionality that is using these headers ought to have some sane defaults if they are not present.

-- Example Using the attached server (though any http server like httpd or lighttpd would work too), to serve a directory. The directory fetched from http://people.gnome.org/~alexl/v1.tar.gz, looks like:

@vbatts
vbatts / f.go
Last active August 29, 2015 13:57
docker image/layer sums
package main
import (
"compress/gzip"
"flag"
"fmt"
"github.com/dotcloud/docker/image"
"github.com/dotcloud/docker/utils"
"io"
"io/ioutil"
@vbatts
vbatts / README.md
Last active August 29, 2015 13:58
docker vs. registry: tar length discrepancy

Overview

there has been a 1024 byte discrepancy of the tar archive when pushed from a docker daemon to a docker-registry

Usage

$ sh repro.sh

or if you are testing a local build of docker

@vbatts
vbatts / Dockerfile
Created April 8, 2014 20:25
hunting for TarSum inconsistencies
FROM fedora:latest
RUN yum install -y attr golang git docker-registry
# this way we'll set something in a non-standard tar pax header for this image
RUN touch file && setfattr -n user.vbatts -v test ./file && getfattr -d ./file
#
RUN curl -kL https://github.com/dotcloud/docker/archive/v0.9.1.tar.gz | tar -zx
RUN mkdir -p /gopath/src/github.com/dotcloud && \