Skip to content

Instantly share code, notes, and snippets.

@isaac-ped
isaac-ped / .envrc
Created June 27, 2023 18:43
Minimal nix setup
#!/usr/bin/env bash
## This is copied directly from `lorri init`
# the shebang is ignored, but nice for editors
if type -P lorri &>/dev/null; then
eval "$(lorri direnv)"
else
echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]'
use nix
@isaac-ped
isaac-ped / git-trash
Created August 7, 2023 00:16
git-trash
#!/usr/bin/env bash
REALPATH="$(nix-shell -p coreutils -p which --pure --run 'which realpath')"
#echo $REALPATH
usage() {
echo "Usage: $0 files..."
echo "Move files into a datestamped .trash/ directory at the root of the git repo"
}
@isaac-ped
isaac-ped / snapshot_query_definition.py
Last active April 15, 2025 18:14
scheduled snapshot query creation
def _snapshot_query(
snapshot_dataset: str,
source_dataset: str,
source_table: str,
retention_days: int | None,
) -> str:
"""Contsruct the query for snapshotting a table.
Taken from: https://cloud.google.com/bigquery/docs/table-snapshots-scheduled#schedule_the_monthly_query
See the docstring for _create_scheduled_snapshot for details on parameters.