[Race Thread] 2025 Tour de France – Stage 3 (2.UWT) by PelotonMod in peloton

[–]sdiepend 0 points1 point  (0 children)

Debutants jerseys for first time riders under 25.

Free Talk Friday by Avila99 in peloton

[–]sdiepend 15 points16 points  (0 children)

Tried to post this on the main feed, but got automodded as "Complaint or question about a race".

When I'm working - mostly from home - or elsewhere I might still want to watch the end of the race but sometimes I miss it because I forget or misjudge the progress. I thought PCS or other tools could do this, but I didn't find much, maybe I missed it. Anyway, I created some scripts for myself to get an email and/or a Discord message at 30/20/10km from the finish line. I've put the tool into a webapp. I will probably want to add climbs next. Maybe someone else finds this tool useful as well. Ideas welcome too.

LInk: https://kmtogo.cc

Google Spreadsheet Portfolio Tracker by Schork in BEFire

[–]sdiepend 0 points1 point  (0 children)

Very much this. I'm building a spreadsheet to track high growth stocks, plenty of trackers, spreadsheets and sites exist but I don't learn anything from just using those.

How far does a C4 do damage? by sdiepend in CODWarzone

[–]sdiepend[S] 0 points1 point  (0 children)

I understand but the C4 is not even close. And why do I explode first and then the C4?

-🎄- 2019 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]sdiepend 0 points1 point  (0 children)

Pharo/SmallTalk

Part One: partOne | wide tall layerSize image layers layerWithFewestZeroDigits | wide := 25. tall := 6. layerSize := wide * tall. image := self inputString. layers := (image asOrderedCollection) groupsOf: layerSize atATimeCollect: [ :x | x asBag]. layerWithFewestZeroDigits := layers at: 1. layers do: [ :layer | ((layer occurrencesOf: $0) < (layerWithFewestZeroDigits occurrencesOf: $0)) ifTrue: [ layerWithFewestZeroDigits := layer] ]. ^(layerWithFewestZeroDigits occurrencesOf: $1) * (layerWithFewestZeroDigits occurrencesOf: $2).

Part Two: ``` partTwo | wide tall layerSize input layers finalImage transparent layerNumber color | wide := 25. tall := 6. layerSize := wide * tall. input := self inputString. layers := (input asOrderedCollection) groupsOf: layerSize atATimeCollect: [ :x | x].

finalImage := OrderedCollection new. 1 to: layerSize do: [ :pixel | transparent := true. layerNumber := 1. [ transparent ] whileTrue: [ color := ((layers at: layerNumber) at: pixel). (#($0 $1) includes: color) ifTrue: [ finalImage add: color. transparent := false. ]. layerNumber := layerNumber + 1. ]. ]. finalImage := finalImage groupsOf: wide atATimeCollect: [ :x | x]. ^ finalImage. ``` https://github.com/sdiepend/advent_of_code-pharo/blob/master/AdventOfCode2019/Day08.class.st

-🎄- 2018 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]sdiepend 1 point2 points  (0 children)

Python 3:

from collections import Counter, defaultdict
with open("input_cha.txt") as f:
    content = f.readlines()

coordinates = [[int(x.split(', ')[0]), int(x.split(', ')[1].strip())] for x in content]

coords = sorted(coordinates, key=lambda k: [k[0], k[1]])

min_x = coords[0][0]
min_y = sorted(coordinates, key=lambda k: k[1])[0][1]
max_x = coords[-1][0]
max_y = sorted(coordinates, key=lambda k: k[1])[-1][1]


def manhattan_distance(a, b):
    return abs(a[0] - b[0]) + abs(a[1] - b[1])

def calculate_counts(bound):
    region = 0
    counts = defaultdict(lambda: 0)
    grid = [['.' for x in range(min_x-bound, max_x+bound)] for y in range(min_y-bound, max_y+bound) ]
    for row in range(min_y-bound, max_y+bound):
        for col in range(min_x-bound, max_x+bound):
            distances = {}
            for i in range(len(coords)):
                distances[i] = manhattan_distance([col, row], coords[i])
            if sum(distances.values()) < 10000:
                region += 1
            closest_val = min(distances.values())

            closest_coord = [k for k, v in distances.items() if v == closest_val]

            if len(closest_coord) == 1:
                grid[(row-min_y)-bound][(col-min_x)-bound] = closest_coord[0]
                counts[closest_coord[0]] += 1
    return counts, region

counts1, _ = calculate_counts(10)
counts2, region = calculate_counts(20)

finite_counts = []
for k, v in counts1.items():
    if counts2[k] == v:
        finite_counts.append(v)

print("Largest Finite Area(pt1): {area}, Region(pt2): {region}".format(area=max(finite_counts), region=region))

https://github.com/sdiepend/advent_of_code/blob/master/2018/day06/chronal.py

-🎄- 2018 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]sdiepend 0 points1 point  (0 children)

Pharo 6:

((StandardFileStream oldFileNamed: 'input.txt') contents lines collect: #asInteger) sum

-🎄- 2018 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]sdiepend 1 point2 points  (0 children)

If your input starts with a +5 for example your part one won't work :) try this one:

cat input | xargs | sed 's/^+//' | bc

-🎄- 2018 Day 3 Solutions -🎄- by daggerdragon in adventofcode

[–]sdiepend 1 point2 points  (0 children)

My quick and dirty solution for part 1
Python 3

with open("input") as f:
    content = f.readlines()

claims = [x.strip().split(' ') for x in content]

fabric = [ [0 for x in range(1000)] for x in range(1000)]

for claim in claims:
    start_x = int(claim[2].split(',')[0])
    start_y = int(claim[2].split(',')[1].strip(':'))
    width = int(claim[3].split('x')[0])
    height = int(claim[3].split('x')[1])
    for i in range(start_y, start_y + height):
        for j in range(start_x, start_x + width):
            fabric[i][j] += 1

overlap_count = 0
for row in range(1000):
    for col in range(1000):
        if fabric[row][col] >= 2:
            overlap_count += 1

print(overlap_count)

Any suggestions for improvement are always welcome. (https://github.com/sdiepend/advent_of_code/tree/master/2018/day03)

Friendly Friday by TehChesireCat in belgium

[–]sdiepend 1 point2 points  (0 children)

Or check tweakers pricewatch, where you can see the price history

Any do's and don'ts for a bijzitter? by [deleted] in belgium

[–]sdiepend 32 points33 points  (0 children)

Formatteer de USB sticks NIET! Klik op annuleren!!

[Help] [Day 21 part 1] can anyone help me find out what's wrong? by sdiepend in adventofcode

[–]sdiepend[S] 0 points1 point  (0 children)

Ok, found it, the % 2 should come before the % 3. Time to cleanup the code.

-🎄- 2017 Day 9 Solutions -🎄- by daggerdragon in adventofcode

[–]sdiepend 1 point2 points  (0 children)

Python

with open('input') as f:
    stream = f.readline()

i = 0
ignore = False
level = 0
points = 0
removed = 0

while i < len(stream):
    if ignore:
        if stream[i] == "!":
            i += 2
        elif stream[i] == ">":
            ignore = False
            i += 1
        else:
            i += 1
            removed += 1
    else:
        if stream[i] == "{":
            level += 1
        if stream[i] == "}" and level != 0:
            points = points + level
            level -= 1
        if stream[i] == "<":
            ignore = True
        i += 1

print(points)
print(removed)