Skip to content

Instantly share code, notes, and snippets.

@tobywf
tobywf / save-gists.py
Created April 7, 2020 03:33
Save all gists from GitHub, including comments
"""
Save all gists from GitHub, including comments.
Requires the PyGithub library (``pip install PyGithub>=1.47``).
Pass a personal access token with the scope "gist" as the first
argument.
This probably won't work for large files (+10MiB), since they aren't
returned by the GitHub API, and must be cloned instead.
@tobywf
tobywf / clean_old_lambda_versions.py
Last active April 11, 2024 06:52
A quick script to remove old AWS Lambda function versions
from __future__ import absolute_import, print_function, unicode_literals
import boto3
def clean_old_lambda_versions():
client = boto3.client('lambda')
functions = client.list_functions()['Functions']
for function in functions:
versions = client.list_versions_by_function(FunctionName=function['FunctionArn'])['Versions']
for version in versions:
@tobywf
tobywf / build-dvisvgm.sh
Last active April 26, 2024 10:14
Build dvisvgm and kpathsea on macOS
#!/bin/bash
set -xeuo pipefail
IFS=$'\n\t'
PREFIX="${1:-/usr/local/dvisvgm}"
TEX="$(kpsewhich -var SELFAUTOLOC)"
echo "$PREFIX, $TEX"
brew install automake freetype ghostscript potrace