Skip to content

Instantly share code, notes, and snippets.

View JeffreyMFarley's full-sized avatar

Jeff Farley JeffreyMFarley

View GitHub Profile

Prerequistites

yq

.zshrc

export YQFMT_DEFENV="{\"defaults\": .defaults | sort_by(.key), \"mapping\": .mapping | sort_keys(.), \"services\": .services | sort_keys(.)}"
export YQFMT_ENV="{\"envs\": .envs | sort_by(.key), \"mapping\": .mapping | sort_keys(.), \"services\": .services | sort_keys(.)}"

Why does Django not show my logs?

This is a common practice

import logging

logger = logging.getLogger(__name__)

logger.info(f'Titan Proxy: {API_URL}')
import io
INPUT = 'input1.txt'
# ------------------------------------------------------
# Classes
class Panel:
def __init__(self, inputs, outputs):
self.panel = [''] * 10

Terraform

terraform apply
terraform apply -refresh-only
terraform apply -target:module.db

terraform destroy
terraform destroy -target=module.db
BULLET = 0xB7
def buildPunctuationReplace():
table = {0xa0: ' ', # non-breaking space
0xa6: '|',
0xb4: '\'',
0xb6: '*',
0xd7: 'x',
0x2022: BULLET, # bullet

10.0.0.0/24 (256 hosts)

/25 (128 hosts)

  1. 10.0.0.0
  2. 10.0.0.128

/26 (64 hosts)

  1. 10.0.0.0
  2. 10.0.0.64
  3. 10.0.0.128
From: https://docs.google.com/document/d/1c1S9FqZ-cSvf33gXd_QN9JTFlHMo3yb8zDMMnoyLszw/edit
This is an openly-compiled list of names that anyone (e.g. not just a programmer) should be able to enter into their system and confirm they don’t throw errors (either at input or downstream).
This was inspired by Patrick McKenzie’s Falsehoods Programmers Believe About Names (+ examples of each)
This list is being compiled for a New America project on unemployment benefits but seems widely applicable! Please add names representative of variants you see missing.
## The List
First name “Kathy” but legal name “Kathryn”
Phan Thị Kim Phúc [given name Kim Phúc]
Adam Carolla (no middle name)

Door Signs

When we moved to Frederick, MD, I noticed that my office had two closet doors directly behind my desk. I thought it would be a fun exercise to come up with "choices" for the doors each week.

The Signs

  1. Us / Them
  2. This / That
  3. My Way / Highway
import csv
import io
from collections import Counter, defaultdict
from datetime import datetime
import configargparse
def guess_type(x):
if x.lower() in ['true', 'false', 'yes', 'on', 'no', 'off']: