advent of code day 1 complete

This commit is contained in:
ImAlpha 2023-12-12 16:48:52 -08:00
parent 988a24e208
commit f8a208a3a5
4 changed files with 1034 additions and 3 deletions

File diff suppressed because it is too large Load Diff

29
Advent_of_Code/2023/p1.py Normal file
View File

@ -0,0 +1,29 @@
import os
cwd = os.path.dirname(os.path.abspath(__file__))
file_name = 'advent2023_p1.txt'
# file_name = 'test.txt'
advent = os.path.join(cwd, file_name)
nums = []
values = []
with open(advent, 'r') as file:
for line in file:
for digit in line:
if digit.isdigit():
nums.append(digit)
if len(nums) < 2:
num_one = nums[0]
num_two = num_one
num_join = num_one + num_two
values.append(int(num_join))
else:
num_one = nums[0]
num_two = nums[-1]
num_join = num_one + num_two
values.append(int(num_join))
nums.clear()
# print(values)
print(sum(values))

View File

@ -15,6 +15,6 @@ DB_NAME="dev_db"
DB_URI="mysql://11lq0wcjbxyku4zmubji:pscale_pw_AyxGMWCMpaZOsaeeXXem8mrxXPRNJEG0uPUrW2zo1f8@aws.connect.psdb.cloud/dev_db?ssl={"rejectUnauthorized":true}" DB_URI="mysql://11lq0wcjbxyku4zmubji:pscale_pw_AyxGMWCMpaZOsaeeXXem8mrxXPRNJEG0uPUrW2zo1f8@aws.connect.psdb.cloud/dev_db?ssl={"rejectUnauthorized":true}"
ADMIN_EMAIL="Kevin@test.com" ADMIN_EMAIL="Kevin@test.com"
ADMIN_PWD="!Testingpwd123" ADMIN_PWD="!Testingpwd123"
NEXTAUTH_URL = "http://localhost:3000" NEXTAUTH_URL="http://localhost:3000/"
// Generate in Bash shell, with openssl rand -base64 32 // Generate in Bash shell, with openssl rand -base64 32
NEXTAUTH_SECRET="uM3+Q6lVz3l9tqaMKPVWmnY1r5tftjgxmFEi0/Z0+PA=" NEXTAUTH_SECRET="uM3+Q6lVz3l9tqaMKPVWmnY1r5tftjgxmFEi0/Z0+PA="

View File

@ -8,11 +8,13 @@ const LoginForm = () => {
const handleSubmit = async (e: FormEvent<HTMLFormElement>) => { const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault(); e.preventDefault();
const formData = new FormData(e.currentTarget); const formData = new FormData(e.currentTarget);
signIn("credentials", { const response = await signIn("credentials", {
email: formData.get("email"), email: formData.get("email"),
password: formData.get("password"), password: formData.get("password"),
redirect: false, redirect: false,
}); });
console.log({ response });
}; };
return ( return (
<div className="w-full h-full"> <div className="w-full h-full">