Skip to content

Instantly share code, notes, and snippets.

View mneil's full-sized avatar

Michael Neil mneil

  • Pacific Northwest
View GitHub Profile
@mneil
mneil / Upstart Twistd Server
Last active May 8, 2017 20:30
Upstart Twistd Server
# UPSTART SCRIPT
# /etc/init/{taskname}.conf
# This task is run on startup to run miniweb which is a tiny static server
description "Run the miniweb web form"
start on (filesystem and net-device-up IFACE!=lo)
task
exec sudo twistd -no web --path /path/to/web/dir --port="tcp:8000"
@mneil
mneil / setup-mutato.sh
Created April 2, 2020 22:34
Mutato Environment Setup
#!/bin/bash
cd /path/to/your/github/repo
echo "GITHUB_TOKEN=$GITHUB_TOKEN" > mutato.env
aws-vault exec <profile name> -- env | grep AWS_ >> mutato.env
docker run -it --rm --env-file mutato.env -v `pwd`:/project stelligent/mutato bootstrap
docker run -it --rm --env-file mutato.env -v `pwd`:/project stelligent/mutato deploy
@mneil
mneil / __init__.py
Last active February 3, 2023 16:06
AWS Lambda Python Log Factory w/ Filter Secrets
'''
Place this file in your lambda package next to the handler file.
Setting the log formatter on lambda loses the request id out of the context.
But, you often want to use a logger across a few files and name them
or change the log format.
This factory will ensure that the lambda context id is available to any
log format you choose. It also has the ability to filter out strings
from the logs using a regular expression.
@mneil
mneil / conftest.py
Created November 24, 2020 21:28
Patch boto3 to avoid credentials errors and real API calls during unit tests.
'''
Unit test setup automatically called
'''
from unittest import mock
import pytest
# Fixture, autouse
@pytest.fixture(scope='session', autouse=True)
def patch_boto3(request):
@mneil
mneil / Dockerfile
Created April 19, 2019 17:32
MCUXpress Docker Build
FROM ubuntu:16.04
LABEL Description="Image for buiding arm project with mcuxpresso"
WORKDIR /work
ENV SDK_VERSION 2.5.0
ENV IDE_VERSION 10.3.0_2200
COPY ./mcuxpressoide-${IDE_VERSION}.x86_64.deb.bin /work
COPY ./SDK_${SDK_VERSION}_LPC54018-IoT-Module.zip /work