Skip to content

Instantly share code, notes, and snippets.

@jcarley
jcarley / jsonmin
Created Dec 17, 2020
Minifies and escapes a json file. I use this for minifying json key files from GCP
View jsonmin
#!/usr/bin/env bash
usage() {
echo "./jsonmin <INFILE> <OUTFILE>"
echo " INFILE: File to be minified"
echo " OUTIFLE: File to save minified json as"
}
INFILE=$1
OUTFILE=$2
@jcarley
jcarley / postman-pre-request01.js
Last active Dec 5, 2020
Postman pre-request script to automatically get a bearer token from Auth0 and save it for reuse. Two approaches.
View postman-pre-request01.js
const echoPostRequest = {
url: 'https://<my url>.auth0.com/oauth/token',
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
client_id:'<your client ID>',
client_secret:'<your client secret>',
@jcarley
jcarley / .rubocop.yml
Last active Dec 4, 2020
Boilerplate Rubocopy yaml file
View .rubocop.yml
# The behavior of RuboCop can be controlled via the .rubocop.yml
# configuration file. It makes it possible to enable/disable
# certain cops (checks) and to alter their behavior if they accept
# any parameters. The file can be placed either in your home
# directory or in some project directory.
#
# RuboCop will start looking for the configuration file in the directory
# where the inspected file is and continue its way up to the root directory.
#
# See https://docs.rubocop.org/rubocop/configuration
View .eslintrc01.js
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
View gist:b9d2b74efde3afb0666236d9abe40a8b
service salt-minion stop
rm -f /etc/salt/pki/minion/minion_master.pub
echo "master: salt" > /etc/salt/minion
service salt-minion start
View assume-role-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
@jcarley
jcarley / generate_docker_cert.sh
Created Jan 19, 2018 — forked from bradrydzewski/generate_docker_cert.sh
Generate trusted CA certificates for running Docker with HTTPS
View generate_docker_cert.sh
#!/bin/bash
#
# Generates client and server certificates used to enable HTTPS
# remote authentication to a Docker daemon.
#
# See http://docs.docker.com/articles/https/
#
# To start the Docker Daemon:
#
# sudo docker -d \
@jcarley
jcarley / le-install.sh
Created Jan 17, 2018 — forked from hisnameisjimmy/le-install.sh
Unifi Controller one-shot install script for Ubuntu 16.04 with Lets Encrypt
View le-install.sh
#!/bin/sh
#
# This script stands on the shoulders of giants.
#
# It is written and tested for Ubuntu 16.04 on Digital Ocean using a 1GB droplet.
# Anything less than 1GB of memory may cause issues with anything memory intensive
# like imports/exports.
#
# It does the following:
# 1) Opens the appropriate ports for Unifi, SSH, Web/SSL traffic via iptables
View Dockerfile
FROM ruby:2.4.2
ENV DEBIAN_FRONTEND noninteractive
ENV TERM xterm
ADD bashrc /root/.bashrc
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main" >> /etc/apt/sources.list.d/pgdg.list && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN apt-get -qqy update && \
@jcarley
jcarley / .babelrc
Created Aug 10, 2017 — forked from fdietz/.babelrc
Phoenix Framework Webpack Integration (replacing Brunch)
View .babelrc
{
"presets": ["es2015", "react", "babel-preset-stage-0"]
}