Makefile and YAML templates for automating the use of AWS Elastic Container Registry with Kubernetes.
Based off of this awesome Redsaid blog post.
- Amazon ECR, along with your AWS account ID and the region your ECR is in
- AWS CLI
# Copyright (c) 2016-2018 Ming Qin (覃明) <https://github.com/QinMing> | |
# Open source under MIT LICENSE. | |
lazy_load() { | |
# Act as a stub to another shell function/command. When first run, it will load the actual function/command then execute it. | |
# E.g. This made my zsh load 0.8 seconds faster by loading `nvm` when "nvm", "npm" or "node" is used for the first time | |
# $1: space separated list of alias to release after the first load | |
# $2: file to source | |
# $3: name of the command to run after it's loaded | |
# $4+: argv to be passed to $3 |
CREATE OR REPLACE FUNCTION set_foo(foo_val varchar) RETURNS void AS $$ | |
BEGIN | |
EXECUTE format('SET SESSION my.foo TO %I', foo_val) ; | |
END; | |
$$ LANGUAGE plpgsql; | |
CREATE OR REPLACE FUNCTION get_foo() RETURNS varchar AS $$ | |
DECLARE | |
foo_val varchar; | |
BEGIN |
Makefile and YAML templates for automating the use of AWS Elastic Container Registry with Kubernetes.
Based off of this awesome Redsaid blog post.
// This script will boot app.js with the number of workers | |
// specified in WORKER_COUNT. | |
// | |
// The master will respond to SIGHUP, which will trigger | |
// restarting all the workers and reloading the app. | |
var cluster = require('cluster'); | |
var workerCount = process.env.WORKER_COUNT || 2; | |
// Defines what each worker needs to run |
// Copyright (c) 2017 Ismael Celis | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// The above copyright notice and this permission notice shall be included in all |
#!/bin/sh | |
# | |
# Pre-commit hook that verifies if all files containing 'vault' in the name | |
# are encrypted. | |
# If not, commit will fail with an error message | |
# | |
# File should be .git/hooks/pre-commit and executable | |
FILES_PATTERN='.*vault.*\.yml$' | |
REQUIRED='ANSIBLE_VAULT' |
Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.
Most workflows make the following compromises:
Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure
flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.
Use production SSL certificates locally. This is annoying
package util | |
object Slug { | |
def apply(input:String) = slugify(input) | |
def slugify(input: String): String = { | |
import java.text.Normalizer | |
Normalizer.normalize(input, Normalizer.Form.NFD) | |
.replaceAll("[^\\w\\s-]", "") // Remove all non-word, non-space or non-dash characters | |
.replace('-', ' ') // Replace dashes with spaces |