Skip to content

Instantly share code, notes, and snippets.

@bryan-lott
bryan-lott / cloudwatch_export_all_logs_to_s3.py
Created July 28, 2020 21:04
Export all logs to s3 from cloudwatch over a date range
# requires https://pypi.org/project/retry for the create export
import boto3
from retry.api import retry_call
from_time: int = 0 # start time
to_time: int = 0 # end time
destination: str = '' # destination s3 bucket
destination_prefix: str = 'CloudWatchLogs' # key prefix inside the bucket
cw = boto3.client('logs')
@bryan-lott
bryan-lott / ecs_find_by_ip.py
Last active July 22, 2020 00:52
Search all of AWS ECS for Private IP Address
ip_address = '123.456.789.012'
import boto3
from pprint import pprint
ecs = boto3.client('ecs')
for cluster in ecs.list_clusters()['clusterArns']:
arns = ecs.list_tasks(cluster=cluster)['taskArns']
if arns:
for t in ecs.describe_tasks(cluster=cluster, tasks=arns)['tasks']:
for c in t['containers']:

Keybase proof

I hereby claim:

  • I am bryan-lott on github.
  • I am bryanlott (https://keybase.io/bryanlott) on keybase.
  • I have a public key whose fingerprint is 49F8 B969 D780 8AAF 9D4D 56EF 5F23 2B86 00FE 4BB5

To claim this, I am signing this object:

@bryan-lott
bryan-lott / move.py
Created July 13, 2018 15:42
Move files from one folder to another
import shutil
import os
src = 'source'
dst = 'destination'
for f in os.listdir(src):
shutil.move(os.path.join(src, f), dst)
@bryan-lott
bryan-lott / dict_map_bools_to_strings.py
Created February 28, 2018 21:41
python dict mapping bools to strings
bool_val = True
result = {True: 'IS', False: 'IS NOT'}[bool_val]
print("Mapping {} awesome".format(result))
DavidAnson.vscode-markdownlint-0.7.2
lei.theme-chromodynamics-1.0.8
HookyQR.beautify-1.0.2
lukehoban.go-0.6.61
PeterJausovec.vscode-docker-0.0.14
mohsen1.prettify-json-0.0.3
RoscoP.ActiveFileInStatusBar-1.0.2
ms-vscode.sublime-keybindings-2.0.1
Stephanvs.dot-0.0.1
mushan.vscode-open-iterm2-0.0.2
Parinfer
go-outline
multi-cursor
go-plus
nord-atom-syntax
Sublime-Style-Column-Selection
go-signature-statusbar
nord-atom-ui
ariake-dark-syntax
highlight-line
@bryan-lott
bryan-lott / user.behaviors
Last active August 27, 2016 14:16
Lighttable user.behaviors file
;; User behaviors
;; -----------------------------
;; Modify this file to add and subtract behaviors. Behaviors allow customization of
;; almost any aspect of LightTable e.g. show line numbers or current theme.
;; A behavior has the following format:
;;
;; [:TAG :BEHAVIOR OPTIONAL_ARGUMENTS]
;;
;; * A tag indicates in what context the behavior applies. Common tags are :app and :editor which respectively
;; indicate the behavior can be used anywhere and the behavior only applies to editors.
@bryan-lott
bryan-lott / user.keymap
Last active August 27, 2016 14:16
Lighttable user.keymap file
;; User keymap
;; -----------------------------
;; Modify this file to add and subtract keybindings (keyboard shortcuts).
;; Keybindings allow custom keys to invoke any desired LightTable functionality that is behind a command.
;; A keybinding has the following format:
;;
;; [:TAG "KEYS" :COMMAND]
;;
;; * A tag indicates in what context the keybinding applies. Common tags are :app and :editor which respectively
;; indicate the keybinding can be used anywhere and the keybinding can only be used when editing text.
@bryan-lott
bryan-lott / Default (Windows).sublime-keymap
Last active June 21, 2016 15:01
Sublime Text Settings
[
{ "keys": ["ctrl+,"], "command": "jump_back" },
{ "keys": ["ctrl+."], "command": "jump_forward" },
{ "keys": ["ctrl+o"], "command": "fuzzy_start_from_file" },
{ "keys": ["ctrl+shift+o"], "command": "fuzzy_bookmarks_load" },
{ "keys": ["f5"], "command": "revert_file"}
]