Skip to content

Instantly share code, notes, and snippets.

View keeth's full-sized avatar

Keith Grennan keeth

View GitHub Profile
@keeth
keeth / 00-packages.config
Last active April 26, 2021 00:35
Django, Postgres 9.6 and Celery on Elastic Beanstalk - ebextensions
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 April 17, 2017 18:38
Lightblue Bean Serial/Scratch speed tests with and without accelerometer
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 January 13, 2021 14:34
Apex + Terraform + AWS Lambda + API Gateway + JSON Encoded Errors + CORS
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 October 9, 2021 16:04
Pre-process (de-batch, filter) actions for redux saga middleware, without affecting the reducers
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 August 10, 2016 05:54
Programmatically/script release an iOS app with Spaceship
#!/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 August 4, 2016 23:43
a better travis_wait (it prints the script output as it comes in, rather than all at the end)
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 December 29, 2017 11:38
A formsy-react wrapper around React Select (ES6)
import React from 'react';
import Formsy from 'formsy-react';
import ReactSelect from 'react-select';
import './Select.less';
const Select = React.createClass({
mixins: [Formsy.Mixin],
#!/bin/sh
pushd ~/src/github/ssh-config-aws
bundle exec ./ssh-servers-from-aws.rb spright
./rebuild-ssh-config.sh
popd
package fitt.util
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
import java.security.SignatureException
class HmacUtil {
static String hmac(String text, String secret) {
String result
var gulp = require('gulp');
var browserify = require('browserify');
var del = require('del');
var reactify = require('reactify');
var source = require('vinyl-source-stream');
var webserver = require('gulp-webserver');
var less = require('gulp-less');
var path = require('path');
var rename = require('gulp-rename');
var inject = require('gulp-inject');