Skip to content

Instantly share code, notes, and snippets.

@ktstevenson
ktstevenson / aws-bill-normalizer.py
Created September 1, 2017 17:30
Normalize a DLT billing file. Removes $0 and summary lines. Exports a TSV file suitable for processing by Athena
import sys
import csv
INPUT_FILE = sys.argv[1]
# Define our canonical field list
fields = ['InvoiceID', 'PayerAccountId', 'LinkedAccountId', 'RecordType',
'RecordId', 'ProductName', 'RateId', 'SubscriptionId', 'PricingPlanId',
'UsageType', 'Operation', 'AvailabilityZone', 'ReservedInstance',
'ItemDescription', 'UsageStartDate', 'UsageEndDate', 'UsageQuantity',
@SKempin
SKempin / Git Subtree basics.md
Last active May 6, 2024 14:55
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this: