Skip to content

Instantly share code, notes, and snippets.

View gimbo's full-sized avatar

Andy Gimblett gimbo

View GitHub Profile
@gimbo
gimbo / .gitignore
Last active March 10, 2022 20:56
Script to demonstrate issue with pip-compile pre-commit hook handling of git worktree folders
workspace
@gimbo
gimbo / terraform.log
Last active January 12, 2022 16:58
Terraform debug log for terraform-provider-aws issue 22549 related to aws_ses_identity_policy
2022-01-12T16:40:00.754Z [INFO] Terraform version: 1.1.3
2022-01-12T16:40:00.755Z [INFO] Go runtime version: go1.17.2
2022-01-12T16:40:00.755Z [INFO] CLI args: []string{"/opt/homebrew/Cellar/tfenv/2.2.2/versions/1.1.3/terraform", "apply"}
2022-01-12T16:40:00.755Z [DEBUG] Attempting to open CLI config file: /Users/andy.gimblett/.terraformrc
2022-01-12T16:40:00.755Z [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022-01-12T16:40:00.755Z [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2022-01-12T16:40:00.755Z [DEBUG] ignoring non-existing provider search directory /Users/andy.gimblett/.terraform.d/plugins
2022-01-12T16:40:00.755Z [DEBUG] ignoring non-existing provider search directory /Users/andy.gimblett/Library/Application Support/io.terraform/plugins
2022-01-12T16:40:00.755Z [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2022-01-12T16:40:00.756Z [INFO] CLI command args: []string{"apply"}
@gimbo
gimbo / openpyxl_dash_docset_generation_notes.md
Created September 17, 2021 14:27
Notes on creating a Dash docset for openpyxl

Notes on creating a Dash docset for openpyxl

  • Dash is a documentation reader for MacOS
  • openpyxl is a python library for working with XLSX files

openpyxl has pretty good docs prepared using sphinx, though they can be hard to navigate.

Using Dash makes that easier for me, so here's how to create a Dash docset for openpyxl, using the doc2dash tool; by default this will install it directly into Dash, but see doc2dash's documentation for more options.

@gimbo
gimbo / restart_xbar.sh
Created June 3, 2021 16:28
A bash script to kill/restart xbar, in response to xbar issue #714
#!/usr/bin/env bash
# See https://github.com/matryer/xbar/issues/714
getxbarpid () {
ps -Ac -o pid=,comm= | grep xbar | column -t | cut -d ' ' -f 1
}
xbarpid="$(getxbarpid)"
if [ -z "$xbarpid" ] ; then
@gimbo
gimbo / attrs_flexible_repr.py
Last active September 6, 2019 13:40
An attrs extension giving fields more control over how they're rendered in an autogenerated __repr__
def attrs_flexible_repr(cls):
"""
An [attrs](http://www.attrs.org/) extension giving attributes more
flexibility about how they appear in the autogenerated `__repr__`.
Out of the box, attrs gives your class a pretty decent `__repr__` method;
you can disable this at the class level to define your own, or you can
keep it but exclude attributes by setting their `repr` field to False.
@gimbo
gimbo / excel_import_csv.md
Last active November 10, 2017 09:51
Excel macro to easily import a CSV as all text

Importing CSV into Excel as text

Importing a CSV into Excel is annoying, because by default it will try to interpret the columns, and it often/usually gets it wrong. You can control what format is used for each column when you import a CSV file, but it's fiddly, and for many purposes we'd just like to load a CSV and have every column to be read in as uninterpreted text, without having to faff with the import wizard.

Good news: we can do that with a macro. Here it is:

Sub importCSV()

    Dim column_types() As Variant
@gimbo
gimbo / git-summary.sh
Last active August 11, 2021 18:30
git-summary.sh - summarise git repos in some folder
#!/bin/bash
# git-summary - summarise git repos at some path
#
# Adapted from https://gist.github.com/lmj0011/1a8dd1e376234ac7bf0fba2748ecdd0f
#
# Andy Gimblett, March 2017
usage() {
@gimbo
gimbo / pythonpath.rst
Created June 16, 2016 12:48 — forked from tgalv/pythonpath.rst
LR python path

Python Path

Motivation

A whistle-stop tour of the techniques for getting your Python code into a place where the interpreter can get to work on it followed by the implications for code structure and usability.