Skip to content

Instantly share code, notes, and snippets.

@dlamblin
dlamblin / scale_drawing.html
Last active July 8, 2025 15:59
Having made a floor plan of my interior and scaled it to 1/70th of the size, I found it hard to cut model furniture to scale. This helps to print squares to scale. 1:87.1 would have been HO scale, 1:72 aircraft model scale, 1:64 matchbox cars, 1:60 games workshop etc. https://en.wikipedia.org/wiki/List_of_scale_model_sizes
<html><head><link rel="canonical"
href="https://gistpreview.github.io/?a64325011f0147a56dbc5316b6ec17c2"
/><style>
html , body { height: 100%; width 100%; margin: 0; display: flow-root; }
div { margin: 1em; border: 1pt solid black; float: left; display: block;
font: 8pt/calc(12in/70) sans-serif; text-align: center; padding: 0; }
.ruler { background-image:
repeating-linear-gradient(#ccc 0 0.5pt, transparent 0.5pt 100%),
repeating-linear-gradient(90deg, #ccc 0 0.5pt, transparent 0.5pt 100%);
@dlamblin
dlamblin / hcl2json.py
Last active July 2, 2025 21:54
Limited Terraform HCL .tf conversion to JSON .json output.
#!/usr/bin/env python
from argparse import ArgumentParser
from fileinput import input
from itertools import groupby
from json import dumps
from typing import Generator
"""
The intent of this script is to convert the many versions.tf files found
with `find . -name versions.tf` (finds 124 files in my repo) into json, so
@dlamblin
dlamblin / keybase.md
Created January 13, 2025 16:58
keybase.md

Keybase proof

I hereby claim:

  • I am dlamblin on github.
  • I am lamblin (https://keybase.io/lamblin) on keybase.
  • I have a public key ASBAVHV42mQM8gQI_cDjr5CrDH6F8c5nkiEHQRKwFivIjgo

To claim this, I am signing this object:

@dlamblin
dlamblin / _ Sophie's Python practice _.md
Last active February 13, 2024 23:08
Sophie's Python practice games

Sophie's Python practice games

In order to practice Python, Sophie worked on some Python that implements a game.

Deck shuffle

The first practice was to figure out how to take an ordered list of cards and shuffle that list like a deck of cards. After quickly figuring out a way to shuffle cards and then display the mixed up deck, she worked on making a guessing game out of it.

@dlamblin
dlamblin / Results-2023-09-11.tsv
Created September 11, 2023 22:56
Tabs vs Spaces, Entab, Detab
refmt mentions EG
detab 468 Fixed crash when detabbing with zero spaces per tab.
entab 88 Add C functions to centralize entab processing
reindent 6311 lang_css: reindented parser_css.mly
@dlamblin
dlamblin / fmtyaml.py
Created March 24, 2023 02:05
Format YAML by key name order with fmtyaml.py
#!/usr/bin/env python3
# vim: et sw=4 ai
"""
This script takes in files named in presumed yaml format and OVERWRITES them
with all their keys sorted by the key name. It does not preserve comments. I've
not tested it with lists.
Using '-' as a filename opens and consumes stdin in addition to other files.
stdin is written to stdout with the same processing.
@dlamblin
dlamblin / mute.py
Created August 21, 2020 13:02
Python muting stdout or stderr
"""
This module contains four methods for muting file descriptors.
You can mute the standard file descriptors:
with mute_stdout():
...
with mute_stderr():
...
with mute_stdout_stderr():
...
Or mute a list of known file descriptors:
@dlamblin
dlamblin / openapi_1_10_0.yaml
Last active April 4, 2020 11:09
OpenAPI schemas for The Airflow API, which has been experimental and without a clear schema
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@dlamblin
dlamblin / openapi_1_10_0.yaml
Created April 4, 2020 11:04
OpenAPI schemas for The Airflow API, which has been experimental and without a clear schema
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@dlamblin
dlamblin / ngram.py
Last active May 14, 2024 15:12
Python N-Gram for characters in string
"""
n-gram of a string by characters (not by words)
takes all args as input unless the first two args are numbers which are in
order, then it assume these are min and max length. Default min max is 2 - 60
"""
def ngram(inp='', mn=2, mx=60):
"""