Skip to content

Instantly share code, notes, and snippets.

jtatum /
Created April 4, 2013 16:41
Setup logging so that it works with utf-8 log files and ensure stdout is outputting in utf-8
import logging
# Change the default encoding of stdout to utf-8.
# This is effective if the output is piped or redirected.
import sys
# Add a file handler with utf-8 encoding
handler = logging.FileHandler('output.log', 'w',
jtatum /
Last active June 11, 2022 12:10
Running Sendy on AWS ECS + Fargate

Sendy on ECS + Fargate

It's possible to run Sendy on ECS + Fargate. My infrastructure is as follows:

  • EFS
  • ALB
  • ACM certificate
  • ECS Service
  • ALB target group
<?php phpinfo();
jtatum /
Last active May 21, 2019 19:59
Use ATOMac to click various items in the menubar menu for Skype
import atomac
cloud_menu = a.AXChildren[2].AXChildren[0]
print cloud_menu
# Some apps are coded so menu items aren't populated until they're displayed
except atomac.ErrorCannotComplete:
# An accessibility bug you'll see sometimes - the app never reports
jtatum /
Last active March 28, 2018 01:44
Get config from AWS SSM parameters. Import this file in your lambda and access parameters like config.SOME_PARAM
import boto3
def _get_secrets(path: str):
client = boto3.client('ssm')
secrets = {}
kwargs = {}
while True:
result = client.get_parameters_by_path(
function () {
var js = document.createElement('script');
js.setAttribute('type', 'text/javascript');
js.setAttribute('id', 'frozenCookieScript');
js.setAttribute('src', '');
# Why not to just put all your code under if __name__ == '__main__':
# (AKA why you should use a main(argv) function)
import sys
def my_func(param):
print param
# You'd think this would fail, but it works, because new_param is in the
# parent level scope. It will fail if you import this file and call
Feature: Issue #TBD: Logging starts with a StreamHandler way too early
Given a file named "features/steps/" with:
import logging
from behave import given, when, then, step
jtatum /
Last active December 14, 2015 06:19
Shell script to start automation in a local terminal window
# Note - you can't run this script in the local terminal.
# Run it via SSH or cron or something else.
COMMANDS="your automation script here"
killall python 2>/dev/null
killall Terminal 2>/dev/null
jtatum /
Created February 12, 2013 19:32
Send a global key in ATOMac
import atomac
from atomac.AXKeyCodeConstants import *
# the COMMAND constant here comes from AXKeyCodeConstants
app.sendGlobalKeyWithModifiers('n', [COMMAND])