Skip to content

Instantly share code, notes, and snippets.

View kapilt's full-sized avatar
🌩️
🌩 📦 🔭 📻 🚀 🛰

Kapil Thangavelu kapilt

🌩️
🌩 📦 🔭 📻 🚀 🛰
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kapilt on github.
  • I am kapilt (https://keybase.io/kapilt) on keybase.
  • I have a public key ASC8ksFDb5vcwt3JbTR9L_7coVTMMy2f2iqrv9O6bJ4Orgo

To claim this, I am signing this object:

# Copyright 2018 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@kapilt
kapilt / custodian-policy.yml
Created May 23, 2018 01:00
custodian run policy
policies:
- name: ec2-run
resource: ec2
mode:
type: cloudtrail
events:
- RunInstances
role: arn:aws:iam::xyz:role/CloudCustodianRole
policies:
- name: mark
resource: ec2
filters:
- "tag:Action": absent
actions:
- type: mark-for-op
tag: Action
op: stop
@kapilt
kapilt / pydate.py
Created March 17, 2018 10:34
datetime with pyformat
import re
from datetime import datetime, timedelta
class Date(object):
date_increment = re.compile('\+[0-9]+[md]')
def __init__(self, d=None):
self._d = d
@kapilt
kapilt / salactus.md
Created March 8, 2018 00:35
salactus doc improvements

Use Cases

Sometimes you really want to scan all objects, or in the words of gary oldman from the professional, "bring me EVERYONE" :-) There are a couple of different reasons for that from an org perspective, given current feature sets, most of it involves catching up on s3 security from both an acl and encryption perspective after the fact.

Salactus provides for scale out scanning of every s3 object with configurable object visitors. It also supports s3 inventory as a

@kapilt
kapilt / test
Created January 16, 2018 12:19
test
@kapilt
kapilt / main.py
Created September 4, 2017 11:46
ratelimiter example
import boto3
import time
from botocore.session import Session as CoreSession
from botocore.hooks import HierarchicalEmitter
import traceback
import token_bucket
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-initialize) ;;
(global-font-lock-mode t)
(setq inhibit-startup-mesage t)
(setq make-backup-files nil)
(add-hook 'after-init-hook #'global-flycheck-mode)
@kapilt
kapilt / ppymemleak.py
Last active March 29, 2017 15:55
demonstrate memory leak issue with pypy and s3/boto using threads.
"""Pypy memory leak issue
this needs to process some large buckets to show the continual memory
accumulation. growth after 100 pages processed shows increase from 240mb rss
to 1221 mb rss.
interestingly playing around with chunk size shows dramatic effects on memory
growth rate.
"""