Skip to content

Instantly share code, notes, and snippets.

View tbbooher's full-sized avatar

Tim Booher tbbooher

View GitHub Profile
import csv
import psycopg2
from dotenv import load_dotenv
import os
from datetime import datetime
from tqdm import tqdm
# Load environment variables from .env file
load_dotenv()
# Load required libraries
library(ggplot2)
library(ggforce)
library(gridExtra)
plot_laser_points <- function() {
plots <- vector("list", length = 9)
circle_radius <- 18 # Fixed circle radius of 18 mm
max_distance_from_center <- 10
@tbbooher
tbbooher / atm.py
Last active November 5, 2023 02:49
class ATM:
def __init__(self):
self._total_twenties = 0
self._total_fives = 0
def deposit_twenty(self, amount):
if amount > 0:
self._total_twenties += amount
return f"Deposited {amount * 20} dollars successfully."
else:
import pulp, csv
# Conversion factors
in_to_mm = 25.4 # 1 inch is 25.4 mm
# Define the stock boards as a list of tuples (description, length in mm, width in mm, cost)
# All lengths are converted to mm (1 ft = 12 in)
# Conversion factors
in_to_mm = 25.4 # 1 inch = 25.4 millimeters
@tbbooher
tbbooher / piggy.java
Created September 18, 2023 12:18
wrote two code examples, one in java the other in python
public class PigLatinConverter {
public static void main(String[] args) {
String inputSentence = "Hello world this is a test";
String pigLatinSentence = convertSentenceToPigLatin(inputSentence);
System.out.println("Original: " + inputSentence);
System.out.println("Pig Latin: " + pigLatinSentence);
}
public static String convertSentenceToPigLatin(String sentence) {
from __future__ import print_function
import base64
import os
import os.path
import sys
import email
import datetime
import pytz
import base64
import email
from __future__ import print_function
import base64
import os
import os.path
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
import sys
import matplotlib.pyplot as plt
import matplotlib.patches as patches
def first_fit_decreasing(pieces, plywood_width, plywood_length):
pieces = sorted(pieces, key=lambda x: x[0] * x[1], reverse=True)
bins = []
positions = []
for piece in pieces:
piece_placed = False
from bs4 import BeautifulSoup
import csv
import re
with open('edmunds.html', 'r') as f:
html = f.read()
soup = BeautifulSoup(html, 'html.parser')
results = []
from bs4 import BeautifulSoup
import csv
import re
with open('output.html', 'r') as f:
html = f.read()
soup = BeautifulSoup(html, 'html.parser')
results = []