Skip to content

Instantly share code, notes, and snippets.

View lusis's full-sized avatar

John E. Vincent lusis

View GitHub Profile
@lusis
lusis / twopass_test.go
Created January 9, 2018 07:24
two-pass but it's only in testing
func TestSCMPluginForProjectResponseEnableImport(t *testing.T) {
obj := &SCMPluginForProjectResponse{}
// The test response file used here does NOT match the struct
data, dataErr := testdata.GetBytes(ListSCMPluginsResponseExportTestFile)
if dataErr != nil {
t.Fatalf(dataErr.Error())
}
placeholder := make(map[string]interface{})
_ = json.Unmarshal(data, &placeholder)
@lusis
lusis / t_test.go
Created January 9, 2018 06:00
fml golang json.Unmarshal
package main
import (
"encoding/json"
"testing"
"github.com/alecthomas/assert"
"github.com/davecgh/go-spew/spew"
)
@lusis
lusis / README.md
Last active June 6, 2017 14:08
Proxying puppetforge files with Artifactory

Proxying puppetforge requests with Artifactory and Nginx

We have two goals:

  • Ensure that we have local deterministic cache of puppet modules pulled from the forge
  • Force all server requests to go through artifactory where possible

Artifactory configuration

We're going to use a remote repo type of generic pointing to forgeapi.puppetlabs.com. The json in this gist should provide the relevant information.

nginx configuration

@lusis
lusis / README.md
Created November 19, 2014 05:12
Binary CM options

Thoughts on a binary strongly typed CM system

I've been thinking for a while about a strongly typed binary CM system based on Golang (Rust would work as well).

The model depends on something that compiles to a single binary and compiles very fast. Typically golang fits this bill. I've not played with Rust just yet but if it compiles fast, it would work as well.

The workflow goes something like this:

  • Upload source to the "server" component.
  • Server component compiles a binary for all hosts it has registered that the code would apply to (i.e. role:webserver)
  • Optionally for unknown clients, the binary is compiled on-the-fly when the host checks in and provides at least platform information. The coolest part is that golang is easily cross-compiled so this works for all platforms that check in.
---
operations:
default: 'read'
paths:
- '[^/debug/pprof/trace.*]': 'none'
debug:
default: 'none'
paths:
- '(^/reload|^/debug/pprof/.*)': 'write'
@lusis
lusis / cache_test.t
Created November 3, 2016 19:39
Test::Nginx to validate cache behaviour
use Test::Nginx::Socket 'no_plan';
no warnings;
no_diff;
#repeat_each(5);
run_tests();
__DATA__

Things I like

simple deployment

Initially getting started is very easy. Being a java based application, it ships with a nice embedded db that will meet most small usage scenarios very easily.

backup/recovery

Artifactory makes backups very easy to configure and restores are very straightforward. I've done several migrations from/to AWS and installs and it's worked very well.

dedupe

@lusis
lusis / acceptance_spec.rb
Created September 28, 2016 18:28
this won't ever work
require 'spec_helper_acceptance'
describe 'nginx' do
context 'default' do
pp = <<-EOS
include stdlib
include nginx
EOS
@lusis
lusis / README.md
Created August 8, 2014 17:11
rundeck slack hubot integration

This is a pretty opinionated solution that we use internally. It's strictly designed to post to slack via the API and it uses our notion of wrapping EVERYTHING with a role. All of our plugins automatically use brain storage as well. To be able to execute anything with hubot, you have to be a rundeck_admin role user.

You should be able to tease out the rundeck API stuff specifically.

It depends on a common format for your job defs in rundeck. We have two types of jobs in rundeck that we use via this plugin:

  • ad-hoc
  • predefined

ALL of our jobs have a common parameter called slack_channel. Hubot will automatically set this for you based on where/who it was talking to.

  • install gcalcli and connect it up to your account (gcalcli agenda after install should start the auth process)
  • write the python file above to somewhere (I use ~/.i3/cal_wrapper.py)
  • setup your ~/.i3/config with the status_command above
  • reload i3

optional

I added the following cron entry to alert via notify-send and dunst gives me warnings */5 * * * * gcalcli remind