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 / getOpenTabs.sh
Last active March 21, 2024 10:16
[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
@NoahCardoza
NoahCardoza / README.md
Last active March 12, 2024 22:25
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 / 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:
@NoahCardoza
NoahCardoza / HTTPAndHTTPSServer.py
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
NoahCardoza / README.md
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
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.