Skip to content

Instantly share code, notes, and snippets.

cat /var/log/logstash/logstash-plain.log | grep -o "^\[.*\]\[DEBUG\]\[logstash.outputs.amazones\]" | awk '{ gsub(/\[DEBUG\].*/, ""); print }' | sed 's/[][]//g' | sed 's/,.*//g' | python timediff.py
import cfnresponse
import boto3
CLIENT = boto3.client('efs')
def execute(client, file_system_id, action, security_group_ids):
if client is None or not client:
raise TypeError('client must be present')
if not isinstance(file_system_id, basestring):
@mikechau
mikechau / ecs-run
Created October 29, 2017 08:19 — forked from vcastellm/ecs-run
Run task and wait for result in AWS ECS
#!/usr/bin/env bash
set -e
function usage() {
set -e
cat <<EOM
##### ecs-run #####
Simple script for running tasks on Amazon Elastic Container Service
One of the following is required:
Required arguments:
@mikechau
mikechau / circle-lock.sh
Created August 21, 2017 09:07 — forked from acmcelwee/circle-lock.sh
Workflows-friendly adaptation of CircleCI's build locking https://github.com/bellkev/circle-lock-test
#!/usr/bin/env bash
set -o xtrace -o errexit -o pipefail -o nounset
########################################################################################
# CircleCI's current recommendation for roughly serializing a subset
# of build commands for a given branch
#
# circle discussion thread - https://discuss.circleci.com/t/serializing-deployments/153
# Code from - https://github.com/bellkev/circle-lock-test
# Terminal 1
sshuttle -r $BASTION_NAME 172.31.0.0/16

# Terminal 2
ssh -L3306:$RDS_HOST_NAME:3306 ec2-user@$INSTANCE_IP -i $PEM 

# Terminal 3
mysql -h 127.0.0.1 -u $SQL_USER -p $DATABASE -P 3306
@mikechau
mikechau / react-scripts.md
Last active August 3, 2023 16:36
Forking react-scripts

Forking React Scripts

Problem

You're using create-react-app but you need to do some customizations to the webpack configs while you wait for the CRA team to implement/have a solution for whatever it is you need.

BUT - you do not want to eject as you want to keep up to date with any changes in CRA and possibly eventually move away from your customizationed webpack config and go back to using the mainline.

Solution

@mikechau
mikechau / fedora-x230-fhd.md
Last active May 23, 2020 14:43
fedora-x230-fhd.md
@mikechau
mikechau / example.js
Created June 23, 2017 00:05
aws-elb-cloudformation-reference-policy
// https://forums.aws.amazon.com/thread.jspa?threadID=169448
{
"Listeners": [
// ...
{
"InstancePort": 8080,
"InstanceProtocol": "http",
"LoadBalancerPort": 443,
"Protocol": "HTTPS",
"PolicyNames": [
[docker]
project = warehouse
app_dir = /%(project)
chdir = %(app_dir)
wsgi-file = django-config/wsgi.py
static-map = /static=/%(project)/static
enable-threads = true
single-interpreter = true
// scripts/reconfig.js
//
// Description:
// Pass in a key as an argument with a value and it will merge the change
// into the package.json.
//
// Usage:
// ./reconfig.js --$KEY_1_NAME $KEY_1_VALUE --$KEY_2_NAME --$KEY_2_VALUE
// ./reconfig.js --homepage http://custom-homepage.com
//