Skip to content

Instantly share code, notes, and snippets.

View amcgregor's full-sized avatar
🏢
I died! …well, I got better…

Alice Zoë Bevan–McGregor amcgregor

🏢
I died! …well, I got better…
View GitHub Profile
@amcgregor
amcgregor / account.py
Last active February 12, 2023 06:15
A collected sample model for user accounts, sessions, and supporting record types. (JSON sample needs updating to conform to the updated/public models.)
# Note: No __collection__ defined on most of these.
# They're for "embedding" (nesting) within a real collection-level document.
from argon2 import PasswordHasher
from argon2.exceptions import VerifyMismatchError
from marrow.mongo import Document, Field, Index
from marrow.mongo.trait import Queryabe, Identified
from marrow.mongo.field import Reference, Set, String, ObjectId, Date, Embed,
@amcgregor
amcgregor / 1-modern-emoji
Last active December 7, 2023 08:48
My collection of System Preferences → Keyboard → Text automatic replacements. Because using the character picker is a pain in the rump. Yes, the :code: one is multi-line.
-_- 😑
;^P 🤪
;P 😜
:'( 😢
:( 🙁
:) 🙂
:/ 😕
:^P 🤪
:| 😐
:3 😽
class Helper:
encoding = 'utf-8'
def __init__(self, udid, it_pro):
self.udid = udid
self.itpro = it_pro
def employee_id(self):
sql = "select emplid from emplid_to_alphaname where alphaname = (%s);", (self.udid, )
@amcgregor
amcgregor / disclaimer.md
Created January 15, 2020 05:03
I used to collect/aggregate/write the cheekiest licenses and disclaimers for my apps. "This product may light you or your computer on fire, kick your dog, or be the cause of your divorce. None of that is our problem."

Handle with Extreme Care: This product contains minute electrically charged particles moving at velocities in excess of five hundred million miles per hour.

Component Equivalency Notice: The subatomic particles (Electrons, Protons, etc.) comprising this product are exactly the same in every measurable respect as those used in the products of other developers, and no claim to the contrary may legitimately be expressed or implied.

Important Notice to Purchasers: The entire physical universe, including this product, may one day collapse back into an infinitesimally small space. Should another universe subsequently re-emerge, the existence of this product in that universe cannot be guaranteed.

The images in this manual may or may not be representative of actual screens in the described product. They may not even be screens from the described product. Please use your own copy of the product for a reference, if unsure.

Thank you,

@amcgregor
amcgregor / 1-fragment.html
Last active January 13, 2020 19:34
Originally with no newlines.
<p style="line-height:normal; margin-top:0px">
<br>
<span style="font-size:12px">
<span style="font-family:Verdana">
<span style="font-weight:bold">
Your experience and educational background:
</span>
</span>
</span>
</p>
@amcgregor
amcgregor / 0--git-repository-universal
Last active August 9, 2023 17:46
An example web application on-disk structure, and the general template I follow for my WebCore applications, both personal and professional. Also applicable to Django, Flask, or almost any other project that can be broken up modularly. — https://github.com/marrow/webcore#what-is-webcore
# Project root. Cloned into /Volumes/<org>/<project> and symlinked to `~/Projects/<workspace>/src` if isolated as a
# distinct project, or `~/Projects/<workspace>/<project>` if part of a collective work or business space alongside
# others.
# Project Metadata
.gitignore # From template.
.pre-commit-config.yaml # https://pre-commit.com
.travis.yml # Test runner configuration.
MANIFEST.in # Redistributable package inclusions.
Makefile # Automatically re-pip's when the metadata updates, runs tests, tests depend on up-to-date metadata, etc.
@amcgregor
amcgregor / isopen.py
Created January 2, 2020 19:55
A demonstration I use of an alternate use for a sorting algorithm.
from bisect import bisect_left
periods = [
# Time, is_open
('00:00', False),
('08:30', True),
('12:00', False),
('13:15', True),
('17:30', False),
@amcgregor
amcgregor / ingest.py
Last active December 12, 2019 18:58
An initial skeleton for an approach to replicating a generic file upload / sharing service, media ingest (upload) aspect.
from functools import wraps
from uri import URI
from web.dispatch.resource import Resource
from web.decorator import accept
from .template import frontend
def body_as_location(fn):
"""Permit endpoints returning a bare URL to utilize that URL as the Location target for redirection."""
@amcgregor
amcgregor / amcgregor-day-1.plan
Created November 12, 2019 13:07
Before Things, before Apple's Reminders, before all of this GTD enthusiasm, I had .plan files.
# Day one, everything is new.
+ Epic Projectico
+ First sub-task. (Some additional description for that task.)
+ Second sub-task.
@amcgregor
amcgregor / what-do-you-expect-to-happen.py
Last active October 29, 2019 19:49
Gut-feelings and code go together…
# Here's a simple (and silly, but it's an example) function definition in Python:
def append(value, l=[]):
"""Append a value to a list, return that list."""
l.append(value)
return l
print(append(27)) # [27]
print(append(42)) # ?