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

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 /
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 /
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 <number-of-months>
from argparse import ArgumentParser
from tabulate import tabulate
NoahCardoza /
Last active March 6, 2022 04:35
Easily manipulate a Postgres backup file inside a Docker container.


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.


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

NoahCardoza /
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 /
Created September 21, 2020 00:50
Python: split_path
# Author:
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:
NoahCardoza /
Last active September 14, 2020 09:52
An HTTP server that will handle both HTTP and HTTPS in Python 3
from http.server import HTTPServer
class HTTPAndHTTPSServer(HTTPServer):
def __init__(ssl_context, *args, **kwargs):
super().__init__(*args, **kwargs)
self.ssl_context = ssl_context
def get_request(self):
conn, addr = self.socket.accept()
if self.context and conn.recv(1, socket.MSG_PEEK) == b'\x16':
NoahCardoza /
Last active March 21, 2024 10:16
[OSX] Lists the URLs of all the open tabs in a specified browser.
# args: browser
# example: ./ "Brave Browser"
# credits:
# validate args
# don't open app if not already open
NoahCardoza /
Last active March 25, 2019 03:04
Advanced C - Extra Credit - Array of Strings and Files

Array of Strings and Files

Two Solutions to Problem 3, page 270 of Perry, John. "Advanced C Programming by Example" Belmont, CA: PWS Publishing, 1998.

The first copies the strings.

The second reuses the pointers in the array passes to it.

NoahCardoza / EC_Tables.c
Last active March 20, 2019 05:44
De Anza - CIS 26B Advanced C - Extra Credit - Tables
** CIS 26B Extra Credit
** Advanced C
Multi-dimensional Arrays
Find a path of maximum value.