Skip to content

Instantly share code, notes, and snippets.

View MichaelCurrie's full-sized avatar

Michael B. Currie MichaelCurrie

View GitHub Profile

Addendum: Legislative Pull Request

What follows are the specific text changes to Ontario statutes required to implement the proposals in https://michaelbcurrie.medium.com/a-modest-proposal-for-the-dead-88828530faa1.

An MPP would introduce these as a bill before the Legislative Assembly of Ontario. The responsible ministry is the Ministry of Public and Business Service Delivery.

Design principle: These amendments achieve their goals primarily by removing restrictive text and broadening existing powers, rather than adding new machinery. The net effect is a shorter statute with broader utility.

Net changes: −50 words net across both statutes. ~280 words added, ~330 words removed. The biggest single cut is repealing s.51.1 (the lost document reporting section nobody uses), which alone removes ~200 words.

@MichaelCurrie
MichaelCurrie / dataframe_fast.py
Last active August 4, 2024 23:33
Fast pandas DataFrame read/write to mariadb
#!/usr/bin/env python3
"""
Drop-in replacement for pandas.DataFrame methods for reading and writing to database:
pandas.DataFrame.to_sql
pandas.read_sql_table
For some reason the current (Jan 2023) implementation in Pandas
using sqlalchemy is really slow. These methods are ~300x faster.
@MichaelCurrie
MichaelCurrie / yield_to_lamb_chop.py
Last active December 14, 2022 10:19
Shari Lewis teaches `yield`
def the_song_lyrics():
while True:
yield "This is the song that doesn't end"
yield "Yes it goes on and on my friends"
yield "Some people started singing it, not knowing what it was"
yield "And they'll continue singing it forever, just because"
for lyric in the_song_lyrics():
print(lyric)
@MichaelCurrie
MichaelCurrie / backup_mediawiki
Last active October 12, 2020 05:29
How to back up a MediaWiki server hosted on a remote Debian machine
# A script showing how to back up a MediaWiki server hosted on a remote Debian machine
# I run each line manually myself
# SUMMARY: Basically there are five things you should extract from the mediawiki server:
# 1. LocalSettings.php: Get this from /var/www/mediawiki/LocalSettings.php
# 2. images.zip: A zip file of /var/www/mediawiki/images which contains all the image data
# 3. dbdump20201011.sql: A single .sql file which is a dump of every table in the /var/www/ MySQL mediawiki database,
# which you can create by running mysqldump
# 4. pedia_full_dump.xml: The content, by running php /var/www/mediawiki/maintenance/dumpBackup.php --full > pedia_full_dump.xml
# 5. mediawiki.zip: A zip file of /var/www/mediawiki entirely (just in case we have other media or config stuff we need)
@MichaelCurrie
MichaelCurrie / ..setup_git-lfs.sh
Last active March 14, 2018 09:33
Set up Git LFS for a new repo
# Instructions for Windows developers working on the Fling Unity Visualization Tool
# 1. Install the latest version of Unity
# 2. (NOT NEEDED) Install "SmartMerge" for Unity by following https://docs.unity3d.com/Manual/SmartMerge.html
# 3. Install GitHub Desktop
# 4. Install git-lfs
# 5. Get a GitHub developer account
# 6. Get invitated and accept the invitation to the fling-asia GitHub organization
# 7. Clone the fling-unity repository to your computer via the GitHub desktop app
# 8. Open the program in Unity
@MichaelCurrie
MichaelCurrie / git-lfs-example.sh
Created March 13, 2018 11:02
Use git-lfs on existing repository
# Install git-lfs
# (From https://github.com/git-lfs/git-lfs/wiki/Installation)
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git lfs install
# Add git-lfs to an existing repo
@MichaelCurrie
MichaelCurrie / wconviewer_standalone
Last active February 2, 2018 16:14
Run wconviewer standalone
You can view WCON files at:
movement.openworm.org/wconviewer
But until the HTML5 fix is in, you have to upload and then download the file, which is awkward. Instead:
1. Clone movement validation
2. Start -> Run -> cmd -> navigate to C:\Users\Fling\Documents\GitHub\movement_cloud\webworm
@MichaelCurrie
MichaelCurrie / README.md
Created June 12, 2017 02:05 — forked from ThomasThoren/README.md
Map distance scales

Example of how to create dynamic map distance scales.

@MichaelCurrie
MichaelCurrie / Dropzone with Python 3
Last active December 11, 2024 18:22
Drag-and-drop upload files, via JavaScript, to a simple Python 3 HTTP server
#Drag-and-drop upload files, via JavaScript, to a simple Python 3 HTTP server
@MichaelCurrie
MichaelCurrie / month_normalized_year_fraction.sql
Last active February 4, 2017 21:12
Years between dates, with "sticky" months
CREATE FUNCTION sandbox.MonthNormalizedYearDiff(@StartDate DATE, @EndDate DATE)
RETURNS FLOAT
AS
BEGIN
/*
MONTH-NORMALIZED YEAR DIFF
How many years are between 31 December 2015 and 31 January 2016, say? You could say
31 days in January / 366 days in the year 2016. But notice how if I then try to
"de-annualize" the resulting fraction, I can't multiply by 12, since 31/366 != 1/12.