Skip to content

Instantly share code, notes, and snippets.

View 1davidmichael's full-sized avatar

David Michael 1davidmichael

View GitHub Profile
@1davidmichael
1davidmichael / .gitconfig
Last active June 20, 2023 14:23
Bash script to get MFA authenticated AWS credentials
[credential]
helper = !aws codecommit credential-helper $@
UseHttpPath = true
@1davidmichael
1davidmichael / Iowa-2023-education-committees.md
Last active January 18, 2023 22:12
Iowa Education Info 2023 Session
@1davidmichael
1davidmichael / example.ts
Created October 27, 2021 19:00
Convert CDK VPC subnet list into CFN subnet list type
var subnetIds:String[] = [];
vpc.privateSubnets.forEach((value: ISubnet)=>{
subnetIds.push(value.subnetId)
});
const template = new cfninc.CfnInclude(this, "Template", {
templateFile: 'template.yaml',
parameters: {
"ClusterName": cluster.clusterName,
"Subnets": cdk.Fn.split(",", subnetIds.join(",")),
@1davidmichael
1davidmichael / README.md
Created August 20, 2021 13:45
Pre-commit vscode snippets

Pre-commit vscode snippets

Add these snippets to vscode yaml snippets to quickly add preconfigured snippets for .pre-commit-config.yaml pre-commit config.

@1davidmichael
1davidmichael / convert_csv_to_rewrite_map.py
Last active January 8, 2020 15:28
Convert CSV into Apache Rewrite Map txt file
#!/usr/bin/env python3
# Usage
'''
python convert_csv_to_rewrite_map.py file.csv > rewrite_map.txt
'''
import csv
import sys
from urllib.parse import urlparse
@1davidmichael
1davidmichael / describe_instances.py
Created May 20, 2019 18:40 — forked from jeffbrl/describe_instances.py
How to make datetime.datetime json serializable - boto3 ec2 describe_instances
# Adapted from https://stackoverflow.com/questions/35869985/datetime-datetime-is-not-json-serializable
import datetime
import json
import boto3
def datetime_handler(x):
if isinstance(x, datetime.datetime):
return x.isoformat()
@1davidmichael
1davidmichael / create_db.py
Created January 8, 2019 18:27
Example Lambda Custom Resource to create a MySQL database on RDS
import json
import MySQLdb
import os
import requests
def handler(event, context):
if event['RequestType'] == 'Create' or event['RequestType'] == 'Update':
parameters = event['ResourceProperties']
create_db(
@1davidmichael
1davidmichael / .vimrc
Last active August 14, 2019 17:29
Vim Configuration
if !has('nvim')
" Auto install vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
endif
if has('nvim')
@1davidmichael
1davidmichael / slack_track.py
Created March 20, 2018 20:19
Find recent Slack logins for a particular user
from slackclient import SlackClient
user = "username goes here"
slack_token = os.environ["SLACK_API_TOKEN"]
sc = SlackClient(slack_token)
response = sc.api_call(
"team.accessLogs",
count=1000
)
### Keybase proof
I hereby claim:
* I am 1davidmichael on github.
* I am davidmichael (https://keybase.io/davidmichael) on keybase.
* I have a public key ASAIQ3L1qZ2pxi5lrGong4IYEwTRNMdPGfYtyOY-WIFg0wo
To claim this, I am signing this object: