Skip to content

Instantly share code, notes, and snippets.

@gotofritz
gotofritz / Makefile
Last active November 6, 2023 18:41
Starting point for Python Makefile for Poetry
PYTHON_VERSION ?= 3.10.4
CMD := poetry run
SRC_DIR := src
TESTS_DIR := tests
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: help
lint-mypy: ## checks src and tests with mypy
// 1. Copy the gist below, and replace mastodon.social with your own instance
// 2. Go to https://rknightuk.github.io/mastodon-toot-bookmarklet/ and create your bookmarklet
// 3. Edit the bookmarklet, and replace the URL with the one from step 1
javascript:void(window.open('https://mastodon.social/share?text='+encodeURIComponent(document.title)+'%250A'+encodeURIComponent(window.location.href)+(window.getSelection().toString() ? ' %250A' + encodeURIComponent(window.getSelection().toString()): ''), '_blank','width=600,height=600,toolbar=no'))
@gotofritz
gotofritz / pyproject.toml
Last active September 8, 2022 21:19
fragments of pyproject.toml for new projects
[tool.poetry]
name = "my-project"
version = "0.1.0"
description = "It's my project, yo"
authors = ["gotofritz <gotofritz@users.noreply.github.com>"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/gotofritz/my-project"
repository = "https://github.com/gotofritz/my-project"
@gotofritz
gotofritz / python.sh
Created January 22, 2021 10:45
Install python in Big Sur with pyenv
brew reinstall bzip2
brew reinstall zlib
CPPFLAGS="-I$(brew --prefix bzip2)/include -I$(brew --prefix zlib)/include" \
LDFLAGS="-L$(brew --prefix bzip2)/lib -L$(brew --prefix zlib)/lib" \
pyenv install --patch 3.6.4 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
@gotofritz
gotofritz / lazydocker config.yml
Created October 16, 2019 13:52
lazydocker add
# ~/Library/Application\ Support/jesseduffield/lazydocker/config.yml
reporting: "on"
customCommands:
services:
- name: start
attach: false
command: docker-compose up -d {{ .Service.Name }}
@gotofritz
gotofritz / cra.sh
Last active July 9, 2019 21:31
Creates a simple CRA project, removing some of the unnecessary files
# Creates a simple CRA project, removing some of the unnecessary files
# (Eventually I will build a proper tool to do this, but in the meantime...)
# ensure there is a project name to build
if [[ $1 == '' ]]; then
echo 'Usage: cra the_name_of_a_folder_you_want_created'
exit
fi
project_name=$1
@gotofritz
gotofritz / _ffmpeg.sh
Last active June 26, 2019 13:58
Various ffmpeg commands
# ffmpeg snippets
# ffmpeg-slowdown.sh: slow down all files in a directory
# ffmpeg-to-mp3.sh: convert all video files in a directory to mp3
# handbrake-bulk.sh: convert all webm fils in a folder to mp4
@gotofritz
gotofritz / resize padded.sh
Last active June 26, 2019 13:35
ImageMagick bits and pieces
# resize image, padded
@gotofritz
gotofritz / gitlab-markdown-toc.js
Last active May 7, 2019 12:50
creates a gitlab markdown table of contents for a README.md page
// quick and dirty snippet to creates a gitlab markdown table of contents for a README.md page
// preview gitlab page and paste in browser console
var str = "";
$('.file-content')
.find('h1, h2, h3, h4, h5, h6, h7')
.each((i, node) => {
// node.tagName is H1 H2...
let indent = Number(node.tagName[1]) - 1;
// markdown mested lists are
// - xxx
@gotofritz
gotofritz / npm-list.sh
Last active October 19, 2017 09:46
NPM bits and pieces
# given that $PACKAGE is the package about which you want to find out more
# this lists only the modules you have installed
npm ls
# list available versions of $PACKAGE
# note the plural, versionS - without it, you only get the current version
npm show $PACKAGE versions
# this finds the latest version of your package as well as other with similar names