Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pkutaj's full-sized avatar

pavol kutaj pkutaj

View GitHub Profile
@pkutaj
pkutaj / 2023-07-26-Explaining-DBT-and-Analytics-Engineering-compared-to-Typical-Datamodeling-Practices.md
Created July 26, 2023 08:30
2023-07-26-Explaining-DBT-and-Analytics-Engineering-compared-to-Typical-Datamodeling-Practices.md
Engineering Practice Typical Practice
Modular SQL Monolithic SQL
Data testing No data testing
Version control No version control
Documentation No documentation
Collaboration Limited collaboration
@pkutaj
pkutaj / 2023-07-24-Explaining-CNAME-DNS-Record.md
Created July 24, 2023 12:09
2023-07-24-Explaining-CNAME-DNS-Record.md
Field Value
Alias pavol.kutaj.com
TTL 3600
Class IN
Type CNAME
Target pkutaj.github.io
@pkutaj
pkutaj / 2023-07-21-How-to-Fix-422-Client-Error--Unprocessable-Entity-when-using-json-parameter-of-Request-Python-Module.md
Created July 21, 2023 02:42
2023-07-21-How-to-Fix-422-Client-Error--Unprocessable-Entity-when-using-json-parameter-of-Request-Python-Module.md
Code Explanation
with open("temp_schema.json", mode="rt", encoding="utf-8") as patched_schema: Opens the file in read mode with UTF-8 encoding
schema_to_patch = patched_schema.read() Reads the contents of the file into a string
schema_patcher_http_requestor.make_iglu_request(...) Calls the make_iglu_request function
res = request_func(...) Makes an HTTP request using the requests library
json=schema_to_patch Passes the conte
@pkutaj
pkutaj / 2023-07-20-How-to-Get-Custom-Tags-with-AWS-CLI.md
Created July 20, 2023 08:58
2023-07-20-How-to-Get-Custom-Tags-with-AWS-CLI.md
Command Description
aws ec2 describe-tags Lists custom tags for EC2 resources
aws resourcegroupstaggingapi get-resources Returns all tagged or previously tagged resources
--tag-filters Key=system,Values=foo* Filters output by tag key and value
@pkutaj
pkutaj / 2023-07-20-Explaining-AWS-Security-Groups-on-the-Example-of-Terraform-Drift.md
Created July 20, 2023 07:53
2023-07-20-Explaining-AWS-Security-Groups-on-the-Example-of-Terraform-Drift.md
Change Description
Update The aws_security_group resource named public_sg in the module.redshift.module.cluster module will be updated in-place
Remove Two ingress rules with descriptions "" and "sagemaker access" will be removed from the security group
Add Two new ingress rules with descriptions null will be added to the security group
Change The description field for some of the rules will be changed from an empty string to null
Reorder Some of the rules will be reordered
@pkutaj
pkutaj / 2023-07-17-How-to-Create-Dummy-Context-Manager-for-Python-Unit-Tests.md
Created July 17, 2023 03:55
2023-07-17-How-to-Create-Dummy-Context-Manager-for-Python-Unit-Tests.md
Code Explanation
from contextlib import nullcontext Import the nullcontext context manager from the contextlib module.
monkeypatch.setattr(schema_patcher, "handle_patching", lambda _: nullcontext()) Replace the handle_patching function with a lambda function that returns a nullcontext object.
with push_and_pop_path(MODULE_PATH): schema_patcher.patch_schema(iglu) Call the patch_schema function within a with statement that uses the push_and_pop_path context manager.
@pkutaj
pkutaj / 2023-07-14-Explaining-Current-and-Noncurrent-Versions-in-S3-Lifecycle-Policies.md
Last active July 14, 2023 10:04
2023-07-14-Explaining-Current-and-Noncurrent-Versions-in-S3-Lifecycle-Policies.md
Rule ID Status Noncurrent Version Expiration (days) Transition Storage Class Transition Days Expiration Days
foo1 Disabled 90 N/A N/A N/A
foo2 Enabled 90 STANDARD_IA 30 90
@pkutaj
pkutaj / 2023-07-14-Explaining-Terraform-Drift.md
Created July 14, 2023 07:54
2023-07-14-Explaining-Terraform-Drift.md
Operation Description
Refresh Updates the state file with the current state of the infrastructure
Plan Generates an execution plan that describes the changes that will be made to the infrastructure
Apply Makes changes to the infrastructure based on the execution plan and state file
@pkutaj
pkutaj / 2023-07-14-Explaining-Terraform-Resources.mmd
Created July 14, 2023 07:14
2023-07-14-Explaining-Terraform-Resources.mmd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pkutaj
pkutaj / 2023-07-14-Explaining-Terraform-Resources.md
Created July 14, 2023 07:11
2023-07-14-Explaining-Terraform-Resources.md
graph TD
    subgraph "Terraform Configuration"
        A[Variables] --> B[Resources]
        C[Locals] --> B
        D[Providers] --> B
    end
    B --> E[Infrastructure]