Skip to content

Instantly share code, notes, and snippets.

View raygunsix's full-sized avatar

Chris Reid raygunsix

  • Raygunsix Consulting Inc.
  • Vancouver, BC
View GitHub Profile
@raygunsix
raygunsix / hello
Last active September 16, 2016 21:12
Dockerfile for simple netcat daemon
# useful for testing
# sudo docker run -it -p 8080:8080 <image name>:<tag>
FROM centos:centos7
EXPOSE 8080
RUN yum install -y python telnet
RUN echo '<html><head></head><body>hello</body></html>' >> /tmp/index.html

Useful Commands

Remove all docker containers and images

# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)

Delete all images

# http://stackoverflow.com/questions/226703/how-do-i-prompt-for-input-in-a-linux-shell-script
echo "Configure which type of server?"
select yn in "App" "Database"; do
case $yn in
App ) TYPE="app"; break;;
Database ) TYPE="db"; break;;
esac
done
@raygunsix
raygunsix / gist:3914499
Created October 18, 2012 20:15
Capistrano role for vagrant deployment
# public key needs to be added to deploy user
task :dev do
role :web, "localhost"
role :app, "localhost"
role :db , "localhost", :primary => true
set :rails_env, "qa"
ssh_options[:keys] = [File.join(ENV["HOME"], ".vagrant", "insecure_private_key")]
ssh_options[:port] = 2222
ssh_options[:user] = "deploy"
@raygunsix
raygunsix / patch-old-new-nginx-ohai-plugin.txt
Created October 5, 2012 16:53
opscode patch for nginx override attribute issues
--- ../raygun-forked-ckbks/partnerpedia-nginx-160001d/templates/default/plugins/nginx.rb.erb 2012-09-28 13:21:00.000000000 -0400
+++ cookbooks/partnerpedia-nginx-160001d/templates/default/plugins/nginx.rb.erb 2012-10-05 00:03:50.000000000 -0400
@@ -46,12 +46,19 @@
status, stdout, stderr = run_command(:no_status_check => true, :command => "<%= @nginx_bin %> -V")
+newcommon = "^nginx: "
+oldconfigargsig = "^configure arguments:(.+)"
+oldversionsig = "^nginx version: nginx\/(.+)"
+
@raygunsix
raygunsix / .tmux.conf
Created July 3, 2012 23:10
tmux config file
# Setting up the colors and copy/paste
set -g default-terminal "screen-256color"
# This is OS/X specific and should only be enabled when the 'reattach-to-user-namespace' is installed
set -g default-command "reattach-to-user-namespace -l /bin/bash"
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
# Make it use C-a, similar to screen..
unbind C-b
@raygunsix
raygunsix / Vagrantfile
Created April 27, 2012 22:53
Base vagrant file for new projects
# Before running vagrant, export the shell variable for the organization on Hosted Chef and
# make sure the validator certificate is in ~/.chef.
# You can optionally export a shell variable for your Chef server username if it is different
# from your OS user export OPSCODE_USER=bofh
user = ENV['OPSCODE_USER'] || ENV['USER']
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
@raygunsix
raygunsix / gist:1420984
Created December 2, 2011 00:33
EY ssh deploy issue
** [out :: 208.39.112.205:7000] Mobihand Application belongs to community 'AppZone'
** [out :: 208.39.112.205:7000] Finished import - total time: 00:15:36
command finished
* executing `thinking_sphinx:start'
* executing "sudo -p 'sudo password: ' /usr/bin/monit start sphinx_appzone_3312"
servers: ["208.39.112.205", "208.39.112.205"]
*** [deploy:update_code] rolling back
* executing "rm -rf /data/appzone/releases/20111201005532; true"
servers: ["208.39.112.205"]
[208.39.112.205:7000] executing command
@raygunsix
raygunsix / opends
Created November 29, 2011 18:59
OpenDS init script for gentoo
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#depend() {
#
#}
start() {
@raygunsix
raygunsix / gist:1340810
Created November 4, 2011 23:44
chef recipe for installing aapt
# Install 32 bit java and set path (if needed)
case node[:kernel][:machine]
when 'i686','i386','i586'
# do nothing
when 'x86_64'
ey_cloud_report "install" do
message "installing 32 bit compat libs"
end
package "app-emulation/emul-linux-x86-baselibs" do
action :install