Skip to content

Instantly share code, notes, and snippets.

View AlphaSheep's full-sized avatar

Brendan Gray AlphaSheep

View GitHub Profile
@AlphaSheep
AlphaSheep / music_dedup.py
Created April 18, 2025 13:37
Deduplicate MP3 files
#!/usr/bin/env -S uv --quiet run --script
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "mutagen",
# ]
# ///
"""
Deduplicates music, assuming it has been tagged with MusicBrainz Picard.
@AlphaSheep
AlphaSheep / yiheng_130_pr_2023_04_27.sql
Last active July 8, 2024 07:50
Historical WCA Ranking Query
drop table if exists y_comp_dates;
create table y_comp_dates as
select
id as competitionId,
year * 10000 + endMonth * 100 + endDay as endDate
from
Competitions;
drop table if exists y_results;
@AlphaSheep
AlphaSheep / README.md
Created January 5, 2024 15:24
Bluetooth Smart Cube code

Code for connecting to a bluetooth smart cube

The only external dependency is lz-string

Adapted from cstimer by Shuang Chen (cs0x7f) https://github.com/cs0x7f/cstimer Copyright (C) 2023 Shuang Chen Licensed under the GPLv3

@AlphaSheep
AlphaSheep / afr_candidates.sql
Last active December 27, 2023 11:30
AfR Candidates
create table compdates as
select
id as competitionId,
year * 1e6 + month * 1e2 + day as date
from Competitions;
create table africans as
select
Persons.id as wcaId
from
@AlphaSheep
AlphaSheep / composition.py
Created October 13, 2023 18:21
Composition over Inheritance and the AI Generated Code
class SwimmingAbility:
def swim(self, name, message):
print(f"{name} {message}")
class Duck:
def __init__(self, name):
self.name = name
@AlphaSheep
AlphaSheep / owners_move_error.rs
Last active September 29, 2023 12:35
Rust Examples
fn main() {
let original_owner = String::from("Something");
let new_owner = original_owner;
println!("{}", original_owner);
}
@AlphaSheep
AlphaSheep / averagesnaive.py
Last active September 22, 2023 13:07
Averages with outliers
@timeit
def calc_averages_naive(times: List[float], window_size: int, cutoff_size: int):
divisor = window_size - (cutoff_size * 2)
averages = []
for i in range(len(times) - window_size + 1):
window = times[i:i+window_size]
window.sort()
averages.append(sum(window[cutoff_size: -cutoff_size]) / divisor)
@AlphaSheep
AlphaSheep / allpdftopng.sh
Created February 14, 2019 19:45
PNGs to PDFs Inkscape Bash
#!/bin/bash
# Convert all pdfs in a folder into pngs using inkscape
for f in *.pdf
do
echo "Now processing $f"
inkscape --without-gui -f $f --export-png ${f%.*}.png --export-area-page
echo
@AlphaSheep
AlphaSheep / Analysis.py
Last active March 19, 2017 09:03
Cubing degrees of separation
#!/usr/bin/python3
import json
import time
def tic():
tic.start = time.time()
def toc():
print('Time elapsed:', round(time.time() - tic.start, 3),'s\n')
return (time.time() - tic.start)
@AlphaSheep
AlphaSheep / tslegen.py
Created October 31, 2016 15:06
Scripts for generating TSLE algorithms
#!/usr/bin/python3
'''
Created on 19 May 2016
Copyright (c) 2016 Brendan Gray and Sylvermyst Technologies
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell