Skip to content

Instantly share code, notes, and snippets.

View rrichards's full-sized avatar
💭
Rocking the CLI

Ryan Richards rrichards

💭
Rocking the CLI
  • R3 Technologies, Inc.
  • Edmond, OK
  • 14:19 (UTC -12:00)
  • X @rrichards
View GitHub Profile
@rrichards
rrichards / pg.md
Created July 20, 2017 07:12 — forked from benschwarz/pg.md
Awesome postgres
@rrichards
rrichards / letsencrypt_2017.md
Created June 21, 2017 03:26 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@rrichards
rrichards / 0_install_docker_prl_osx.sh
Created November 6, 2016 05:21
MongoDB cluster on multihost swarm network with docker-machine-parallels
#!/bin/bash
# using homebrew -- http://brew.sh
#docker and docker-machine
brew install docker
brew install docker-machine
brew install docker-machine-parallels
#consul
brew install consul
@rrichards
rrichards / .emacs
Created September 19, 2016 08:16
pbcopy & pbpaste for Emacs
(defun copy-from-osx ()
(shell-command-to-string "pbpaste"))
(defun paste-to-osx (text &optional push)
(let ((process-connection-type nil))
(let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
(process-send-string proc text)
(process-send-eof proc))))
(setq interprogram-cut-function 'paste-to-osx)
@rrichards
rrichards / puma.rb
Created September 18, 2016 14:01 — forked from jtadeulopes/puma.rb
Puma config
#!/usr/bin/env puma
threads 0, 4
# workers 3
bind "unix:///var/tmp/project.sock"
pidfile "/var/run/puma/project.pid"
environment "production"
stdout_redirect "/var/log/puma/project.log"
@rrichards
rrichards / project.conf
Created September 18, 2016 13:59 — forked from jtadeulopes/project.conf
Puma upstart
description "project server config"
pre-start script
mkdir -p /var/log/puma
chown deploy. /var/log/puma
mkdir -p /var/run/puma
chown deploy. /var/run/puma
end script
@rrichards
rrichards / Import Instapaper CSV.applescript
Created September 4, 2016 01:16 — forked from annard/Import Instapaper CSV.applescript
Import Instapaper articles (exported as CSV from their site) using Numbers into DEVONthink Pro (Office). The web pages will be imported as PDF documents. The folder structure of Instapaper will be replicated in an "Instapaper" top level group for the currently open database.
-- Use Instapaper to export a CSV file of your articles.
-- Must have Numbers to open it in.
-- Will create PDF documents in /Instapaper/<your folder in Instapaper> groups.
-- Be sure to select an open database in DT Pro before you run this.
--
-- Created by Annard Brouwer, 24/08/2014
--
-- This program is free software released "as-is"; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-- Get a copy of the GNU General Public License by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@rrichards
rrichards / config.ru
Created September 2, 2016 02:45 — forked from snapper/config.ru
A sample config.ru file
# 301 rewrite!
require 'rack/rewrite'
use Rack::Rewrite do
r301 %r{.*}, 'http://somedomain.com$&', :if => Proc.new {|rack_env|
rack_env['SERVER_NAME'] != 'somedomain.com'
}
end
# Attribution goes to https://github.com/rack/rack-contrib/blob/master/lib/rack/contrib/try_static.rb
@rrichards
rrichards / slack.sh
Created August 26, 2016 19:55 — forked from zdk/slack.sh
Simple and stupid, Nagios command for Slack.
#!/bin/bash
WEBHOST_NAGIOS="<Host that nagios is runing on>"
SLACK_CHANNEL="#<Channel name>"
SLACK_BOTNAME="<Bot Name>"
WEBHOOK_URL="<Webhook URL>" #Get it from Slack Incoming WebHooks setup instruction
#Set the message icon based on Nagios service state
if [ "$NAGIOS_SERVICESTATE" = "OK" ]
then
@rrichards
rrichards / gist:0fb711e8cd5a2674cb1ab9c5fb8a6233
Created August 14, 2016 03:59 — forked from simonmorley/gist:19f9c9b1142d43b2e278
Google Compute Engine Snapshot Create and Rotate in Ruby
#!/bin/ruby
require 'json'
require 'time'
class Snapshot
def initialize()
@format = 'json'
@zone = get_zone
@hostname = hostname