Skip to content

Instantly share code, notes, and snippets.

View acdha's full-sized avatar

Chris Adams acdha

View GitHub Profile
acdha / newsblur.opml
Created May 15, 2023 14:08
Tech-related NewsBlur subscriptions
<?xml version="1.0" encoding="utf-8"?>
<opml version="1.1">
<!--Generated by NewsBlur ->
<title>NewsBlur Feeds</title>
<dateCreated>2023-05-15 14:04:44.095425</dateCreated>
<dateModified>2023-05-15 14:04:44.095425</dateModified>
<outline text="Web" title="Web">
acdha /
Last active January 21, 2023 01:33
Example of how to exclude Nones from JSON-encoded output, optionally destructively
#!/usr/bin/env python3
Example of how to non-destructively remove None values from an object before
JSON serialization
import json
def filter_nones(obj):
acdha / Podman as a Docker Desktop
Last active June 17, 2024 15:58
Instructions for using Podman as a replacement on MacOS

Podman as a Docker Desktop alternative


  1. Install Homebrew from

Install Podman

$ brew install podman
acdha /
Created January 9, 2021 22:17
from datetime import date
ordinal = lambda n: "%d%s" % (n, "tsnrhtdd" [(n // 10 % 10 != 1) * (n % 10 < 4) * n % 10::4])
dom = - date(year=2020, month=3, day=1)
print(f"Today is March {ordinal(dom.days)}, 2020")
#!/usr/bin/env python3
Bulk register AWS Accounts with Qualys AssetView
Given a list of account IDs, registers them and prints CSV output of the Account
ID and External ID in the format expected by the account setup Terraform code.
A list of accounts to register can be obtained like this::
$ grep -vf <(csvgrep --invert-match --columns 'External ID' --regex '^$' account-setup/qualys-assetview-accounts.csv | csvcut -c 'Account ID' | sed 1d) \
interpreter_python = auto_silent
# Enabling pipelining reduces the number of SSH operations required to
# execute a module on the remote server. This can result in a significant
# performance improvement when enabled, however when using "sudo:" you must
# first disable 'requiretty' in /etc/sudoers
acdha / development.aws_ec2.yaml
Created August 10, 2020 22:50
Ansible dynamic inventory using EC2 tags
plugin: aws_ec2
- us-east-1
instance-state-name: running
tag:Project: MyProject
tag:Environment: Development
- instance-id
acdha /
Last active May 28, 2023 07:12
Ensure that AWS security groups have a list of the current Cloudflare CIDR ranges
#!/usr/bin/env python3
Ensure that every security group tagged with 'AllowCloudflareIngress' has
an ingress rule allowing HTTPS in from every public Cloudflare edge IPv4 and
IPv6 CIDR block.
Note that HTTP is intentionally not enabled: use the always-HTTPS page rule for
that to avoid potential security problems.
acdha / tasks.json
Last active May 21, 2019 14:48
VSCode task for gulp watch output capturing
"version": "2.0.0",
"tasks": [
"type": "gulp",
"task": "watch",
"label": "gulp: watch",
"isBackground": true,
"presentation": {
"reveal": "always",
acdha /
Last active April 9, 2019 15:10
Utility to expand a YAML template into a cloud-custodian policy for taggable AWS resources
#!/usr/bin/env python
# encoding: utf-8
Given a YAML template, expand the `policy_templates` in the provided YAML
template and generate a YAML file containing each policy expanded for every
taggable AWS resource type.
from __future__ import absolute_import, division, print_function