Skip to content

Instantly share code, notes, and snippets.

View NoahCardoza's full-sized avatar
🦾
Harvester v3

Noah Cardoza NoahCardoza

🦾
Harvester v3
View GitHub Profile
@NoahCardoza
NoahCardoza / README.md
Last active April 12, 2026 05:58
Discord: Spotify Pause Blocker

Spotify Pause Blocker

Disclaimer

I love both of you Discord and Spotify, but this new 30 seccond rule gets pretty annoying when my music gets turned off while just talking "to much." I mean talking kind of is the whole point of Discord...

Reason

@NoahCardoza
NoahCardoza / README.md
Created June 15, 2025 22:11
Pin Poetry Package Versions

Poetry Pin Versions

This script will take the versions from the current lock file and pin them in the pyproject.toml file. This will keep new versions from being installed if for some reason you need to rebuild the poetry.lock file and gives you more control when upgrading packages to ensure the build isn't broken.

Usage

pip install toml
@NoahCardoza
NoahCardoza / benchmark.jsx
Created March 14, 2025 21:42
tss/makeStyles vs MUI sx prop
import React, { useState, useEffect } from 'react';
import { createRoot } from 'react-dom/client';
import { Box, Button, Typography, Paper } from '@mui/material';
import { makeStyles } from 'tss-react/mui';
import { Profiler } from 'react';
import { sum } from 'lodash';
// Number of components to render in each test
const COMPONENT_COUNT = 1000;
// Number of update cycles to run
@NoahCardoza
NoahCardoza / getOpenTabs.sh
Last active March 4, 2025 22:33
[OSX] Lists the URLs of all the open tabs in a specified browser.
#!/bin/bash
# args: browser
# example: ./getOpenTabs.sh "Brave Browser"
# credits:
# https://gist.github.com/samyk/65c12468686707b388ec43710430a421
# TODO:
# validate args
# don't open app if not already open

This script helps migrate older projects from Pipenv to Poetry without installing new versions of your libraries.

The pipenv-poetry-migrate utility is great, but it doesn't migrate the lock file. This script reads the lock file and pins the versions so you can safely poetry install without getting newer versions of the libraries.

Once you've run the script, verify the contents of pyproject.toml.tmp and if it checks out, replace the original pyproject.toml with mv pyproject.toml.tmp pyproject.toml.

Make sure to install the toml library before running this script.

@NoahCardoza
NoahCardoza / gcd.py
Last active June 3, 2022 17:34
Greatest Common Denominator
from tabulate import tabulate
def linear_gcd(a, b):
table_cols = []
(a0, s, t) = (a, 1, 0)
(b0, u, v) = (b, 0, 1)
remainder = quotient = new_u = new_v = None
@NoahCardoza
NoahCardoza / rabbit.py
Last active May 15, 2022 21:12
Recursive Algorithm Modeling The Population Growth Of A Fluffle
"""
Author : Noah Cardoza
School : De Anza
Class : MATH 22
Useage : python rabbit.py <number-of-months>
"""
from argparse import ArgumentParser
from tabulate import tabulate
@NoahCardoza
NoahCardoza / README.md
Last active March 6, 2022 04:35
Easily manipulate a Postgres backup file inside a Docker container.

pg_quick_recover

Ran into an issue where I needed to access a Postgres backup today. To my dismay I realized it was compressed and could only be accessed by importing it into a Postgres database. After fumbleing around for about 20 minutes setting one up, I decided I never wanted to do it again.

TL;DR

Put this in your PATH and use it (pg_quick_recover backup.sql.db) to quickly spin

@NoahCardoza
NoahCardoza / README.md
Created August 6, 2021 18:19
Canvas: Normalize CSS

Normalize CSS

I once had a teacher that couldn't help but use a lot of bold text and awful colors for every announcement.

This seemed to help.

@NoahCardoza
NoahCardoza / split_path.py
Created September 21, 2020 00:50
Python: split_path
# Author: noahcardoza@gmail.com
from os import path
def split_path(location):
"""splits the path into a tuple of all it's parts using recursion"""
head, tail = path.split(location)
if tail: