This file contains hidden or 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
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. |
This file contains hidden or 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
#!/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" | |
} |
This file contains hidden or 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
#!/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 |
This file contains hidden or 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
#!/usr/bin/env bash | |
# From: https://it.digitaino.com/use-touchid-to-authenticate-sudo-on-macos/ | |
# Check if it's already done | |
if grep 'auth[[:space:]]*sufficient[[:space:]]*pam_tid.so' /etc/pam.d/sudo; then | |
echo "Already done" | |
else | |
# One-liner to do it | |
sudo sed -i.backup 's/\(auth[[:space:]]*sufficient[[:space:]]*pam_smartcard.so\)/\1\nauth sufficient pam_tid.so/' /etc/pam.d/sudo | |
fi |
This file contains hidden or 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
""" | |
Automatically define singleton resource groups | |
The structure of the python pulumi library is such that many properties | |
of resources are not easily modifyable after initialization. | |
This module functions by delaying the creation of resource attributes | |
within the ResourceGroup class until the class has been fully instantiated. | |
""" | |
from typing import Any, ClassVar, Iterable, TypeVar, Generic |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
<html> | |
<head><meta charset="utf-8" /></head> | |
<body> | |
<div> <script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script> | |
<script type="text/javascript">/** | |
* plotly.js v2.20.0 | |
* Copyright 2012-2023, Plotly, Inc. | |
* All rights reserved. | |
* Licensed under the MIT license | |
*/ |
This file contains hidden or 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
{ pkgs, ... } : | |
{ | |
environment.systemPackages = [ | |
pkgs.jq # Query json output from the CLI | |
pkgs.tree # Prettier directory output listings | |
pkgs.rename # Mass-rename files | |
pkgs.k8s # K9s is a super useful CLI utility for interacting with kubernetes | |
pkgs.gh # The github command-line tool | |
pkgs.unixtools.watch # The 'watch' command | |
]; |
This file contains hidden or 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
#!/usr/bin/env nix-shell | |
#! nix-shell -i bash -p qrencode | |
usage() { | |
echo "Usage: $0 <SSID> <PASSWORD> [-e ENCODING] [-o OUTPUT] -- Passthrough to qrencode" | |
echo "ENCODING defaults to WPA, but can also be WEP" | |
echo "OUTPUT defaults to <SSID>.png" | |
} | |
ssid="" |
This file contains hidden or 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
def log_exception(msg: str, e: Exception) -> None: | |
"""Log detailed exception info. | |
Only the exception stack logs to logging.critical | |
Local variales are also appended to logging.debug | |
:param msg: A message to prefix the exception output | |
:param e: An exception object to inspect for local variables | |
""" |
This file contains hidden or 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
#!/bin/bash -e | |
usage() { | |
echo "Move to trash directory without deleting" | |
echo "Usage: $(basename $0) [-v] thing-to-trash1 [thing-to-trash2 ...]" | |
} | |
VERBOSE=0 | |
POSITIONAL="" | |
while (( "$#" )); do # While there are arguments left |
NewerOlder