Skip to content

Instantly share code, notes, and snippets.

View Kenny2github's full-sized avatar
🏫
University

AbyxDev Kenny2github

🏫
University
View GitHub Profile
@Kenny2github
Kenny2github / README.md
Created August 30, 2024 00:51
Convert ISED amateur radio license exam questions into Anki decks

This script converts the *_delim.txt files in the "Amateur basic questions" and "Amateur advanced questions" banks (found here) into Anki .apkg files which can be imported as desired. The script prompts you for:

  1. A filename to use for the temporary .anki2 file the script creates. If the file exists, it must be a valid SQLite3 database containing no tables.
  2. A filename to read the questions from. This should be the amat_{basic,adv}_quest_delim.txt file and must be formatted accordingly.
  3. If you want the French or English questions. Press Enter if you want English, or type anything and press Enter for French.
  4. The name of the deck to generate.
  5. The description of the deck to generate.

The resulting collection is generated in out.apkg which you can then rename and/or import acc

@Kenny2github
Kenny2github / when2meet-constituencies.js
Created August 29, 2024 02:27
Find out the timeslot of a when2meet that maximizes the number of stakeholder groups represented.
/**
* Find out the timeslot of a when2meet that maximizes
* the number of stakeholder groups represented.
*
* Usage:
* 1. Open the when2meet to see the names of those
* that have filled it out.
* 2. Change the values below to suit your situation.
* 3. Open developer tools on your browser (search up
* how to do this) and navigate to its console.
@Kenny2github
Kenny2github / when2meet-copier.user.js
Last active March 5, 2024 06:46
Copy your when2meet responses from one when2meet to another.
// ==UserScript==
// @name When2meet Copy-Paste
// @match https://www.when2meet.com/?*
// @version 2024-03-06
// @description Copy your when2meet responses from one when2meet to the other.
// @author AbyxDev
// @icon https://www.google.com/s2/favicons?sz=64&domain=when2meet.com
// @grant none
// @updateURL https://gist.github.com/Kenny2github/c614b71dd67a5e80abcadfab3e54b4f0/raw/when2meet-copier.user.js
// @downloadURL https://gist.github.com/Kenny2github/c614b71dd67a5e80abcadfab3e54b4f0/raw/when2meet-copier.user.js
@Kenny2github
Kenny2github / !translations.md
Last active December 18, 2023 01:41
ECE253 Past Finals ARM to RISC-V translations

ECE253 Past Finals ARM to RISC-V translations

These are an attempt to translate ARM code appearing in ECE253 past finals and/or their solutions into RISC-V due to the use of the latter in newer iterations of the course. Each file is named as follows: YYYYM-Q##.s (or YYYYM-Q##X.s where X is a version letter) and may be updated as errors are discovered and corrected. If you discover an error or have feedback, leave a comment.

Translations

Legend: ☑️ Done 🟨 WIP 🟦 To-do

@Kenny2github
Kenny2github / git-del-branches.cmd
Created July 6, 2022 16:31
A git script to batch delete branches by glob pattern.
@echo off
if "%1"=="" (
echo usage: git del-branches ^<glob pattern^>
) else (
for /f "usebackq" %%b in (`git branch --list %1`) do (
git branch -d %%b
)
)
@Kenny2github
Kenny2github / set_like_flag.py
Last active June 30, 2022 20:53
An enum.Flag subclass that supports all frozenset operations.
from enum import Flag
class SetLikeFlag(Flag):
"""Flag that additionally supports all frozenset operations."""
def __repr__(self):
"""Only show the flag names, not values."""
return super().__repr__().split(':', 1)[0] + '>'
def __sub__(self, other):
"""Asymmetric difference of this set of flags with the other."""
if not isinstance(other, type(self)):
@Kenny2github
Kenny2github / squaredle.exs
Created June 9, 2022 07:03
Generate words for Squaredle - https://squaredle.app
defmodule Squaredle do
def find_word(row, col, word, board, past_path) do
coords = [
{row + 1, col + 1},
{row + 1, col + 0},
{row + 1, col - 1},
{row + 0, col + 1},
{row + 0, col - 1},
{row - 1, col + 1},
{row - 1, col + 0},
@Kenny2github
Kenny2github / combinatorics.ex
Last active June 9, 2022 04:19
Implementation of combinations and permutations in Elixir
defmodule Combinatorics do
def combinations(_, 0), do: [[]]
def combinations([], _), do: []
def combinations([head | rest], n) do
(for item <- combinations(rest, n - 1), do: [head | item]) ++ combinations(rest, n)
end
def permutations([]), do: [[]]
def permutations(list) do
for h <- list, t <- permutations(list -- [h]), do: [h | t]
@Kenny2github
Kenny2github / resistors.py
Last active April 17, 2022 02:05
Compute the equivalent impedance between two nodes.
from __future__ import annotations
from itertools import combinations
class Node:
components: set[Component]
num: int = 1
def __init__(self, components: set = None) -> None:
self.num = type(self).num
@Kenny2github
Kenny2github / generalized_exp.py
Created November 30, 2021 04:56
A Python implementation of the exponential function generalized to anything that supports Taylor series operations.
def exp(z, zero=None, one=None, equality=lambda a, b: a == b):
"""Raise e to the power of z.
z need only support the following:
- Addition with its own type
- Multiplication with its own type
- Multiplication with float
Provide ``zero`` if z - z != the zero of its type.
This function will probably not produce correct results
if this is the case, but it is provided for completeness.