Skip to content

Instantly share code, notes, and snippets.

Keith Grennan keeth

  • Vancouver, BC
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am keeth on github.
  • I am keeth (https://keybase.io/keeth) on keybase.
  • I have a public key ASCgC0494QvYPRo5H-dPDtqY-Z6mIsW_Z8Hk9PhsfnWhQAo

To claim this, I am signing this object:

@keeth
keeth / cacti.yml
Last active Sep 18, 2017
Non-interactive install of Cacti 1.1.23 + Spine 1.1.23 on Ubuntu Server LTS 16.04 EC2 (via Cloud Init / Terraform)
View cacti.yml
#cloud-config
write_files:
-
content: |
[mysqld]
max_heap_table_size=64M
tmp_table_size=64M
join_buffer_size=64M
innodb_doublewrite=OFF
innodb_buffer_pool_size=242M
@keeth
keeth / 01-next-js.config
Last active Jul 21, 2018
Next.js on Elastic Beanstalk, run 'next build' or 'npm run build' from .eb-extensions
View 01-next-js.config
container_commands:
01_build:
command: "PATH=$NODE_HOME/bin:$PATH $NODE_HOME/bin/npm run build"
@keeth
keeth / 00-packages.config
Last active Apr 16, 2019
Django, Postgres 9.6 and Celery on Elastic Beanstalk - ebextensions
View 00-packages.config
packages:
yum:
libjpeg-turbo-devel: []
libpng-devel: []
libcurl-devel: []
commands:
01_install_rhel_pg:
command: "(yum repolist |grep -q pgdg96) || sudo yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-ami201503-96-9.6-2.noarch.rpm -y"
02_install_pg_devel:
@keeth
keeth / bean-scratch-accel-no-button.ino
Last active Apr 17, 2017
Lightblue Bean Serial/Scratch speed tests with and without accelerometer
View bean-scratch-accel-no-button.ino
uint8_t buffer[20];
String msg = "ABCDEFGHIJKLMNOPQRS";
unsigned long startTest = 20000;
unsigned long stopTest = 40000;
void setup() {
pinMode(A3, INPUT);
msg.toCharArray((char *)buffer,20);
}
@keeth
keeth / api.tf
Last active Dec 20, 2018
Apex + Terraform + AWS Lambda + API Gateway + JSON Encoded Errors + CORS
View api.tf
resource "aws_api_gateway_rest_api" "myApi" {
name = "myApi-${var.env}"
description = "My awesome API (${var.env} environment)"
}
resource "aws_api_gateway_deployment" "myApi" {
depends_on = [
"aws_api_gateway_integration.myApi_myEndpoint_post",
"aws_api_gateway_integration_response.myApi_myEndpoint_post",
"aws_api_gateway_integration_response.myApi_myEndpoint_post_400",
@keeth
keeth / createWrappedSagaMiddleware.js
Last active Dec 4, 2017
Pre-process (de-batch, filter) actions for redux saga middleware, without affecting the reducers
View createWrappedSagaMiddleware.js
const noop = () => {};
const actionsToIgnore = new Set(['SOME_ACTION', 'SOME_OTHER_ACTION']);
function createWrappedSagaMiddleware() {
const delegate = createSagaMiddleware();
const sagaMiddleware = props => next => {
const actionHandler = delegate(props)(noop);
return action => {
// send to reducers, keep the result
const result = next(action);
@keeth
keeth / release.rb
Created Aug 10, 2016
Programmatically/script release an iOS app with Spaceship
View release.rb
#!/usr/bin/env ruby
require 'spaceship'
Spaceship::Tunes.login(ENV['FASTLANE_USER'], ENV['FASTLANE_PASSWORD'])
app_id = ARGV.shift
if app_id.nil?
abort('Usage: release.rb com.mycompany.myapp')
@keeth
keeth / heartbeat.js
Last active Aug 4, 2016
a better travis_wait (it prints the script output as it comes in, rather than all at the end)
View heartbeat.js
const spawn = require('child_process').spawn;
const command = process.argv[2];
const args = process.argv.slice(3);
const child = spawn(command, args);
console.log(`heartbeat: running command ${command} with args ${args}`);
const heartbeat = setInterval(() => {
console.log('❤️');
}, 1000 * 60);
@keeth
keeth / Select.js
Last active Dec 29, 2017
A formsy-react wrapper around React Select (ES6)
View Select.js
import React from 'react';
import Formsy from 'formsy-react';
import ReactSelect from 'react-select';
import './Select.less';
const Select = React.createClass({
mixins: [Formsy.Mixin],
You can’t perform that action at this time.