Skip to content

Instantly share code, notes, and snippets.

View henrysher's full-sized avatar
💭
I may be slow to respond.

Henry Huang henrysher

💭
I may be slow to respond.
View GitHub Profile
@henrysher
henrysher / list.txt
Created March 31, 2020 01:09 — forked from shortjared/list.txt
List of AWS Service Principals
acm.amazonaws.com
alexa-appkit.amazon.com
apigateway.amazonaws.com
application-autoscaling.amazonaws.com
appstream.application-autoscaling.amazonaws.com
appsync.amazonaws.com
athena.amazonaws.com
autoscaling.amazonaws.com
batch.amazonaws.com
channels.lex.amazonaws.com
[Solarized Dark]
text(bold)=839496
magenta(bold)=6c71c4
text=839496
white(bold)=fdf6e3
green=859900
red(bold)=cb4b16
green(bold)=586e75
black(bold)=073642
red=dc322f
from __future__ import print_function
import glob
import os
import re
old_method_syntax = re.compile('[A-Z][\w\d_]+\.[\w\d_]+\(self')
cwd = os.getcwd()
files = glob.glob(os.path.join(cwd, '*.py'))
# A Github Webhook endpoint that triggers Koji builds
#
# Add a Webhook to your repo and point it to where you run this.
#
# It builds packages when you add #kojibuild to the commit message.
# If you add #scratch it will scratch build
#
# It assumes that you have a folder per package + version folder like:
# jetty/8.1.9/jetty-8.1.9.spec
#
"""
This file contains code that, when run on Python 2.7.5 or earlier, creates
a string that should not exist: u'\Udeadbeef'. That's a single "character"
that's illegal in Python because it's outside the valid Unicode range.
It then uses it to crash various things in the Python standard library and
corrupt a database.
On Python 3... well, this file is full of syntax errors on Python 3. But
if you were to change the print statements and byte literals and stuff:
@henrysher
henrysher / retry.py
Created October 15, 2013 06:33 — forked from anonymous/retry.py
# Patches on Boto Retry Strategy
"""
Handles the check whether it need to retry or not
"""
from __future__ import with_statement
import json
import boto
from xml.dom.minidom import parseString
# coding: utf-8
from __future__ import division
import re
import os
import time
import bottle
from xml.dom.minidom import parseString
from math import *
helpstr = '''\
import time
class Retry(object):
default_exceptions = (Exception)
def __init__(self, tries, exceptions=None, delay=0):
"""
Decorator for retrying function if exception occurs
tries -- num tries
exceptions -- exceptions to catch
== Rules ==
On Infrastructure
-----------------
There is one system, not a collection of systems.
The desired state of the system should be a known quantity.
The "known quantity" must be machine parseable.
The actual state of the system must self-correct to the desired state.
The only authoritative source for the actual state of the system is the system.
The entire system must be deployable using source media and text files.
== Rules ==
On Infrastructure
-----------------
There is one system, not a collection of systems.
The desired state of the system should be a known quantity.
The "known quantity" must be machine parseable.
The actual state of the system must self-correct to the desired state.
The only authoritative source for the actual state of the system is the system.
The entire system must be deployable using source media and text files.