Skip to content

Instantly share code, notes, and snippets.

@alexw23
alexw23 / docker-env
Last active December 2, 2015 04:18
Automatically add docker machines to /etc/hosts
#this is a short-hand function to load a docker env
docker-env() {
eval "$(docker-machine env ${1:-default})"
}
@alexw23
alexw23 / monitor.sh
Created November 4, 2013 04:43 — forked from vjt/monitor.sh
#!/bin/sh
#
# Starts a multiplexed terminal session with tmux running monitoring software.
# Requires dstat, htop and grc. The apache configuration for grc can be found
# here: https://gist.github.com/1885569
#
# My .tmux.conf is here instead: https://gist.github.com/1886016#file_3_tmux.conf
#
# tmux 1.7 or later recommended.
#
@alexw23
alexw23 / Gruntfile.js
Created October 31, 2013 11:19
Bust caches in Laravel with Grunt. This will generate urls like "assets/css/style-cc673fcda9ae387ae82c83913f8b43a4.css"
module.exports = function(grunt) {
var changedCoffee, onChange;
grunt.initConfig({
// Read project settings
pkg: grunt.file.readJSON("package.json"),
cachebuster: {
build: {
options: {
@alexw23
alexw23 / recipe.rb
Created November 22, 2012 21:36 — forked from peplin/recipe.rb
S3 File Resource for Chef
# Source accepts the protocol s3:// with the host as the bucket
# access_key_id and secret_access_key are just that
s3_file "/var/bulk/the_file.tar.gz" do
source "s3://your.bucket/the_file.tar.gz"
access_key_id your_key
secret_access_key your_secret
owner "root"
group "root"
mode 0644
end
#envrionments/dev_au.rb
default_attributes ({
"apache2" => { "listen_ports" => [ "8080" ] }
})
#cookbook/attributes/default.rb
default['apache2']['listen_ports'] = 80
Chef::Log.info(node['apache2']['listen_ports']) ----- 80
@alexw23
alexw23 / gist:4129284
Created November 22, 2012 03:17
Not overriding
# envrionment
name "dev_au"
description "Development Environment for Australia"
default_attributes ({
"apache2" => { "listen_ports" => [ "80" ] },
"www" => {
"server_name" => "server",
"docroot" => "/srv/apps/www"
}
})
@alexw23
alexw23 / iam-s3-policy.json
Created November 21, 2012 22:10 — forked from lusis/iam-s3-policy.json
A sample AWS IAM json policy file with read-only access to certain S3 buckets
{
"Statement":[{
"Effect":"Allow",
"Action":["s3:ListBucket","s3:GetObject","s3:GetObjectVersion"],
"Resource":["arn:aws:s3:::my_bucket/*","arn:aws:s3:::my_bucket"]
}
],
"Statement":[{
"Effect":"Allow",
"Action":["s3:ListBucket","s3:GetObject","s3:GetObjectVersion"],
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.forward_port 80, 8080
config.vm.customize [
"modifyvm", :id,
"--name", "LAMP VM",
"--memory", "2048"
]
@alexw23
alexw23 / recipe.rb
Created November 20, 2012 10:42 — forked from codeslinger/recipe.rb
S3 File Resource for Chef
# Source accepts the protocol s3:// with the host as the bucket
# access_key_id and secret_access_key are just that
s3_file "/var/bulk/the_file.tar.gz" do
source "s3://your.bucket/the_file.tar.gz"
access_key_id your_key
secret_access_key your_secret
owner "root"
group "root"
mode 0644
end
def show
@company = Company.find(params[:id], :include => :company_location)
respond_to do |format|
format.html # show.html.erb
format.json { render json: @company }
end
end