Skip to content

Instantly share code, notes, and snippets.

@bakins
bakins / horrible-hack.rb
Created September 16, 2013 16:57
Horrible hack for some local heroku test environments
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.ssh.forward_agent = true
config.vm.provision :shell, :inline => <<EOF
apt-get update
apt-get install -y git-core redis-server curl libssl0.9.8 make g++
mkdir -p -m 0550 /root/.ssh/
echo -e "Host *\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
@bakins
bakins / gist:6280468
Created August 20, 2013 11:55
horrible docker wrapper for runit/chef
#!/opt/chef/embedded/bin/ruby
require 'net/http'
require 'json'
require 'yaml'
STDOUT.sync = true
config = YAML.load_file(ARGV[0])
http = Net::HTTP.new("127.0.0.1", 4243)
@bakins
bakins / gist:6176680
Created August 7, 2013 17:59
ubuntu nginx dockerfile
FROM ubuntu:12.04
CMD curl -O http://www.akins.org/nginx/nginx_1.2.8-2.ubuntu.12.04_amd64.deb
CMD dpkg -i nginx_1.2.8-2.ubuntu.12.04_amd64.deb
@bakins
bakins / gist:6130281
Last active December 20, 2015 12:19
doodling on "container" log forwarding.
#!/bin/bash
# should be /etc/sv/my-awesome-containerized-app/log/run
# create a lumberjack ( https://github.com/jordansissel/lumberjack ) config like
#
# {
# ..put server stuff here...
# "files": [
# {
# "paths": [ "-" ],
# "fields": { "type": "stdin" }
@bakins
bakins / gist:6130279
Created August 1, 2013 10:40
doodling on "container" log forwarding.
#!/bin/bash
# should be /etc/sv/my-awesome-containerized-app/log/run
# create a lumberjack ( https://github.com/jordansissel/lumberjack ) config like
#
# {
# ..put serevr stuff here...
# "files": [
# {
# "paths": [ "-" ],
# "fields": { "type": "stdin" }
require "ridley"
require "multi_json"
require 'pp'
require 'chef_zero/server'
plan = MultiJson.load(IO.read(ARGV[0]))
#pp plan
environment = {
#!/usr/bin/bash
if [[ ! -f /root/.ssh/authorized_keys ]]; then
authorized_keys=$(/usr/sbin/mdata-get root_authorized_keys)
if [[ -n ${authorized_keys} ]]; then
mkdir -p /root/.ssh
echo -e "${authorized_keys}" > /root/.ssh/authorized_keys
chmod 700 /root/.ssh
chmod 600 /root/.ssh/authorized_keys
fi
user www www;
worker_processes 1;
worker_rlimit_nofile 8256;
events {
worker_connections 8192;
}
http {
desc "Generate jekyll site"
task :generate do
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
puts "## Generating Site with Jekyll"
system "bundle exec compass compile --css-dir #{source_dir}/stylesheets"
system "bundle exec jekyll"
Find.find "public" do |path|
if FileTest.file?(path) and path.match(/\.(css|js|html|xml|txt)$/)
system "gzip -c #{path} > #{path}.gz"
@bakins
bakins / gist:5503176
Last active December 16, 2015 21:58
Horrible node.js "omnibus"
#!/bin/bash
#some defaults
PROJECT_VERSION=0.1.0
NODE_VERSION=0.10.5
PROJECT=$(basename $(pwd))
if [ -r .node_version ]; then
. .node_version
fi