Skip to content

Instantly share code, notes, and snippets.

@twolfson
twolfson / README.txt
Created February 3, 2022 20:49
How I stack PRs in GitHub
View README.txt
The following process is rather tedious but removes headaches from dealing with merge conflicts due to using a historically timed commit
When starting stacked work:
- git status # On pr1 branch
- git checkout main
- git checkout -b pr2.base # This will act as base for easy PR review and merge conflict resolution
- git checkout pr1 -p # Pull over all changes from pr1 into a single commit, including file deletion (git checkout -- . would miss this) (single commit removes noisy git history from PR)
- git commit -m "Single commit containing pr1 changes"
- git checkout -b pr2
- # Work on pr2
@twolfson
twolfson / main.py
Created January 22, 2022 01:14
Add `persist` flag to Python's tempfile.TemporaryDirectory
View main.py
# https://github.com/python/cpython/blob/v3.10.2/Lib/tempfile.py#L782-L852
class PersistableTemporaryDirectory(tempfile.TemporaryDirectory):
def __init__(self, *args, persist: bool, **kwargs):
self.persist = persist
ret_val = super().__init__(*args, **kwargs)
# If we're persisting, then remove `weakref` binding for cleanup at garbage collection
if self.persist:
self._finalizer.detach()
return ret_val
@twolfson
twolfson / main.py
Created January 4, 2022 23:40
Tipalti API name support via fuzzing
View main.py
# Last updated: 2022-01-04
def is_valid_tipalti_name(name):
# https://support.tipalti.com/Content/Topics/Development/APIs/PayeeAPI/UpdatePayee/CreatePayeeInfoAutoIdap/Intro.htm#PayeeDetailsItem1
# Max length: 70 -- Incorrect: During testing it's 35 characters...
# Latin and numeric (cannot be only numeric)
# Spaces, periods, dashes (cannot be the first character)—e.g., "Mary Jo", "Jr.", "Mary-Jo"
# We've found additional cases like "Test 4" which fail, see tests for robust overview
# Their API truncates names at 35 characters
# This is fine for our use case and we won't reject a name for being too long
@twolfson
twolfson / index.js
Last active November 10, 2021 20:39
polygon-clipping: "Unable to complete output ring" reproduction script
View index.js
const polygonClipping = require('polygon-clipping');
const poly1 = [
[
[-89.6913437618266, 32.5917775294804],
[-89.6913424001509, 32.5873713360798],
[-89.6913420772531, 32.5863246737333],
[-89.6932638650491, 32.5863115360137],
[-89.6932452075745, 32.5843574521187],
[-89.6951228354689, 32.584358882942],
@twolfson
twolfson / .gitignore
Last active October 25, 2021 22:15
Tried/failed attempt to reproduce nested dialog issues with Reakit
View .gitignore
node_modules/
@twolfson
twolfson / .gitignore
Last active December 25, 2020 03:00
Exploration of using Python for a LibreOffice ODS pipeline
View .gitignore
output.ods
.~lock*
@twolfson
twolfson / ods-hyperlink.sh
Last active November 11, 2020 11:43
Hyperlink ODS text (LibreOffice Calc)
View ods-hyperlink.sh
@twolfson
twolfson / .gitignore
Created October 14, 2020 09:26
Explore SoftwareSerial and using Arduino Uno as a proxy for ATtiny85
View .gitignore
.pio/
include/
lib/
src/
test/
@twolfson
twolfson / .gitignore
Last active October 10, 2020 01:41
Exploration of async/await blocking
View .gitignore
node_modules/
@twolfson
twolfson / .gitignore
Last active October 13, 2020 11:49
Playground gist for exploring PlatformIO
View .gitignore
.pio/
include/
lib/
src/
test/