SELECT
heap_blks_scanned/cast(heap_blks_total as numeric) * 100 as heap_blks_percent,
progress.*,
activity.query
FROM
This file contains 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
----------------------------------------------------------------------------------------------------------------------------------- | |
-- USEFUL POSTGRESQL MANAGEMENT QUERIES -- | |
-- See https://medium.com/compass-true-north/dealing-with-significant-postgres-database-bloat-what-are-your-options-a6c1814a03a5 -- | |
----------------------------------------------------------------------------------------------------------------------------------- | |
-- SHOW RUNNING QUERIES | |
SELECT | |
state, | |
pid, |
This file contains 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
# -*- coding: utf-8 -*- | |
"""OLD AND UNTESTED""" | |
import unicodedata | |
def fix_bad_unicode(text): | |
u""" | |
Something you will find all over the place, in real-world text, is text | |
that's mistakenly encoded as utf-8, decoded in some ugly format like |
This file contains 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
"""Amazon Marketplace and Region Info. | |
* [MWS docs](https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html) | |
* [Advertising API docs](https://advertising.amazon.com/API/docs/en-us/get-started/how-to-use-api) | |
""" | |
from dataclasses import dataclass | |
@dataclass |
This file contains 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
version: 2.1 | |
jobs: | |
test-cf-audit-report-data: | |
docker: | |
- image: circleci/python:3.7.1 | |
- image: circleci/postgres:11.4-alpine-ram | |
environment: | |
POSTGRES_USER: user | |
POSTGRES_DB: test |
This file contains 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
from sqlalchemy import create_engine, Table, MetaData | |
from sqlalchemy.schema import CreateIndex, CreateTable | |
metadata = MetaData() | |
engine = create_engine('') | |
def create_table_statement(connection, table): | |
stmts = [] |
This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
Part of the undertime app https://gitlab.com/anarcat/undertime by Antoine Beaupré. | |
AGPLv3 licence (https://gitlab.com/anarcat/undertime/blob/master/LICENSE) | |
""" | |
import argparse | |
import os |
This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
NOTE THIS IS UNTESTED AS IT WAS NOT REQUIRED. | |
See: | |
- https://github.com/apache/airflow/blob/master/airflow/contrib/hooks/aws_hook.py | |
- https://github.com/apache/airflow/blob/master/airflow/contrib/operators/ecs_operator.py | |
- https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.ServiceResource.create_instances | |
- https://stackabuse.com/automating-aws-ec2-management-with-python-and-boto3/ |