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
@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 / rails4_paperclip_default_url
Last active March 19, 2019 00:54
rails 4 paperclip asset_path precompiled default_url
I was having trouble setting the default_url for paperclip attachables while using rails 4 asset pipeline fingerprints.
What was not working for some reason:
default_url: ActionController::Base.helpers.asset_path('event_default.jpg')
What worked for me:
default_url: lambda { |image| ActionController::Base.helpers.asset_path('event_default.jpg') }
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: ingress-lister
namespace: monitoring
labels:
app: ingress-lister
spec:
schedule: "0 17 * * *" # daily
jobTemplate:
apiVersion: v1
kind: ServiceAccount
metadata:
name: ingress-lister
namespace: monitoring
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: ingress-lister
package main
import (
"fmt"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
# Download the compiled elasticsearch rather than the source.
wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@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)
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@sgringwe
sgringwe / simple_form_bootstrap_3.rb
Created July 28, 2013 04:37
Using simple_form with twitter bootstrap 3.0. These are the changes I made when upgrading.
SimpleForm.setup do |config|
config.wrappers :bootstrap, :tag => 'div', :class => 'form-group', :error_class => 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
b.wrapper :tag => 'div', :class=> 'col-lg-10' do |ba|
ba.use :input # , :class => ['form-control']
ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
end
@sgringwe
sgringwe / elasticsearch.rake
Created July 21, 2013 08:21
Reindex elasaticsaerch (fixed from tire wiki page)
# Run with: rake environment elasticsearch:reindex
# Begins by creating the index using tire:import:model command. This will create the "official" index name, e.g. "things" each time.
# Then we rename it to, e.g. "things_20121001052916" and alias "things" to it.
namespace :elasticsearch do
desc "re-index elasticsearch"
task :reindex => :environment do
klasses = [
User,