Skip to content

Instantly share code, notes, and snippets.

View moofish32's full-sized avatar

Mike Cowgill moofish32

View GitHub Profile
@moofish32
moofish32 / boot2docker_dns_fix.sh
Created June 30, 2015 22:34
Boot2Docker Fix My DNS!
DOCKER_BRIDGE=`boot2docker ssh ifconfig docker0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
echo "Setting docker dns to the docker bridge @ $DOCKER_BRIDGE"
boot2docker ssh sudo "ash -c \"echo EXTRA_ARGS=\'--dns $DOCKER_BRIDGE --dns $(scutil --dns | awk -F ': ' '/nameserver/{print $2}' | head -1) --dns-search service.consul\' > /var/lib/boot2docker/profile\""
boot2docker restart
echo "... b2d restarted."
@moofish32
moofish32 / dnsmasq_docker.sh
Created June 30, 2015 16:54
DNSMASQ with Docker
#!/usr/env/bin sh
brew install dnsmasq;
cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf;
sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons;
sudo chown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist;
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist;
sed -i.bak '/#address=\/double-click\.net\/127\.0\.0\.1/a\
address=/docker.dev/'$(boot2docker ip) /usr/local/etc/dnsmasq.conf;
sudo launchctl stop homebrew.mxcl.dnsmasq;
@moofish32
moofish32 / dnsmasq_setup.sh
Last active August 29, 2015 14:23
DNSMASQ Setup
#!/usr/env/bin sh
brew install dnsmasq;
cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf;
sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons;
sudo chown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist;
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist;
sed -i.bak '/#address=\/double-click\.net\/127\.0\.0\.1/a\
address=/bspot.dev/'$(boot2docker ip) /usr/local/etc/dnsmasq.conf;
sudo launchctl stop homebrew.mxcl.dnsmasq;
@moofish32
moofish32 / Dockerfile
Created June 27, 2015 04:16
Slim JRUBY 1.7 using Alpine Linux and open JDK 8
FROM alpine:3.2
ENV JRE=jre1.8.0_60 \
JAVA_HOME=/opt/jre \
JRUBY_VERSION=1.7.20.1 \
JRUBY_SHA1=6a6e701a3a5769ec5d53a78660521c37da36e41f
# That's an 1.8.0_60 JRE from OpenJDK.net
# Courtesy to https://github.com/frol/docker-alpine-oraclejdk8 from where
# the setup of glibc is borrowed
RUN apk add --update wget bash ca-certificates && \
cd /tmp && \
casper.incTestNumber = () =>
@count ?= 0
++@count
casper.setOddzContext = (ctx) =>
@oddzCtx = ctx
casper.getOddzContext = () =>
@oddzCtx
require 'active_support/core_ext'
require 'rails/all'
class Helpers
def self.map_type type
case type
when /boolean/
'bool'
when /java.lang.int/
'int32'

Commands examples

If the namespace is not used then the commands will perform on top of the default database. bundle exec rake db:create bundle exec rake db:migrate

By using the namespace we are going to use all the configuration for our alternate DB. bundle exec rake store:db:create bundle exec rake store:db:migrate

@moofish32
moofish32 / jdbc-1.3.5.stacktrace
Created January 15, 2014 20:19
Stacktrace for connection timeout issue with jdbc postgres
2014-01-15 17:48:24.040 F [9936:RubyThread-258: <redacted>/shared/bundle/jruby/1.9/gems/puma-2.7.1-java/lib/puma/server.rb:292] [[]] Rails --
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in `wait_poll'
org/jruby/RubyKernel.java:1519:in `loop'
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:181:in `wait_poll'
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:136:in `poll'
/opt/ruby/jruby-1.7.8/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
/opt/ruby/jruby-1.7.8/lib/ruby/1.9/monitor.rb:210:in `mon_synchronize'
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:146:in `synchronize'
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:134:in `poll'
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:423:in `acquire_connection'