Skip to content

Instantly share code, notes, and snippets.

View jasonm23's full-sized avatar

Jason Milkins jasonm23

View GitHub Profile
@jasonm23
jasonm23 / pointdist
Last active August 11, 2023 03:32
Distance and angle between two cartesian points
#!/usr/bin/env python3
import math
import sys
def calculate_distance(x1, y1, x2, y2):
angle = calculate_angle(x1, y1, x2, y2)
return abs(y2 - y1) / math.sin(math.radians(angle))
def calculate_angle(x1, y1, x2, y2):
@jasonm23
jasonm23 / autocomplete_tkinter.py
Last active July 5, 2023 15:52
A simple autocomplete GUI in TKinter, Suggestions read from stdin or an input file. Title can also be set. Python 3.11 + tkinter required.
import tkinter as tk
from tkinter import END
import os
import sys
import re
import argparse
# --- Event Handler functions
def select_handler(w):
widget = w.widget
@jasonm23
jasonm23 / The Humble Programmer.md
Last active May 9, 2023 01:33
The Humble Programmer - Edsger Dijkstra / ACM 1972 / Volume 15 Number 10

The Humble Programmer

by Edsger W. Dijkstra

As a result of a long sequence of coincidences I entered the programming profession officially on the first spring morning of 1952 and as far as I have been able to trace, I was the first Dutchman to do so in my country. In retrospect the most amazing thing was the slowness with which, at least in my part of the world, the programming profession emerged, a slowness which is now hard to believe. But I am grateful for two vivid recollections from that period

@jasonm23
jasonm23 / The Human-AI Partnership: Achieving Financial Freedom for Everyone.md
Created March 17, 2023 06:42
The Human-AI Partnership: Achieving Financial Freedom for Everyone

In today's rapidly evolving world, artificial intelligence is shaking up many industries that were once thought to be technology-proof, from software engineering to legal services. The impact of AI on the human economy is still uncertain, but it's easy to feel worried about the future.

What used to be a far-off dream is now becoming a reality: a world where personalized AI agents can replace entire industries such as entertainment, education, legal services, and software engineering. We can already imagine asking AI to create a suite of music or a movie and consuming it immediately.

But as AI continues to evolve, we also face the possibility of increasing wealth inequality, where the 1% will use AI instead of people, leaving the 99% to suffer the consequences. The wealth gap we have now could become insignificant in comparison.

Without a game plan, the transition to a post-AI world could be chaotic and untenable. While researchers take the risks of AI seriously, leaders of business, governments, and milita

Action Description
about Inkscape version, authors, license
action-list Print a list of actions and exit
clone Create a clone (a copy linked to the original) of selected object
clone-link Relink the selected clones to the object currently on the clipboard
clone-link-lpe Creates a new path, applies the Clone original LPE, and refers it to the selected path
clone-unlink Cut the selected clones' links to the originals, turning them into standalone objects
clone-unlink-recursively Unlink all clones in the selection, even if they are in groups.
com.inkscape.generate.generate-voronoi Voronoi Pattern
@jasonm23
jasonm23 / Country Style Breakfast Sausage.md
Created September 16, 2022 04:00
Country Style Breakfast Sausage

Country Style Breakfast Sausage

Ingredient: g/kg
Salt 19
Black Pepper 1
White Pepper 1.5
Sage 2
Chilll Flake 1
@jasonm23
jasonm23 / pass-gpg-firefox-android.md
Last active September 10, 2022 14:15
Setting up Pass on Mac, Firefox and Android.

Password Store (pass) on Mac, Firefox and Android

A quick word on OPSEC.

Completed the initial setup of [pass] on Macos Big Sur, this is after BitWarden locked me out half a day because apparently I had "network issues", but that seems highly doubtful.

Anyway that shook my faith in Bitwarden, so I searched for an alternative and I'm pretty happy with [pass]. It's simple, no-nonsense. In a nutshell it's front end for a git repo + gpg to handle encryption.

Bascially if your client side can reach/interact with a git repo and works with GPG (2.2 for Android/OpenKeyChain, see below.) we're in business.

@jasonm23
jasonm23 / color-contrast-wcag.md
Last active September 2, 2022 02:02
Notes on color contrast WCAG

Notes on color contrast WCAG

contrast-ratios
(L1 + 0.05) / (L2 + 0.05)

Where

L1 is the relative luminance of the lighter of the colors, and L2 is the relative luminance of the darker of the colors.

@jasonm23
jasonm23 / font-favorites.el
Last active September 1, 2022 11:21
Select favorite fonts in Doom Emacs
(defun ocodo/font-favorites ()
"Set default and variable-pitch fonts from favorites."
(interactive)
(let* ((m-favorites '(("PFDin Mono XThin" (:family "PFDinMono-XThin" :weight normal))
("PFDin Mono Thin" (:family "PFDinMono-Thin" :weight normal))
("PFDin Mono Light" (:family "PFDinMono-Light" :weight normal))
("SauceCodePro Nerd ExtraLight" (:family "SauceCodePro Nerd Font" :weight light))
("SauceCodePro Nerd Light" (:family "SauceCodePro Nerd Font" :weight semi-light))
("SauceCodePro Nerd Regular" (:family "SauceCodePro Nerd Font" :weight normal))
("Input Mono Regular" (:family "Input Mono" :weight normal))
@jasonm23
jasonm23 / text-property-api.org
Last active August 31, 2022 10:08 — forked from Fuco1/text-property-api-org
Text property api for emacs

All these operations are very natural for buffer objects as well as strings, which leads me to the conclusion we should provide two flavours for each function, for buffers and for strings. The way emacs does it is by specifying an object argument. I find this suboptimal, but it is also possible solution (and would reduce the number of functions in half). Note that there are also different indexing conventions, see the Question below.

All functions come in buffer and string flavours. The “current position” is called point in buffer versions and offset in string