Skip to content

Instantly share code, notes, and snippets.

View yunruse's full-sized avatar
don't forget to drink some water!

Mia yun Ruse yunruse

don't forget to drink some water!
View GitHub Profile
@yunruse
yunruse / AutoLootBase.ws
Last active June 21, 2016 09:11
Better AutoLoot
// AutoLoot main file
function AL_CanLegallyTake( container : W3Container ) : bool
{
if( container.disableStealing || container.HasQuestItem() ||
(W3Herb)container || (W3ActorRemains)container )
return true;
else
return false;
}
@yunruse
yunruse / minkowski.py
Created October 9, 2018 09:42
2D Minkowski animation showing Lorentz transformation
'''Minkowski 2D space-time animation showing Lorentz boost.
Requires Python 3.7, numpy and matplotlib, and an ffmpeg binary in your PATH.'''
import math
import numpy as np
import matplotlib
import matplotlib.animation as anim
from matplotlib import pyplot as plot
@yunruse
yunruse / pxd_phase.py
Created December 23, 2020 12:30
A hacky script to modify graph locations in Pixelmator
import os
from pathlib import Path
import struct
import sqlite3
HEIGHT = 2400
X_PER_GPA = 5
X_START = {
'CH5_naumova_P_1': 450,
'CH6_P212121': 450,
@yunruse
yunruse / roll.py
Created March 1, 2021 23:18
A quick DnD-style dice roller
'''
A quick DnD-style dice roller by Mia yun Ruse.
(Public domain, because it's hardly inventing the wheel.)
Allows for expressions such as:
> 5d0
> 5:d2*10+3; 2d20
23, 13, 13, 13, 13, 24
@yunruse
yunruse / byelection.py
Last active December 7, 2021 00:40
UK by-election analysis
'''
UK by-election analysis by Mia yun Ruse. Public domain.
As seen on:
https://commons.wikimedia.org/wiki/File:UK_By-elections.png
https://en.wikipedia.org/wiki/List_of_United_Kingdom_by-elections_(2010–present)
Data is sourced from:
https://www.parliament.uk/about/how/elections-and-voting/by-elections/
@yunruse
yunruse / mcu.md
Last active May 16, 2021 18:11
Because sometimes, you just get bored, okay?

Every time in the MCU someone says "Marvel", "Cinematic" or "Universe". It took me 31 minutes of searching the film scripts, so here it is.

Currently goes up to Phase 3 (i.e. up to and including Avengers Endgame.)

Total count:

  • "Marvel": 4 (the name "Mar-Vell" was not counted)
  • "Cinematic": 0
  • "Universe": 68
@yunruse
yunruse / taylor.py
Last active May 21, 2021 13:07
Yes, you can do trigonometry on matrices using the Taylor series, and identities will hold.
import math
import numpy as np
import numpy as np
from numpy.linalg import matrix_power
def pow(a, n):
if isinstance(a, np.ndarray):
return matrix_power(a, n)
else:
@yunruse
yunruse / arbitary_base.py
Last active May 22, 2021 14:44
Math, in arbitrary bases! Even irrational ones!
import re
from math import log, ceil
DIGITS = '0123456789abcdefghijklmnopqrtstuvwxyz'
def to_number(
base,
string_or_digits,
decimal_digits=None,
assert_base=True,
@yunruse
yunruse / passwords-bitwarden-to-icloud.py
Created August 27, 2021 23:56
Quick script to turn Bitwarden exported CSVs to iCloud CSVs with basic config
import csv
import sys
from urllib.parse import urlparse
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("input")
parser.add_argument("output")
parser.add_argument(
"--format-name", "-n", action="store_true",
@yunruse
yunruse / safari_history.py
Last active January 1, 2022 17:15
Extract Safari history
import sqlite3
from typing import NamedTuple
from datetime import datetime
HISTORY_EPOCH = 978307200
class Visit(NamedTuple):
date: datetime
title: str
url: str