Skip to content

Instantly share code, notes, and snippets.

View moofish32's full-sized avatar

Mike Cowgill moofish32

View GitHub Profile
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: GPGTools - https://gpgtools.org
mQINBFYwAecBEADa6rlfrN6hLwJXeIjuRGj+E8KknKCIRo6rymlOmh9x9lHCDGPY
OVVzVj/+ETD52ZdPEwg8oQvwmy53dAbQJgVyFnMdE71dkBYrYkKf7HpKf40eu26O
vbx8QC0ZOY52HipwnIm1lgs3lYxo1lXoPNvjFkPkkLgur+Wr59q5rI+cTks9n8Y9
ymHyHgulSyA+RDz/rXeaCt5AiwN5JJHoQgRW/QvsMxmVSOTM0uBMg23P69kr6/Vl
ypW37KkanLTcvDDEfckbeJvrxFAtmUROGCoWwZWSVnFTMRjAxOJSfrUurZp0Af0G
xGhjy9htP5cUgAk1VtSdBS976w0hRz3jM4Ag7U4EPJ5GCNOo3RW7jc5ac5ldpXjW
PhYiM9TO/3uyFTsljz9B/wlgirq5kcWzpCPc8Ker2Pg22yjEZcI1oSXD4aZ98rDG
@moofish32
moofish32 / ubuntu_init.sh
Created October 13, 2015 16:41
init script for an ubuntu box
fancy_echo() {
printf "\n%b\n" "$1"
}
install_if_needed() {
local package="$1"
if [ $(dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
sudo aptitude install -y "$package";
@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;
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