Skip to content

Instantly share code, notes, and snippets.

View garystafford's full-sized avatar
💭
Happily Coding!

Gary A. Stafford garystafford

💭
Happily Coding!
View GitHub Profile
@garystafford
garystafford / generate_meanio_data.sh
Last active August 29, 2015 14:10
Generate article data for MEAN.io apps using curl
#!/bin/sh
# Generate article data for MEAN.io app
# Requires curl
# You need authenticated session to run script.
# Log into MEAN.io app with a user and grab cookie connect.sid value for sid variable!
# Format of binary data: --data-binary '{"title":"foo", "content":"bar..."}'
# User-defined variables
messages=200
@garystafford
garystafford / wait_mongo_start.sh
Last active August 29, 2015 14:10
Start-up script to eliminate potential race condition between the MongoDB data Docker container and the Node.js web-application container in a 'Dockerized' MEAN application. (post: http://wp.me/p1RD28-1ja)
#!/bin/sh
# Start-up script from inside web_1 (web-application) container
# Gary A. Stafford
# https://github.com/garystafford
# great references:
# Docker Networking Made Simple or 3 Ways to Connect LXC Containers
# (https://blog.codecentric.de/en/2014/01/docker-networking-made-simple-3-ways-connect-lxc-containers)
# Docker 101: Dockerizing Your Infrastructure (http://youtu.be/4W2YY-qBla0)
@garystafford
garystafford / chrome_fixer.bat
Last active August 29, 2015 14:12
Remove URLBlacklist (blocks Chrome Web Store) and Forced Homepage, for Chrome on Windows
rem needs some logic added...
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\URLBlacklist /f
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\RestoreOnStartupURLs /f
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\Recommended /f
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome /t REG_SZ /v HomepageLocation /d http://www.google.com /f
rem needs some logic added to stay open afterwards?
###############################################################################
# Helpful Puppet commands and code snippets
###############################################################################
sudo puppet module list # different paths w/ or w/o sudo
puppet config print
puppet config print | grep <search_term>
sudo cat /etc/puppet/puppet.conf | grep <search_term>
@garystafford
garystafford / gist:8d244fe478e59dd4d131
Last active August 29, 2015 14:23
docker-machine errors
gstafford@gstafford-X555LA:~/NetBeansProjects/virtual-vehicles-docker$ docker-machine create --driver virtualbox test -D
executing: /usr/bin/VBoxManage
STDOUT: Oracle VM VirtualBox Command Line Management Interface Version 4.3.28
(C) 2005-2015 Oracle Corporation
All rights reserved.
Usage:
VBoxManage [<general option>] <command>
# VBoxManage: error: Unknown option: --synthcpu
curl -L https://github.com/docker/machine/releases/download/v0.4.0/docker-machine_linux-amd64 > \
/usr/local/bin/docker-machine
chmod +x /usr/local/bin/docker-machine
docker-machine --version
# docker-machine version 0.4.0 (9d0dc7a)
VBoxManage --version
# 5.0.0r101573
gstafford@gstafford-X555LA:~$ scid=$(curl -s -XPOST https://discovery-stage.hub.docker.com/v1/clusters)
gstafford@gstafford-X555LA:~$ docker-machine create \
> --driver virtualbox --virtualbox-disk-size 5000 \
> --swarm --swarm-master --swarm-discovery \
> token://$scid swarm-test-master --debug
executing: /usr/bin/VBoxManage
STDOUT: Oracle VM VirtualBox Command Line Management Interface Version 5.0.0
(C) 2005-2015 Oracle Corporation
All rights reserved.
gstafford@gstafford-X555LA:~$ docker-machine create \
> --driver virtualbox --virtualbox-disk-size 5000 \
> --swarm --swarm-master --swarm-discovery \
> token://$scid swarm-test-master --debug
executing: /usr/bin/VBoxManage
STDOUT: Oracle VM VirtualBox Command Line Management Interface Version 5.0.0
(C) 2005-2015 Oracle Corporation
All rights reserved.
Usage:
gstafford@gstafford-X555LA:~/NetBeansProjects/tw-cn-ip-build-deploy$ bash 1-machine-create.sh
executing: /usr/bin/VBoxManage
STDOUT: Oracle VM VirtualBox Command Line Management Interface Version 5.0.0
(C) 2005-2015 Oracle Corporation
All rights reserved.
Usage:
VBoxManage [<general option>] <command>
gstafford@gstafford-X555LA:~/NetBeansProjects/tw-cn-ip-build-deploy$ bash 1-machine-create.sh
executing: /usr/bin/VBoxManage
STDOUT: Oracle VM VirtualBox Command Line Management Interface Version 5.0.0
(C) 2005-2015 Oracle Corporation
All rights reserved.
Usage:
VBoxManage [<general option>] <command>