Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / quick_and_dirty_parsing_json_to_objects_in_python.md
Last active December 4, 2025 16:38
Work with JSON in dot notation when using Python

Python repl can autocomplete object attributes/members/fields

But the default JSON parsing gives you a dict not an object

So you may have been frustrated when the Python repl and your IDEs should have autocompletion, but they simply don't autocomplete dictionary keys of a parsed json object while you're working with a novel or one off json object.

To see what I mean consider this repl session:

>>> import json
&gt;&gt;&gt; params="""{"required_jobs":["bills"],"org_name":"Bank","allocation":{"targets":[]},