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 zipfile import ZipFile | |
with ZipFile('terraform_0.13.4_linux_amd64.zip') as archive: | |
# archive filename | |
assert archive.filename == 'terraform_0.13.4_linux_amd64.zip' | |
# its consistency | |
assert archive.testzip() == None |
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 zipfile import ZipFile, Path | |
with ZipFile('python-3.9.0-docs-pdf-a4.zip') as archive: | |
# all-at-once way | |
for info in archive.infolist(): | |
assert info.filename.startswith('docs-pdf') | |
# or pathlike way | |
root = Path(archive) | |
assert root.is_dir() |
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 zipfile import ZipFile, Path | |
with ZipFile('python-3.9.0-docs-pdf-a4.zip') as archive: | |
# extract everything | |
archive.extractall() | |
# just one file | |
archive.extract('docs-pdf/faq.pdf', 'docs') | |
# pathlike way |
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 zipfile import ZipFile, Path | |
with ZipFile('archive.zip', 'w') as archive: | |
# include single file | |
archive.write('terraform') | |
# nested file | |
archive.write('docs-pdf/faq.pdf') | |
# or inline content |
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
provider "aws" { | |
region = var.region | |
} | |
variable "region" {} | |
variable "plan_name" {} | |
resource "aws_s3_bucket" "data_bucket" { | |
bucket = "${var.plan_name}-data" | |
acl = "private" |
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
provider "aws" { | |
region = var.region | |
} | |
terraform { | |
backend "s3" {} | |
} | |
variable "region" {} | |
variable "plan_name" {} |
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
PLAN_NAME := booking-system | |
LOCKS_TABLE := terraform-locks | |
REGION_NAME := eu-west-1 | |
BUCKET_NAME := terraform-state-$(shell aws sts get-caller-identity --query Account --output text) | |
init: | |
@terraform init \ | |
-backend-config="region=$(REGION_NAME)" \ | |
-backend-config="bucket=$(BUCKET_NAME)" \ |
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
# create empty solution | |
dotnet new sln -o blocks | |
cd blocks | |
# create projects | |
dotnet new console -o Blocks | |
dotnet new classlib -o Blocks.Core | |
dotnet new nunit -o Blocks.Core.Tests | |
# include in solution |
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
create transient table ecds_db.playground.orders | |
( | |
-- meta | |
_etl_id bigint autoincrement start 1 increment 1, | |
_etl_id_prev bigint, | |
_etl_updated_at timestamp_ntz, | |
_etl_deleted_at timestamp_ntz, | |
-- key | |
id bigint, | |
-- attributes |
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
select count(1) | |
from ecds_db.playground.orders | |
where and _etl_deleted_at is null | |
and _etl_id not in | |
( | |
select _etl_id_prev | |
from ecds_db.playground.orders | |
where _etl_id_prev is not null | |
) |
OlderNewer