Skip to content

Instantly share code, notes, and snippets.

View coordt's full-sized avatar

Corey Oordt coordt

View GitHub Profile
@coordt
coordt / .pre-commit-config.yaml
Last active December 6, 2023 15:34
pre-commit configuration
ci:
autofix_prs: false
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.6'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
exclude: test.*
- repo: https://github.com/psf/black
@coordt
coordt / resolve_name.py
Created June 20, 2023 20:07
Get a key or attr `name` from obj or default value.
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
"""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
"""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
"""
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
{
"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
#!/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

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.

[
{
"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\":[]}",

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: