Skip to content

Instantly share code, notes, and snippets.

View colinrymer's full-sized avatar

Colin Rymer colinrymer

View GitHub Profile
@colinrymer
colinrymer / github_client.ts
Created February 21, 2018 20:49
Example api client code
import * as Octokit from '@octokit/rest'
const client = new Octokit()
export default class GithubClient {
public static async authenticate({username, password, twoFactorCode}: any) {
client.authenticate({
type: 'basic',
username: username,
@colinrymer
colinrymer / config-config.exs
Created March 13, 2017 21:02
Phoenix Prometheus Setup
...
# Prometheus
config :prometheus, MyApp.PhoenixInstrumenter,
controller_call_labels: [:controller, :action],
duration_buckets: [10, 25, 50, 100, 250, 500, 1000, 2500, 5000,
10_000, 25_000, 50_000, 100_000, 250_000, 500_000,
1_000_000, 2_500_000, 5_000_000, 10_000_000],
registry: :default,
duration_unit: :microseconds
- name: Disallow password authentication
lineinfile:
dest: /etc/ssh/sshd_config
regexp: "^PasswordAuthentication"
line: "PasswordAuthentication no"
state: present
notify: Restart ssh
- name: Disallow root SSH access
lineinfile:
+---------+ +-------+ +-----+ +---------+ +---------------+
| GitHub | | Slack | | CI | | Jenkins | | ArtifactRepo |
+---------+ +-------+ +-----+ +---------+ +---------------+
-----------------------\ | | | | |
| Pull Request opened. |-| |

RentPath API Versioning

Introduction

Purpose

As APIs evolve due to changing software requirements, it becomes necessary to version them so as to not break consumers' usage. This specification defines how API versions are specified for APIs built at RentPath and how requests not conforming to this specification are to be handled.

Requirements

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in IETF RFC 2119.

API Versioning

-----------------------------------------------
-- Auto Config Reload
-----------------------------------------------
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
doReload = true
end
end
defmodule DNA do
@doc ~S"""
Count the respective number of times that the symbols 'A', 'C', 'G', and 'T' in a given string.
Returns the count as four integers separated by spaces, representing occureneces of "A", "C", "G", and "T" respectively.
## Examples
iex> DNA.count("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC")
"20 12 17 21"
@colinrymer
colinrymer / Foo.Plugs.CopyReqBody.ex
Created October 15, 2015 14:54
raw request body plug
defmodule Foo.Plugs.CopyReqBody do
import Plug.Conn
def init(mount: "/" <> mount), do: mount
def call(conn = %Plug.Conn{path_info: [mount | _rest]}, mount) do
put_private(conn, :req_body, read_body(conn))
end
def call(conn, _), do: conn
@colinrymer
colinrymer / Gemfile
Created July 8, 2015 16:46
Spree MultipleIncludedBlocks Error
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.2'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
@colinrymer
colinrymer / nginx.conf
Created July 3, 2015 17:57
server blocks of nginx configuration
server {
listen 80 default_server;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443 ssl default_server;
ssl_certificate /etc/nginx/ssl/ssl-bundle.crt;