Skip to content

Instantly share code, notes, and snippets.

View sgringwe's full-sized avatar

Scott Ringwelski sgringwe

  • Handshake
  • San Francisco, CA
View GitHub Profile
apiVersion: v1
kind: ServiceAccount
metadata:
name: ingress-lister
namespace: monitoring
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: ingress-lister
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: ingress-lister
namespace: monitoring
labels:
app: ingress-lister
spec:
schedule: "0 17 * * *" # daily
jobTemplate:
package main
import (
"fmt"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@sgringwe
sgringwe / dc_2017_biblio.md
Created April 24, 2017 15:26 — forked from BaseCase/dc_2017_biblio.md
List of resources recommended or mentioned by the speakers at Deconstruct 2017

Deconstruct 2017 Bibliography

Here are all of the resources mentioned by Deconstruct 2017 speakers, along with who recommended what. Please post a comment if I missed something or have an error!

DC 2017 Speakers' Choice Gold Medalist

  • Seeing Like a State by James Scott

Books

  • Public Opinion by Walter Lippmann (Evan Czaplicki)
  • A Pattern Language by Christopher Alexander (Brian Marick)
  • Domain Driven Design by Eric Evans (Brian Marick)
@sgringwe
sgringwe / check-pdf-validity.sh
Created September 27, 2015 23:07
Check pdf validity using ghostscript
gs -dNOPAUSE -dBATCH -sDEVICE=nullpage valid.pdf
GPL Ghostscript 9.16 (2015-03-30)
Copyright (C) 2015 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
(return code 0)
: gs -dNOPAUSE -dBATCH -sDEVICE=nullpage invalid.pdf
@sgringwe
sgringwe / osx-10.10-setup.md
Last active August 29, 2015 14:25 — forked from kevinelliott/osx-10.10-setup.md
Mac OS X 10.10 Yosemite Setup
@sgringwe
sgringwe / gist:912570668aca22bb3391
Created July 3, 2015 20:35
example tire search function
def self.search(params)
params[:query] = params[:query].downcase if params[:query].present? # Only finds if downcased
tire.search(load: params[:load] || false, page: params[:page], per_page: params[:per_page] || 25) do
query do
boolean minimum_number_should_match: 1 do
Searchable.should_match_multi_field(self, params, 'name', 10)
Searchable.should_fuzzy_match(self, params, :name)
end if params[:query].present?
boolean do
# These are all the cops that are enabled in the default configuration.
Style/AccessModifierIndentation:
Description: Check indentation of private/protected visibility modifiers.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected'
Enabled: false
Style/AccessorMethodName:
Description: Check the naming of accessor methods for get_/set_.
Enabled: true
@sgringwe
sgringwe / select2-multiple-ajax-rails
Created September 4, 2014 17:34
select2 remote ajax multiple fix for rails
Rails expects an array of ids but because select2 uses a hidden input for multiple-ajax configuration, it returned a comma separated string. To get around this I did a check and conversion at the beginning of my strong params function:
if params[:interview_schedule] and params[:interview_schedule][:contact_ids] and params[:interview_schedule][:contact_ids][0].include?(",")
params[:interview_schedule][:contact_ids] = params[:interview_schedule][:contact_ids][0].split(",")
end
Thanks to https://coderwall.com/p/cxrwsw# for the motivation.
@sgringwe
sgringwe / Fix for circular dependency detected while autoloading constant in Rspec
Last active August 29, 2015 14:04
Fix for circular dependency detected while autoloading constant in Rspec
# I was getting this error randomly in my specs:
# Circular dependency detected while autoloading constant UsersController
# the fix for me was changing the following mistake:
school = FactoryGirl.create(:school)
# to be
let(:school) { FactoryGirl.create(:school) }