Skip to content

Instantly share code, notes, and snippets.

View pgolding's full-sized avatar
🎯
Focusing

Oberon Dude pgolding

🎯
Focusing
View GitHub Profile
# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
# Find words in the csv list that begin with 'he'
regex = r"\bhe"
test_str = "shoes, footwear, protection, comfort, human, foot, activity, walking, running, high-heel, stiletto, flat, sole, heel, hole, fashion, design, style, cost, sandal, boot, leather, wood, canvas, rubber, plastic, terrain, climate, well-heeled, work, empty, throw, insole, laces, slip, athletic, sneakers, gym, ballet, tap, horseshoe, polish, factory"
@pgolding
pgolding / dynamodb_reserved.txt
Created June 5, 2017 19:41
DynamoDB reserved words
ABORT
ABSOLUTE
ACTION
ADD
AFTER
AGENT
AGGREGATE
ALL
ALLOCATE
ALTER
@pgolding
pgolding / dynamodb_reserved.py
Created June 5, 2017 19:51
dynamodb reserved words python list
reserved_words = ['ABORT', 'ABSOLUTE', 'ACTION', 'ADD', 'AFTER', 'AGENT', 'AGGREGATE', 'ALL', 'ALLOCATE', 'ALTER', 'ANALYZE', 'AND', 'ANY', 'ARCHIVE', 'ARE', 'ARRAY', 'AS', 'ASC', 'ASCII', 'ASENSITIVE', 'ASSERTION', 'ASYMMETRIC', 'AT', 'ATOMIC', 'ATTACH', 'ATTRIBUTE', 'AUTH', 'AUTHORIZATION', 'AUTHORIZE', 'AUTO', 'AVG', 'BACK', 'BACKUP', 'BASE', 'BATCH', 'BEFORE', 'BEGIN', 'BETWEEN', 'BIGINT', 'BINARY', 'BIT', 'BLOB', 'BLOCK', 'BOOLEAN', 'BOTH', 'BREADTH', 'BUCKET', 'BULK', 'BY', 'BYTE', 'CALL', 'CALLED', 'CALLING', 'CAPACITY', 'CASCADE', 'CASCADED', 'CASE', 'CAST', 'CATALOG', 'CHAR', 'CHARACTER', 'CHECK', 'CLASS', 'CLOB', 'CLOSE', 'CLUSTER', 'CLUSTERED', 'CLUSTERING', 'CLUSTERS', 'COALESCE', 'COLLATE', 'COLLATION', 'COLLECTION', 'COLUMN', 'COLUMNS', 'COMBINE', 'COMMENT', 'COMMIT', 'COMPACT', 'COMPILE', 'COMPRESS', 'CONDITION', 'CONFLICT', 'CONNECT', 'CONNECTION', 'CONSISTENCY', 'CONSISTENT', 'CONSTRAINT', 'CONSTRAINTS', 'CONSTRUCTOR', 'CONSUMED', 'CONTINUE', 'CONVERT', 'COPY', 'CORRESPONDING', 'COUNT', 'COUN
@pgolding
pgolding / dynamo_expression_builder.md
Last active August 22, 2017 15:40
DynamoDB Expression builder for update_item method in Boto3 (Python)

The update_item method in Boto3 requires preparing something like this:

try:
    result = table.update_item(
        Key={
            'id': event['pathParameters']['id']
        },
        ExpressionAttributeNames=attr_names,
        ExpressionAttributeValues=expression_vals,
@pgolding
pgolding / remove_adobe_crud.py
Last active February 15, 2018 05:50
Using BeautifulSoup to remove Adobe entity tags (and width/height attributes) from SVG
'''
When rendering SVG files exported from Adobe Illustrator using Phantom JS,
the injected Adobe ENTITY tags can intefere with the render. This removes
the tags and also removes width/height attributes from the SVG tag.
'''
SVG_FILE = 'Some-adobe-illustrator-export.svg'
# By default, BeautifulSoup will ignore the <!ENTITY> array when parsing the file
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.