Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Maik Glatki mgla

🎯
Focusing
View GitHub Profile
View bb
0eNrVfdtuXUmO5a809JwaxP2S6B+Yl5mneWoUErJ8Mn1QsqTRJbsTBf/7HElOe0s668Qil93AvFTZSmuRwQgyyCA3+a+zD1ePu9u7/fXDbx9ubv559uu/vv/k/uzX/9j89em/7S9vrl9+fL//4/ri6ulnD3/d7s5+Pds/7D6f/XJ2ffH56W+7q93lw93+8vz3x7vri8vd2ZdfzvbXH3f/dfZr/PLLkV//c3/38Hj4yTeEl39xfvlpd/nPzW+nL//45Wx3/bB/2O9eOHn+y1+/XT9+/rC7O8B/Q/j94v7h/OHu4vr+9ubu4fzD7urhAH97c3/43ZvrJ9oHvPNY2v+ov5z9dfhjioc/Hkh93N8duH/+N+mJ2TcUkplCNVLIZgrFSKGYKeQTFMoRCtVMIRjX0MwUopFCt1LI00hhmCkMI4VpptCNOx2DmYRVIaJZq7NVI6JZrXO2kjDrdU5WEmbFztG63WbNTlatiGbVTla1iGbdTt1KwqzcyXoVRbN2p2rc7mTW7mTVi2TW7mTVi2TW7mS9LJJZu5P1xktm7Y7Tut1m7Y5WvUhNcaAOf/xyDPS7Pu+v73d3D4cfLpAKJY/vSvx593H/+Pn8m2t7e3O1WzljBXA7Ff+rUj5k4ASSjALJdgc7WVlPimcHDkjO5o3c+lpgI3OhpLz1CzkpV8X1RCJoHLPNymxXfEzuSNgd5WYlMRU3Foi8BPupS8tTVyK3kdm4kUXygZEIMsdssDIrubrUkSh2LQxWEk3xppHIu/nUpbY+dYPayK2fzG3kVFxxIILKXX+pGJmtdl+1GI9ETYpTz5HIilOPRF7spy4sT12t3EZG60Y2JSJAIuC80DiszA7F8eeOhFkLt6ugSLSgxBZA5C3iR+dFAJCemX56uL5/+u+3dzcfHw/s/3mAP/98+PPhzB7WcYxmstFMP4JmNtHcuoN+msVGs/0ImtVGM/8Ims1GM/wImt1Ec3vl+WkOG83yI2hOG834A2j2YKK5NWR+mtH8ABEY09+T9AARjlv
@mgla
mgla / gist:d9acd5dbb012797e8fc27ee1053d2e78
Created Aug 20, 2019
Compile a list of missing CloudFront Domains from trusted advisor
View gist:d9acd5dbb012797e8fc27ee1053d2e78
aws support --region us-east-1 describe-trusted-advisor-check-result --check-id N420c450f2 | jq '.result.flaggedResources[].metadata | .[3] + " CNAME " + .[3] '
View tag_all_loggroups.py
#!/usr/bin/env python3
import os
import boto3
import botocore
def paginate(method, **kwargs):
""" Generic boto paginator class """
client = method.__self__
paginator = client.get_paginator(method.__name__)
for page in paginator.paginate(**kwargs).result_key_iters():
View api-gw-lambda-minimal.py
# minimal example for lambda debugging with API GW
from pprint import pformat
def lambda_handler(event, context):
return {
'statusCode': '200',
'body': pformat(event),
'headers': {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*'
View aws-glue-delete-dev-endpoints.py
from pprint import pprint
import boto3
def lambda_handler(event, context):
client = boto3.client('glue')
for endpoint in (client.get_dev_endpoints()['DevEndpoints']):
pprint(client.delete_dev_endpoint(
EndpointName= endpoint["EndpointName"]
))
return "Dev endpoints deleted"
@mgla
mgla / aws-boto-session.py
Last active Jun 7, 2018
AWS boto don't ask for token every time
View aws-boto-session.py
#!/usr/bin/env python3
# Don't ask for MFA token every time
from botocore import credentials
import botocore.session
import boto3
import os
# Boto3 MFA session magic
working_dir = os.path.join(os.path.expanduser('~'),'.aws/cli/cache')
View athena_queries.md

Random useful Athena queries

CloudTrail

Find out who modified a IAM user policy

SELECT eventname,
         useridentity.arn,
         sourceIPAddress,
         eventtime,
View keybase.md

Keybase proof

I hereby claim:

  • I am mgla on github.
  • I am mgla (https://keybase.io/mgla) on keybase.
  • I have a public key ASD9aSmbO-OX8Nm0nxdb5FQoVuNMKDtLSwyxjrESrjRLMwo

To claim this, I am signing this object:

View Apache2.2: X-Forwarded-For Deny
#
<Directory />
#Example..
SetEnvIF X-Forwarded-For "(,| |^)192\.168\.1\.1(,| |$)" DenyIP
SetEnvIF X-Forwarded-For "(,| |^)10\.1\.1\.1(,| |$)" DenyIP
Order allow,deny
Deny from env=DenyIP
Allow from all
</Directory>
View varnish.patch
--- /etc/init.d/varnish 2017-02-09 13:25:38.000000000 +0000
+++ /etc/init.d/varnish.new 2017-03-29 09:49:56.898745740 +0000
@@ -137,12 +137,6 @@
status_varnishd
;;
restart|force-reload)
- if status_of_proc -p "${PIDFILE}" "${DAEMON}" "${SERVICE}" 1>/dev/null; then
- if ! configtest; then
- log_failure_msg "Syntax check failed, not restarting"
- exit 1
You can’t perform that action at this time.