Skip to content

Instantly share code, notes, and snippets.

View johnchapin's full-sized avatar

John Chapin johnchapin

View GitHub Profile
@johnchapin
johnchapin / aws-mfa-with-creds-env
Created April 10, 2020 20:17
Monkey-patch of aws-mfa tool to allow use of AWS_SHARED_CREDENTIALS_FILE environment variable
#!/usr/local/opt/python/bin/python3.7
# -*- coding: utf-8 -*-
import awsmfa
import os
import re
import sys
awsmfa.AWS_CREDS_PATH = os.getenv('AWS_SHARED_CREDENTIALS_FILE', '%s/.aws/credentials' % (os.path.expanduser('~'),))
if __name__ == '__main__':

Keybase proof

I hereby claim:

  • I am johnchapin on github.
  • I am johnchapin (https://keybase.io/johnchapin) on keybase.
  • I have a public key ASD_tzhscMiT7N2m45xstkcnLEly0_d9oTzvx9ena-IsOQo

To claim this, I am signing this object:

package io.symphonia;
import com.codahale.metrics.Counter;
import io.symphonia.lambda.annotations.CloudwatchLogGroup;
import io.symphonia.lambda.annotations.CloudwatchMetric;
import io.symphonia.lambda.metrics.LambdaMetricSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SampleLambda {
package io.symphonia;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Lambda {
private static Logger LOG = LoggerFactory.getLogger(Lambda.class);
public void handler(String input) {
LOG.info(input);
<dependency>
<groupId>io.symphonia</groupId>
<artifactId>lambda-logging</artifactId>
<version>1.0.0</version>
</dependency>
@johnchapin
johnchapin / gist:b59f1769f3d206cb43c8
Created August 1, 2014 12:51
friend oauth2 + app user example
(ns friend-oauth2-app-example
(:require [cemerick.friend :as friend]
[cemerick.friend [workflows :as workflows]
[credentials :as creds]]
[friend-oauth2.workflow :as oauth2]))
(compojure.core/defroutes routes ,,,)
(def app
(compojure.handler/site
@johnchapin
johnchapin / asynchronicity.core.clj
Last active August 29, 2015 14:02
Bounded work queue w/ core.async
(ns asynchronicity.core
(:require [clojure.core.async :refer [alts!! chan close! go go-loop thread >! <!]]
[clojure.tools.logging :as log]))
(defprotocol JobProtocol
(run [this]))
(defrecord Job [id fcn]
JobProtocol
(run [this]
(defn- derefable? [x]
(instance? clojure.lang.IDeref x))
(defn- derefable-gate [x]
(when (derefable? x) x))
(def deep-structure
{:foo (atom {:bar :baz})})
(some->