Skip to content

Instantly share code, notes, and snippets.

View budgester's full-sized avatar

Martin Stevens budgester

View GitHub Profile
@budgester
budgester / vimrc
Last active December 9, 2019 08:03
syntax on
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'tiagofumo/vim-nerdtree-syntax-highlight' "to highlight files in nerdtree
Plugin 'davidhalter/jedi-vim'
virtualenv -p python3 web
source web/bin/activate
deactivate
@budgester
budgester / gist:2106ecad0e73117d42f8dcf793c4f4b5
Created March 30, 2018 19:41
Inspec Docker with credentials file
docker run -it \
-e AWS_ACCESS_KEY_ID=$(aws --profile default configure get aws_access_key_id) \
-e AWS_SECRET_ACCESS_KEY=$(aws --profile default configure get aws_secret_access_key) \
-e AWS_REGION='eu-west-1' \
--rm \
-v $(pwd):/share \
chef/inspec exec aws-dev -t aws:
#!/bin/bash
#
# vault-ec2-auth.sh
# Authenticates an EC2 instance to Hashicorp Vault
#
# configuration stored in environment variables in /etc/vault/client.conf
# expected configuration (defaults are selected below if none is specified):
# VAULT_ADDR = url of vault server
# VAULT_ROLE = role name to authenticate as
# Retrieve a secret, either from the env or from Vault
def self.secret(node, path)
# First, try in the environment
secret = AiHelper.environment_secret(node, path)
if secret.nil? || secret == 'IN_VAULT'
secret = AiHelper.vault_secret(node, path)
end
secret
end
function rsall() {
$@ -K ${RACKSPACE_API_KEY} -A ${RACKSPACE_USERNAME}
$@ -K ${RACKSPACE_API_KEY_1} -A ${RACKSPACE_USERNAME_1}
$@ -K ${RACKSPACE_API_KEY_2} -A ${RACKSPACE_USERNAME_2}
}
@budgester
budgester / knife.rb
Created January 15, 2017 16:30 — forked from jtimberman/knife.rb
Commented knife.rb for all the things
# Knife Configuration File.
#
# This is a Ruby DSL to set configuration parameters for Knife's
# general options. The default location for this file is
# ~/.chef/knife.rb. If multiple Chef repositories are used,
# per-repository configuration files can be created. A per repository
# configuration file must be .chef/knife.rb in the base directory of
# the Chef repository. For example,
#
# ~/Development/chef-repo/.chef/knife.rb
dsc_resource 'Change User on TeamCity Agent Service' do
resource :service
property :ensure, 'Present'
property :name, SERVICE_NAME
property :credential, ps_credential("test@domain", "password")
end
-----> Starting Kitchen (v1.10.0)
-----> Converging <default-centos-67>...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 4.3.5...
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
-----> Chef Omnibus installation detected (install only if missing)
Transferring files to <default-centos-67>
input {
file {
type => "httpd"
path => "/var/log/httpd/*.log"
}
}
filter {
if [type] == "httpd" {
grok {