This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| import sys | |
| import asyncio | |
| import greenlet | |
| class AsyncIoGreenlet(greenlet.greenlet): | |
| def __init__(self, driver, fn): | |
| greenlet.greenlet.__init__(self, fn, driver) | |
| self.driver = driver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Converts a docx file with tables and images to (simple) HTML | |
| # ORIGINAL CODE BY DAVID SSALI AT SOURCE: https://medium.com/@dvdssali/docx-to-html-1374eb6491a1 | |
| # | |
| # Requires the Python module 'python-docx' <https://python-docx.readthedocs.io> | |
| # | |
| # Example use: | |
| # >>> s = convert('./SOURCEDIR', 'SAMPLE.docx') | |
| # >>> print(s) | |
| # or | |
| # $ python .\convert-docx-to-html.py > temp.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # | |
| # A working example of DynamoDB Stream usage. | |
| # | |
| # Given a DynamoDB table name, this script will go find the first shard in the first stream and | |
| # perform 1 iteration every 10 seconds. Resulting records will be dumped to stdout. | |
| # | |
| import argparse | |
| import time | |
| import boto3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Capped collection of JSON blobs: (Use json for postgres 9.4 and below and jsonb for 9.5 and above) | |
| CREATE SEQUENCE circle_index START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 5 CACHE 1 CYCLE ; | |
| CREATE TABLE circle ( i integer PRIMARY KEY default nextval('circle_index') NOT NULL, tim timestamp DEFAULT current_timestamp NOT NULL, dat jsonb ); | |
| INSERT INTO circle(i, dat) SELECT nextval('circle_index') as idx, '{"a":12345,"b":1}' AS val ON CONFLICT (i) DO UPDATE SET i=EXCLUDED.i, tim=DEFAULT, dat=EXCLUDED.dat; | |
| INSERT INTO circle(i, dat) SELECT nextval('circle_index') as idx, '{"a":12345,"b":2}' AS val ON CONFLICT (i) DO UPDATE SET i=EXCLUDED.i, tim=DEFAULT, dat=EXCLUDED.dat; | |
| INSERT INTO circle(i, dat) SELECT nextval('circle_index') as idx, '{"a":12345,"b":3}' AS val ON CONFLICT (i) DO UPDATE SET i=EXCLUDED.i, tim=DEFAULT, dat=EXCLUDED.dat; | |
| INSERT INTO circle(i, dat) SELECT nextval('circle_index') as idx, '{"a":12345,"b":4}' AS val ON CONFLICT (i) DO UPDATE SET i=EXCLUDED.i, tim=DEFAULT, dat=EXCLUDED.dat; | |
| INSER |