Skip to content

Instantly share code, notes, and snippets.

@johnallen3d
johnallen3d / Dockerfile
Last active Apr 1, 2021
Basic Kedro + Docker Setup
View Dockerfile
FROM python:3.8-buster
WORKDIR /usr/src/app
COPY requirements.txt .
RUN \
pip install -r requirements.txt
COPY docker-entrypoint.sh .
View api-deployment.md

Every PR

  • If the PR is not for a maintenance issue or an external dependency then add a CHANGELOG entry

Production Releases

  • Update CHANGELOG

    • Create a new release header, example: ## Release PR #608 (2020-09-15)
    • Add this just below "When submitting a new PR..."
@johnallen3d
johnallen3d / _README_.md
Last active Nov 7, 2019
Convert a Google Sheet into a Ruby Array of Hashes
View _README_.md

Convert a Google Sheet into a Ruby Array of Hashes

Example

id first_name last_name
1 Trey Anastasio
2 Mike Gordon

becomes

@johnallen3d
johnallen3d / google-sheet-to-array-of-hashes.rb
Created Nov 7, 2019
Convert a Google Sheet into a Ruby Array of Hashes
View google-sheet-to-array-of-hashes.rb
require 'google/apis/sheets_v4'
require 'googleauth'
# with the following environment variables set
# GOOGLE_ACCOUNT_TYPE=service_account
# GOOGLE_CLIENT_EMAIL=...
# GOOGLE_PRIVATE_KEY=...
authorization = Google::Auth::ServiceAccountCredentials.make_creds(
scope: ['https://www.googleapis.com/auth/drive']
@johnallen3d
johnallen3d / keymap.c
Created Jul 21, 2019
Keymapping for Keebio Quefrency 60%
View keymap.c
#include QMK_KEYBOARD_H
extern keymap_config_t keymap_config;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _BASE 0
#define _FN1 1
@johnallen3d
johnallen3d / nhl-standings.coffee
Created Oct 20, 2018
Very rough draft of a Übersicht NHL standings widget
View nhl-standings.coffee
command: "curl -s 'https://statsapi.web.nhl.com/api/v1/standings'"
refreshFrequency: '60m'
render: (_) ->
"""
<fieldset>
<legend>NHL Standings</legend>
<table id="standings">
<thead>
@johnallen3d
johnallen3d / _README_.md
Last active Jun 13, 2018
Take the formatted output of `mpc status` and convert it into JSON...
View _README_.md

MPC Status as JSON

Take the formatted output of mpc status and convert it to JOSN.

Why?

I'm running Übersicht and made some tweaks to another users mpd widget. The existing implementation used awk and echoed values concatenating them together with @. Then in JS/Coffeescript parsing the string on @ and accessing the values based on expected position. It occurred to me it would be more convenient to use JSON in Übersicht so I created this.

Usage

@johnallen3d
johnallen3d / mpc-status-json.sh
Created Jun 9, 2018
Take the formatted output of `mpc status` and convert it into JSON...
View mpc-status-json.sh
#! /usr/bin/env bash
STATUS="$(/usr/local/bin/mpc status)"
if [ $(echo "$STATUS" | wc -l | tr -d ' ') == "1" ]; then
status="[empty]"
else
artist=$(echo "$STATUS" | awk -F" - " 'NR==1{print $1}')
song=$(echo "$STATUS" | awk -F" - " 'NR==1{print $2}')
status=$(echo "$STATUS" | awk 'NR==2{print $1}')
@johnallen3d
johnallen3d / heroku-ci-cd.md
Created Apr 12, 2018
Overview of key Heroku features and CI/CD
View heroku-ci-cd.md
@johnallen3d
johnallen3d / docker-compose.yml
Created Mar 26, 2018
Basic Kong + Postgres setup in Docker (compose)
View docker-compose.yml
version: '2.3'
services:
web:
image: kong:latest
links:
- db
environment:
- "KONG_DATABASE=postgres"
- "KONG_PG_HOST=db"
- "KONG_PROXY_ACCESS_LOG=/dev/stdout"