Skip to content

Instantly share code, notes, and snippets.

View kevinkarwaski's full-sized avatar

Kevin Karwaski kevinkarwaski

View GitHub Profile
@kevinkarwaski
kevinkarwaski / update-git-tag
Last active August 29, 2015 14:01
Updating a git tag
$ git log --oneline --decorate
63ad740 (HEAD, tag: latest, origin/master, master) Added more stuff.
6df881a Added stuff.
3d73a7d Initial Commit.
$ git commit -am "Added more stuff again."
$ git log --oneline --decorate
ff61d15 (HEAD, master) Added more stuff again.
63ad740 (tag: latest, origin/master) Added more stuff.
@kevinkarwaski
kevinkarwaski / gist:5340928
Last active December 15, 2015 23:29
Limited S3 IAM policy for Cloudability
{
"Statement":[
{
"Action": "s3:ListAllMyBuckets",
"Effect": "Allow",
"Resource": "arn:aws:s3:::*"
},
{
"Action":["s3:ListBucket","s3:GetObject","s3:GetObjectVersion"],
"Effect":"Allow",
#!/usr/bin/env bash
# Oneliner to remove all gems.
# See: http://stackoverflow.com/questions/15100496/uninstalling-all-gems-ruby-2-0-0
for i in `gem list --no-versions`; do gem uninstall -aIx $i; done
@kevinkarwaski
kevinkarwaski / scout_cleanup.rb
Created July 9, 2012 16:32
Scout Management Script
#!/usr/bin/env ruby
require 'scout_api'
#*************************************
# Playing around with the Scout API...
#*************************************
#Create the connection object.
scout = Scout::Account.new(ENV['SCOUT_ACCOUNT'], ENV['SCOUT_USER'], ENV['SCOUT_PASSWORD'])
@kevinkarwaski
kevinkarwaski / soloistrc
Created July 2, 2012 00:13
Soloistrc configuration file.
cookbook_paths:
- ./cookbooks/
recipes:
- pivotal_workstation::create_var_chef_cache
- pivotal_workstation::java
- pivotal_workstation::git_config_global_defaults
- pivotal_workstation::gem_no_rdoc_no_ri
- pivotal_workstation::bash_profile-better_history
- pivotal_workstation::bash_profile-aliases
- pivotal_workstation::bash_profile-ps1
@kevinkarwaski
kevinkarwaski / nomethoderror_chef
Created March 22, 2012 16:37
NoMethodError gem_package chef resource on bootstrap
This only seems to happen if I attempt to override the passenger version in a role or environment while bootstrapping. If I add the overrides after the bootstrap completes successfully, the block gets executed successfully.
Block in recipe:
gem_package "passenger" do
version node[:nginx][:passenger_version]
notifies :run, resources(:bash => "compile_nginx_source")
end
@kevinkarwaski
kevinkarwaski / multi_env_knife_config
Created February 18, 2012 19:06
Knife config for Multiple Chef Environments
#
# This is an example of a knife.rb configuration that uses yml and a
# simple env var (CHEF_ENV) to manage multiple hosted Chef environments.
#
# Example usage:
# export CHEF_ENV=evnironment_01
# knife status
#
# Based on: http://blog.blankpad.net/2010/09/28/multiple-knife-environments---the-return/
#
@kevinkarwaski
kevinkarwaski / Gemfile.cap
Created December 16, 2011 22:26
Gems needed for cap based deployments with chef integration.
source "http://rubygems.org"
gem 'chef', '0.10.4'
gem 'capistrano', '2.9.0'
gem 'capistrano-ext', '1.2.1'
gem 'capistrano-chef'
@kevinkarwaski
kevinkarwaski / multistage_cap_example
Created December 6, 2011 06:07
Multi-stage Capistrano Example
#
# Multi-stage Capistrano Example
#
# Example calls: cap dev deploy, cap prod deploy
# Env specific data defined in deploy/dev, deploy/prod
#
# Required gems: capistrano, capistrano-ext, rubygems, cloudfiles
#
require 'capistrano/ext/multistage'
======================================================
Setting up Django using Apache/mod_wsgi on Ubuntu 8.10
======================================================
This article will cover setting up Django using Apache/mod_wsgi on Ubuntu
8.10. The article is targeted at a production environment, but keep in mind
this is a more generalized environment. You may have different requirements,
but this article should at least provide the stepping stones.
The article will use distribution packages where nesscary. As of 8.10 the