Skip to content

Instantly share code, notes, and snippets.

View chadsten's full-sized avatar
💭
Facepalming at my own terrible code since 2005

Chadsten chadsten

💭
Facepalming at my own terrible code since 2005
  • Colorado
View GitHub Profile
@chadsten
chadsten / test.py
Last active September 26, 2023 18:17 — forked from BazingaThat/aocday1.py
AOC Day1
f = open("AOCDay1.txt", "r")
with open('AOCDay1.txt') as f:
elf_calories = [line.rstrip('\n') for line in f]
elves = []
i = 0
# we have to create the array element before we can add to it
elves.insert(i, '')
for elf in elf_calories:
see
with open("Day1_input.txt", "r") as f:
modules = [int(x) for x in f.readlines()]
#part 1
fuel = sum((y // 3 - 2) for y in modules)
print(fuel)
#3390596
#holyshit
#part 2
with open("Day1_input.txt", "r") as f:
modules = [int(x) for x in f.readlines()]
#part 1
fuel = sum((y // 3 - 2) for y in modules)
print(fuel)
#3390596
#holyshit
#part 2
9XCBT-WBXFR-5TRWJ-JJJ33-TX53Z - 1 Key
ZFKJ3-TT6FF-KTFKT-T3JJT-JWX36 - 1 Key
HXKBT-XJ6FR-WBRKJ-J3TTB-RSBHR - 1 Key
ZRWBJ-ST6XR-CBFKT-JT3J3-FRXJ5 - 1 Key
ZFKJ3-TT3BB-JTBJT-T3JJT-JWX9H - 3 Keys
Z65B3-JCXX6-5JXW3-3B33J-9SWT6 - 1 Key
EXPIRED
5SWBT-X93RW-HHRXB-JBJBB-T63JC
Month 1:
1. Intro to SQL for Data Science
2. Joining Data in SQL
3. Introduction to Relational Databases in SQL
4. Intermediate SQL
Challenge: https://adventofcode.com/2018/day/9 (Using SQL/T-SQL only)
<?php
function tag_sidebar(){
$taxonomy = 'product_cat';
$orderby = 'name';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title = '';
$empty = 0;
SELECT OD.PartNum AS OPN, QD.PartNum AS QPN, OD.OrderNum, OD.OrderLine, OD.QuoteNum, OD.QuoteLine
FROM Epicor10.erp.OrderHed AS OH
LEFT JOIN Epicor10.erp.OrderDtl AS OD ON OD.OrderNum = OH.OrderNum
RIGHT JOIN Epicor10.erp.QuoteDtl AS QD ON OD.QuoteNum = QD.QuoteNum AND OD.QuoteLine = QD.QuoteLine AND
SUBSTRING(OD.PartNum, PATINDEX('%[^0]%', OD.PartNum+'.'), LEN(OD.PartNum)) <> SUBSTRING(QD.PartNum, PATINDEX('%[^0]%', QD.PartNum+'.'), LEN(QD.PartNum))
WHERE OH.OrderDate > DATEADD(month, -24, GETDATE())
pum_mod2 <- function(conv_factor, value) {
mod <- 0
case_when(
value < conv_factor ~ mod <- ceiling(conv_factor - value),
value %% conv_factor != 0 ~ mod <- ceiling((value / conv_factor) * conv_factor - value),
)
return(mod)
}
SELECT EntryPerson, AVG((DATEDIFF(hh, ReceivedDate_c, DateTimeCreated_c) + CASE WHEN Datepart(dw, ReceivedDate_c) = 7 THEN 1 ELSE 0 END) - DATEDIFF(wk,
ReceivedDate_c, DateTimeCreated_c) * 2 - CASE WHEN Datepart(dw, ReceivedDate_c) = 1 THEN 1 ELSE 0 END + - CASE WHEN Datepart(dw, DateTimeCreated_c)
= 1 THEN 1 ELSE 0 END) AS Turnaround, CONVERT(DECIMAL(16, 2), 24) AS HoursInDay
FROM Epicor10.dbo.OrderHed
WHERE (ReceivedDate_c > DATEADD(month, - 3, GETDATE())) AND (ReceivedDate_c <= DateTimeCreated_c) AND (ReceivedDate_c IS NOT NULL) AND
(DateTimeCreated_c IS NOT NULL) AND (EntryPerson IN ('amberl', 'kaitlynn', 'cathys', 'jeffo', 'jamesh', 'keeleighc', 'morganp', 'michelled', 'jenellef', 'elviae', 'faitha',
'ronniel', 'johnh')) AND (DATEDIFF(dd, ReceivedDate_c, DateTimeCreated_c) < 30)
GROUP BY EntryPerson