Skip to content

Instantly share code, notes, and snippets.

View coordt's full-sized avatar

Corey Oordt coordt

  • CH Robinson
  • Farmington, MN
  • 18:18 (UTC -06:00)
View GitHub Profile
@coordt
coordt / resolve_name.py
Created June 20, 2023 20:07
Get a key or attr `name` from obj or default value.
View resolve_name.py
def resolve_name(obj: Any, name: str, default: Any = None) -> Any: # NOQA: C901
"""
Get a key or attr ``name`` from obj or default value.
Copied and modified from Django Template variable resolutions
Resolution methods:
- Mapping key lookup
- Attribute lookup
@coordt
coordt / immutable.py
Created May 8, 2023 18:00
Functions to make things immutable
View immutable.py
"""Functions to make things immutable."""
from collections import OrderedDict
from collections.abc import Hashable
from typing import Any
from immutabledict import immutabledict
from pydantic import BaseModel
def freeze_data(obj: Any) -> Any:
@coordt
coordt / convert_text_clippings.py
Last active May 7, 2023 14:15
Convert .textClippings into .txt files
View convert_text_clippings.py
"""Convert text clippings to .txt files."""
import os
import re
import subprocess
from pathlib import Path
import plistlib
DEREZ_OUTPUT_RE = re.compile(r"\t\$\"([A-F0-9 ]+)\"\s+/\* (.+?) \*/")
@coordt
coordt / autocast.py
Last active May 7, 2023 13:41
Automatically detect the true Python type of a string and cast it
View autocast.py
"""
Automatically detect the true Python type of a string and cast it to the correct type.
Based on https://github.com/cgreer/cgAutoCast/blob/master/cgAutoCast.py
"""
import contextlib
from typing import Any
View helm_values_schema.json
{
"title": "Values",
"description": "Basic contents of a Values file.",
"type": "object",
"properties": {
"defaultComponent": {
"title": "Defaultcomponent",
"description": "The default configurations of a component, if not overridden.",
"allOf": [
{
@coordt
coordt / auto-release.sh
Created September 18, 2022 14:50
Generate a release using generate-changelog and bump version
View auto-release.sh
#!/usr/bin/env bash
# Generate the changelog, make a release if necessary and return the version number
# Pass in the path to the source repo so the appropriate __init__.py file is changed
SOURCE_DIR=$1
# The first 20 characters of the branch name for development releases
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD | cut -c 1-20)
# Generate the changelog and get the release hint
View release-tooling.md

Releasing Software

What is a software release?

A release is the immutable packaging of a software product. Software releases are an essential component of modern software development and the software development life cycle for two main reasons:

  • They are intentional. Someone decided what changes are required to give value and when the changes are ready for others to use.
  • They include context. Information about the difference between the code at two points is conveyed. Whether it is simply by the version indicating the scope or including additional artifacts such as a changelog, the user has more information than "something changed."

The developer plays a key role in a software release because a thoughtful decision is required.

View samldata.json
[
{
"model": "saml2auth.identityprovider",
"pk": 1,
"fields": {
"name": "Peerfit",
"slug": "peerfit",
"metadata_url": "",
"permission_attrs": "{\"is_active\":true,\"is_staff\":true,\"is_superuser\":false}",
"sp_config": "{\"name_id_format\":\"urn:oasis:names:tc:SAML:2.0:nameid-format:persistent\",\"authn_requests_signed\":true,\"want_response_signed\":true,\"force_authn\":true,\"allow_unsolicited\":true,\"want_assertions_signed\":true,\"logout_requests_signed\":true,\"required_attributes\":[],\"optional_attributes\":[]}",
View keybase.md

Keybase proof

I hereby claim:

  • I am coordt on github.
  • I am coordt (https://keybase.io/coordt) on keybase.
  • I have a public key ASA1YiSz2seDjs64Egsf0WEct1C1e7IsnYiKVfgjUf8pMgo

To claim this, I am signing this object:

View testinfrastructure_amzn2.yaml
AWSTemplateFormatVersion: 2010-09-09
Description: Test Server Infrastructure
Parameters:
ParentVPCStack:
Description: 'Stack name of parent VPC stack based on vpc/vpc-*azs.yaml template.'
Type: String
Default: 'TestVPC'
ParentSSHBastionStack:
Description: 'Optional but recommended stack name of parent SSH bastion host/instance stack based on vpc/vpc-ssh-bastion.yaml template.'
Type: String