Skip to content

Instantly share code, notes, and snippets.

View isosphere's full-sized avatar

Matthew Scheffel isosphere

View GitHub Profile
@isosphere
isosphere / hcn.rs
Created October 8, 2020 13:34
Highly Composite Number Function in Rust (Not Optimized)
/// Returns the largest highly composite number less than or equal to the given number.
/// There is nothing clever about this algorithm, it is slow.
/// # Arguments
/// * `maximum` - A reference to a number that the highly composite number must not exceed
/// # Examples
/// ```
/// assert_eq!(highest_highly_composite_number(&842), 840)
/// ```
fn highest_highly_composite_number<'a, T: 'a>(maximum: &T) -> T
where
@isosphere
isosphere / google-takeout-exif-correction.py
Created February 18, 2021 02:03
A tool to correct the stripped datetime of Google Takeout image exports
import datetime
import json
import os
from exif import Image
google_photos_directory = r'C:\\Users\\Matt\\Downloads\\Takeout\\Google Photos'
database = dict()
def latch_adjusted_dataframe(input_dataframe, shift_period):
df = input_dataframe.copy()
# latch-adjust returns
df.reset_index(inplace=True)
df['buy_signal'] = df['buy_signal'] & (df['buy_signal'].shift(1) == False)
df['sell_signal'] = df['sell_signal'] & (df['sell_signal'].shift(1) == False)
# not specifying a condition, because we are going to modify the same condition.
@isosphere
isosphere / githubprint.user.js
Created July 25, 2022 15:42 — forked from gaute/githubprint.user.js
Printable GitHub issues
// ==UserScript==
// @name Printable GitHub issues
// @namespace https://github.com/gaute
// @include https://github.com/*/issues/*
// ==/UserScript==
if (typeof($) === "undefined") {
$ = unsafeWindow.$;
}
@isosphere
isosphere / mastodon_4.0.2_toot.patch
Created December 18, 2022 16:40
A fun patch for Mastodon 4.0.2 to Change "Publish" to "Toot" and "Favourites" to "Booped Toots"
diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json
index b8cb24799..0e4686e63 100644
--- a/app/javascript/mastodon/locales/en.json
+++ b/app/javascript/mastodon/locales/en.json
@@ -104,7 +104,7 @@
"column.direct": "Direct messages",
"column.directory": "Browse profiles",
"column.domain_blocks": "Blocked domains",
- "column.favourites": "Favourites",
+ "column.favourites": "Booped Toots",
@isosphere
isosphere / mastodon_backup_and_upgrade.sh
Last active February 28, 2023 14:05
Mastodon Server Upgrade Script
#!/bin/bash
RELEASE_TAG=${1:?"missing arg 1 for RELEASE_TAG"}
echo Backing up database
/home/mastodon/backup_database.sh
cd /home/mastodon/live
git fetch
# The stash commands are only required if you mess around with the source code
@isosphere
isosphere / ConvertNumbersToHex.vbs
Last active February 28, 2023 13:33
Given a string with decimal numbers in it, convert all of those to their hexadecimal representation.
Function ConvertNumbersToHex(text As String) As String
Dim objRegex As RegExp
Dim results
Dim text_result
Dim hex_value
Set objRegex = New RegExp
objRegex.Global = True
objRegex.Pattern = "(\d+)"
@isosphere
isosphere / 2024-07-12_debian_bookworm_v_linode_6.8.9-x86_64-linode164
Last active July 13, 2024 00:46
diffconfig of the debian stable-backports linux-config 6.7.12-1~bpo12+1 i386 and the linode-provided 6.8.9-x86_64-linode164 /proc/config.gz (in that order, as supplied as args to diffconfig)
-3C515 m
-6LOWPAN_DEBUGFS n
-6LOWPAN_GHC_EXT_HDR_DEST m
-6LOWPAN_GHC_EXT_HDR_FRAG m
-6LOWPAN_GHC_EXT_HDR_HOP m
-6LOWPAN_GHC_EXT_HDR_ROUTE m
-6LOWPAN_GHC_ICMPV6 m
-6LOWPAN_GHC_UDP m
-6LOWPAN_NHC m
-6LOWPAN_NHC_DEST m
@isosphere
isosphere / execute
Last active July 28, 2024 17:20
Linux Pipe For Converting tabler icons to PNG with a defined stroke colour
#!/bin/sh
# all files will be prepended with "flag", this is for kstars
COLOUR="cyan"
WIDTH=24
HEIGHT=24
for FILE in ../*.svg
do
@isosphere
isosphere / mastodon-crontab
Last active August 1, 2024 16:13
Mastodon Cleanup Crontab - Keeps Storage Manageable
@daily RAILS_ENV=production /home/mastodon/live/bin/tootctl statuses remove --days=100
@daily RAILS_ENV=production /home/mastodon/live/bin/tootctl media remove --days=14
@daily RAILS_ENV=production /home/mastodon/live/bin/tootctl preview_cards remove --days=14