Skip to content

Instantly share code, notes, and snippets.

Avatar

John E. Vincent lusis

View GitHub Profile
@lusis
lusis / dba-user.json
Created Jan 7, 2011
Managing MySQL user accounts with Chef
View dba-user.json
{
"id":"dbauser",
"uid":506,
"comment":"DBA User",
"shell":"/bin/bash",
"groups": [
"sysadm",
"dba"
],
"ssh_key": "XXXXXXXXXX"
View chef-rundeck.rb
# run with
# chef-apply chef-rundeck.rb
require 'chef'
require 'chef/node'
require 'chef/mixin/xml_escape'
require 'chef/rest'
require 'chef/role'
require 'chef/environment'
require 'chef/data_bag'
View python argparse subcommand subparsers.py
import argparse
from mock import Mock
m = Mock()
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
query_group = subparsers.add_parser('query')
add_group = subparsers.add_parser('add')
View alternate-foo.go
package fooservice
import (
"github.com/segmentio/ksuid"
idgen "github.com/lusis/foobar/idgen"
pb "github.com/lusis/foobar/pb"
storer "github.com/lusis/foobar/storer"
)
@lusis
lusis / iam-s3-policy.json
Created Jan 5, 2011
A sample AWS IAM json policy file with read-only access to certain S3 buckets
View iam-s3-policy.json
{
"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"],
@lusis
lusis / package.sh
Created Feb 26, 2013
Generate system packages with FPM as part of maven.
View package.sh
#!/usr/bin/env bash
if [ -z ${CURRENT_ITERATION} ]; then
CURRENT_ITERATION=0enstratus1
fi
case "${PKG_VERSION}" in
*-SNAPSHOT)
echo "Packaging a snapshot version!"
CURRENT_TSTAMP=`date +%s`
#CURRENT_SHA=`git rev-parse HEAD`
#CURRENT_ITERATION="${CURRENT_TSTAMP}-${CURRENT_SHA}"
@lusis
lusis / README.md
Last active Sep 14, 2020
terraform template to generate serverspec properties
View README.md

This uses terraform's template_file resource to generate a yaml properties file for serverspec to use.

  • create the Rakefile in your terraform project root
  • create a spec directory and put spec_helper.rb in it
  • create the templates/properties.tmpl.yml file
  • create the serverspec.tf
  • terraform apply

tests

Tests will be matched based on roles defined for a given node.

@lusis
lusis / keytool.rb
Created Mar 26, 2012
recipe for adding certs to keytool
View keytool.rb
keystore = "/etc/java-6-sun/security/cacerts"
keystore_pass = "foobar"
# you'll need foo.cert et. al. in files/default
certs = %w{foo bar bang}
certs.each do |cert|
cookbook_file "#{Chef::Config[:file_cache_path]}/#{cert}.cert" do
source "#{cert}.cert"
end
@lusis
lusis / opsschool.md
Created Oct 25, 2012
What happened here?
View opsschool.md

Random idea

I'm a big fan of the Ops School idea. I've struggled for years about how to "train up" someone coming into this field. So much of our skill set is forged in the fire of outages and troubleshooting.

One of the things that is both good and bad about system administration and operations is that we tend to see patterns. It's good in that we immediately see things that stand out. The downside is we tend to superimpose that pattern recognition in inappropriate ways.

We had an interesting issue happen yesterday at the dayjob. I won't go into exactly what it was here but I had an idea based on some graphs I was looking at. It's part social experiment but it's also part problem solving skills.

Given the following image with no context, what do you think happened? What are some of the key indicator points that jump out and what pattern do they call to mind?

_(Since it may not be clear simply from an image resolution perspective, there are 4 me

@lusis
lusis / myorg.proto
Created Feb 13, 2020
example.proto
View myorg.proto
syntax = "proto3"
package = "com.myorg.ptypes";
message User {
int64 id = 1;
UserStatus status = 2;
}
message Group {
int64 id = 1;