Skip to content

Instantly share code, notes, and snippets.

Avatar

J. Voigt joyrexus

View GitHub Profile
@joyrexus
joyrexus / lambda-concurrency-to-cloudwatch.py
Created Aug 11, 2018 — forked from innovia/lambda-concurrency-to-cloudwatch.py
Lambda concurrent execution custom metric on CloudWatch
View lambda-concurrency-to-cloudwatch.py
#!/usr/bin/env python
import boto3
import datetime
import time
ENABLED_REGIONS = [
"us-east-1",
"us-west-2",
"eu-west-1",
"eu-central-1",
@joyrexus
joyrexus / chunk_encode.py
Last active Feb 2, 2019
demo of a chunking json encoder
View chunk_encode.py
import json
import itertools
import StringIO
iterencode = json.JSONEncoder().iterencode
class SerializableList(list):
"""
@joyrexus
joyrexus / README.md
Last active Nov 27, 2019
local webhook testing
View README.md

We can test webhook callbacks with a little http server and a localtunnel.

Run server.js to spin up a local http server on port 8080. It just exposes a top-level route and will print the received header and payload of any request. Then create a localtunnel to have a non-local url that proxies all requests to localhost:8080.


First, install dependencies with npm install.

Then start the express server with npm start.

@joyrexus
joyrexus / mocha-guide-to-testing.js
Last active Oct 6, 2017 — forked from samwize/mocha-guide-to-testing.js
quick overview of mocha testing
View mocha-guide-to-testing.js
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
View test.js
import test from 'tape';
const before = test;
const after = test;
// beforeEach/afterEach rely on shared state.
// That's a big anti-pattern for testing.
// It's also silly to run something before and after
// ever test -- many of your tests won't need it.
View make_hmac.py
#!/usr/bin/python
'''
A little script for generating HMACs.
> ./make_hmac.py SECRET BODY
HMAC
For example ...
> ./make_hmac.py secret foo
@joyrexus
joyrexus / README.md
Last active Aug 13, 2020
collapsible markdown
View README.md

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@joyrexus
joyrexus / install.py
Last active Jul 25, 2020
Shopify App Installation URL via AWS Lambda (Python)
View install.py
# https://help.shopify.com/api/guides/authentication/oauth#scopes
scopes = []
scopes.append('read_content')
scopes.append('write_content')
scopes.append('read_themes')
scopes.append('write_themes')
scopes.append('read_products')
scopes.append('write_products')
scopes.append('read_customers')
@joyrexus
joyrexus / index.js
Last active Dec 2, 2016
hapi redirect demo
View index.js
'use strict';
const Hapi = require('hapi');
const server = new Hapi.Server();
server.connection({
host: 'localhost',
port: 8000
});
You can’t perform that action at this time.