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.
| /********************************************************************************* | |
| ** CIS 26B Extra Credit | |
| ** Advanced C | |
| ****************** | |
| Multi-dimensional Arrays | |
| Find a path of maximum value. |
| 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': |
| # 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: |
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
| """ | |
| Author : Noah Cardoza | |
| School : De Anza | |
| Class : MATH 22 | |
| Useage : python rabbit.py <number-of-months> | |
| """ | |
| from argparse import ArgumentParser | |
| from tabulate import tabulate |
| 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 |
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.
| #!/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 |