hades

@hades@lemm.ee

This profile is from a federated server and may be incomplete. Browse more on the original instance.

hades,

This goes the other way too: don’t wave someone unless you’re completely sure it’s safe. I wish more driving schools actually taught things like this.

hades,

I’m not necessarily disagreeing with you, but that estimate could have been wrong by a factor of 10 easily. The idea of an “average video” being 50MB, for example, is questionable: at typical bitrates of 1080p videos this would amount to about a minute-long video. I don’t think that’s an average video at all. It also doesn’t account for many things, for example the cost of replicating new videos to the CDN.

I also don’t find the idea of YouTube not being profitable ridiculous or hilarious. YouTube definitely wasn’t profitable before monetisation, and Google used to run it for prestige and data collection purposes at a financial loss. They clearly have been trying to make it more profitable, but whether or not they have crossed the break-even point in the past or are still hoping to cross it in the future is not as clear to me as it is to you.

hades,

This, and Artemis too. Basically anything by Andy Weir at this point.

hades,

He did some short format writing, but The Martian was his first published novel, I think. He was a software engineer before that.

Artemis follows the same pattern of a capable main protagonist solving problems, so it is not very different from the other books in terms of characters, but it is much better in character depth and development than The Martian.

What are some of the weird/hilarious/stupid things that are legal in Germany but illegal in other countries (and vice versa)?

My buddy and I were discussing the allowed blood alcohol content for driving (purely hypothetically) and how it varies across countries and then we stumbled upon the question in the title. Would be curious to hear if you guys know any good examples.

hades,

It’s not criminal, but you would get points on your licence.

hades,

The same is true about escaping from the police car if they try to stop you. You’ll be charged for dangerous driving, but not for the pursuit itself.

hades,

There’s literally no general speed limit on the Autobahn. My car has winter tires right now and I’m legally required to have a small sticker on the dash that reminds me not to exceed their rated maximum speed of 230 km/h.

hades,

Despite this design, it is possible to write useful programs.

Interestingly, this applies to C++ too.

hades,

to be fair, the way it’s worded I can parse as “a language for web programming”, instead of “a programming language for the web”

You can only pick 2 games from steam to play for the rest of your life, what games are they? (sh.itjust.works)

I have a large library of steam games, but yet always come back to Garry mod and ravensfield. I keep coming back for the modded content and every other game is excellent, don’t get me wrong. But a lot of big games like RD2 and watchdogs 2 just seem like such a long time investment. What 2 games do you infinitely come back to?

hades,

Funny how there’s a solid lack of quadruple “A” games here in the comments.

hades,

[…] Sundar Pichai defended the layoffs and claimed that workers sometimes reach out to express gratitude for the cuts.

“It appeared that there had even been demonstrations to thank Big Brother for raising the chocolate ration to twenty grams a week.”

I've recently turned 20. What highly specific advice you, lemmy users, would offer me?

A lot of people answering this struggle to understand what highly-specific means. I’m looking to, for the sake of experiment, highly-specific advice that gives a reader clear understanding of what they should do. Unlike the vague advice, on the contrary, that may be too abstract to get implementing it right away....

hades,

Install GnuCash, learn accounting, and start tracking your money and use proper financial language. There is a lot of good financial advice out there (budgeting, investments, debt reduction), and all of that is much more efficient if a) you know where your money goes and where it comes from, b) you are proficient with financial software, and c) you can talk to the banks in their own language.

hades,

From my own standpoint I can understand how a certain amount of responsibility lies on him too. If I were handed something that looks like a gun or a knife, I would probably check to make sure it isn’t a real gun myself.

Especially in the US, where tragic accidental gun-related deaths and injuries happen every day.

hades,

My personal favourite is “blithering idiot”.

Loblaw backs away from plan to end 50% discount on food nearing best-before date (www.cbc.ca)

“We’ve listened to the feedback from our customers and colleagues and are reverting [where it existed before] to the 50 per cent off discounts,” the company, whose stores include Atlantic Superstore, No Frills, Dominion and Freshmart to name a few, told CBC News in an email on Friday....

hades,

OP, next time I have this, I’ll remember this meme, start laughing while choking, suffocate to death and it will be your fault.

hades,

Very nice! Could you tweak the colours a bit so they work in dark mode?

hades,

Fantastic, thanks!

hades, (edited )

Bathroom mirrors that don’t steam up after taking a shower.

Vending machines that are competent at accepting cash. Everywhere else that I’ve been to, you have to smoothen the bill and make sure it has no wrinkles or bended corners, and even then the machine would sometimes give you a hard time. In Japan, you just insert a stack (!) of bills, and the machine will count them within seconds, and also give you change in bills, and not a gazillion of coins.

Gates at the train stations are also better than everywhere else. You don’t have to wait for the person in front of you to pass the gate, you just insert your ticket and go. You also don’t need to look for arrows or notches or whatever on the ticket to insert it correctly.

Electric kettles that are very quiet and keep the water hot for a very long time.

Trains where all seats face the front, so you don’t have to sit against the direction of travel.

hades,

Plastic wrapping that’s easy to open.

hades,

Probably not. But life is full of minor inconveniences like that, and they do add up.

hades,

Python


<span style="color:#323232;">import networkx as nx
</span><span style="color:#323232;">
</span><span style="color:#323232;">from .solver import Solver
</span><span style="color:#323232;">
</span><span style="color:#323232;">
</span><span style="color:#323232;">class Day25(Solver):
</span><span style="color:#323232;">
</span><span style="color:#323232;">  def __init__(self):
</span><span style="color:#323232;">    super().__init__(25)
</span><span style="color:#323232;">
</span><span style="color:#323232;">  def presolve(self, input: str):
</span><span style="color:#323232;">    self.graph = nx.Graph()
</span><span style="color:#323232;">    for line in input.splitlines():
</span><span style="color:#323232;">      from_, to_line = line.split(': ')
</span><span style="color:#323232;">      for to in to_line.split(' '):
</span><span style="color:#323232;">        self.graph.add_edge(from_, to)
</span><span style="color:#323232;">
</span><span style="color:#323232;">  def solve_first_star(self) -> int | str:
</span><span style="color:#323232;">    cut_value, partition = nx.algorithms.stoer_wagner(self.graph)
</span><span style="color:#323232;">    return len(partition[0]) * len(partition[1])
</span>
hades,

Python


<span style="color:#323232;">import numpy as np
</span><span style="color:#323232;">import z3
</span><span style="color:#323232;">
</span><span style="color:#323232;">from aoc23.util import assert_full_match
</span><span style="color:#323232;">from .solver import Solver
</span><span style="color:#323232;">
</span><span style="color:#323232;">class Day24(Solver):
</span><span style="color:#323232;">
</span><span style="color:#323232;">  def __init__(self):
</span><span style="color:#323232;">    super().__init__(24)
</span><span style="color:#323232;">    self.test_area = [200000000000000, 400000000000000]
</span><span style="color:#323232;">  
</span><span style="color:#323232;">  def presolve(self, input: str):
</span><span style="color:#323232;">    self.stones = []
</span><span style="color:#323232;">    for line in input.splitlines():
</span><span style="color:#323232;">      (x, y, z, vx, vy, vz) = assert_full_match(
</span><span style="color:#323232;">        r'([0-9-]+), +([0-9-]+), +([0-9-]+) +@ +([0-9-]+), +([0-9-]+), +([0-9-]+)', line).groups()
</span><span style="color:#323232;">      self.stones.append((int(x), int(y), int(z), int(vx), int(vy), int(vz)))
</span><span style="color:#323232;">
</span><span style="color:#323232;">  def solve_first_star(self) -> int | str:
</span><span style="color:#323232;">    count = 0
</span><span style="color:#323232;">    for i, stone_a in enumerate(self.stones):
</span><span style="color:#323232;">      for stone_b in self.stones[i+1:]:
</span><span style="color:#323232;">        matrix = np.array([[stone_a[3], -stone_b[3]],
</span><span style="color:#323232;">                          [stone_a[4], -stone_b[4]],])
</span><span style="color:#323232;">        rhs = np.array([[stone_b[0] - stone_a[0]], [stone_b[1] - stone_a[1]]])
</span><span style="color:#323232;">        try:
</span><span style="color:#323232;">          x = np.linalg.solve(matrix, rhs)
</span><span style="color:#323232;">          if not (x > 0).all():
</span><span style="color:#323232;">            continue
</span><span style="color:#323232;">          intersection_x = stone_a[0] + stone_a[3] * x[0, 0]
</span><span style="color:#323232;">          intersection_y = stone_a[1] + stone_a[4] * x[0, 0]
</span><span style="color:#323232;">          if (self.test_area[0] <= intersection_x <= self.test_area[1]
</span><span style="color:#323232;">              and self.test_area[0] <= intersection_y <= self.test_area[1]):
</span><span style="color:#323232;">            count += 1
</span><span style="color:#323232;">        except np.linalg.LinAlgError:
</span><span style="color:#323232;">          continue
</span><span style="color:#323232;">    return count
</span><span style="color:#323232;">
</span><span style="color:#323232;">  def solve_second_star(self) -> int | str:
</span><span style="color:#323232;">    x0 = z3.Int('x0')
</span><span style="color:#323232;">    y0 = z3.Int('y0')
</span><span style="color:#323232;">    z0 = z3.Int('z0')
</span><span style="color:#323232;">    vx0 = z3.Int('vx0')
</span><span style="color:#323232;">    vy0 = z3.Int('vy0')
</span><span style="color:#323232;">    vz0 = z3.Int('vz0')
</span><span style="color:#323232;">    t1 = z3.Int('t1')
</span><span style="color:#323232;">    t2 = z3.Int('t2')
</span><span style="color:#323232;">    t3 = z3.Int('t3')
</span><span style="color:#323232;">    solver = z3.Solver()
</span><span style="color:#323232;">    solver.add(x0 + vx0 * t1 == self.stones[0][0] + self.stones[0][3] * t1)
</span><span style="color:#323232;">    solver.add(y0 + vy0 * t1 == self.stones[0][1] + self.stones[0][4] * t1)
</span><span style="color:#323232;">    solver.add(z0 + vz0 * t1 == self.stones[0][2] + self.stones[0][5] * t1)
</span><span style="color:#323232;">    solver.add(x0 + vx0 * t2 == self.stones[1][0] + self.stones[1][3] * t2)
</span><span style="color:#323232;">    solver.add(y0 + vy0 * t2 == self.stones[1][1] + self.stones[1][4] * t2)
</span><span style="color:#323232;">    solver.add(z0 + vz0 * t2 == self.stones[1][2] + self.stones[1][5] * t2)
</span><span style="color:#323232;">    solver.add(x0 + vx0 * t3 == self.stones[2][0] + self.stones[2][3] * t3)
</span><span style="color:#323232;">    solver.add(y0 + vy0 * t3 == self.stones[2][1] + self.stones[2][4] * t3)
</span><span style="color:#323232;">    solver.add(z0 + vz0 * t3 == self.stones[2][2] + self.stones[2][5] * t3)
</span><span style="color:#323232;">    assert solver.check() == z3.sat
</span><span style="color:#323232;">    model = solver.model()
</span><span style="color:#323232;">    return sum([model[x0].as_long(), model[y0].as_long(), model[z0].as_long()])
</span>
hades,

Python


<span style="color:#323232;">from .solver import Solver
</span><span style="color:#323232;">
</span><span style="color:#323232;">
</span><span style="color:#323232;">def _directions_from(char: str) -> list[tuple[int, int]]:
</span><span style="color:#323232;">  if char == '.':
</span><span style="color:#323232;">    return [(0, 1), (0, -1), (1, 0), (-1, 0)]
</span><span style="color:#323232;">  if char == 'v':
</span><span style="color:#323232;">    return [(1, 0)]
</span><span style="color:#323232;">  if char == '^':
</span><span style="color:#323232;">    return [(-1, 0)]
</span><span style="color:#323232;">  if char == '<':
</span><span style="color:#323232;">    return [(0, -1)]
</span><span style="color:#323232;">  if char == '>':
</span><span style="color:#323232;">    return [(0, 1)]
</span><span style="color:#323232;">  raise ValueError(f'unknown char: {char}')
</span><span style="color:#323232;">
</span><span style="color:#323232;">class Day23(Solver):
</span><span style="color:#323232;">  lines: list[str]
</span><span style="color:#323232;">
</span><span style="color:#323232;">  def __init__(self):
</span><span style="color:#323232;">    super().__init__(23)
</span><span style="color:#323232;">
</span><span style="color:#323232;">  def presolve(self, input: str):
</span><span style="color:#323232;">    self.lines = input.splitlines()
</span><span style="color:#323232;">
</span><span style="color:#323232;">  def _find_longest(self, current: tuple[int, int], visited: set[tuple[int, int]]) -> int|None:
</span><span style="color:#323232;">    i, j = current
</span><span style="color:#323232;">    if i == len(self.lines) - 1:
</span><span style="color:#323232;">      return 0
</span><span style="color:#323232;">    visited.add(current)
</span><span style="color:#323232;">    options = []
</span><span style="color:#323232;">    for di, dj in _directions_from(self.lines[i][j]):
</span><span style="color:#323232;">      ni, nj = i + di, j + dj
</span><span style="color:#323232;">      if ni < 0 or ni >= len(self.lines) or nj < 0 or nj >= len(self.lines[0]):
</span><span style="color:#323232;">        continue
</span><span style="color:#323232;">      if self.lines[ni][nj] == '#':
</span><span style="color:#323232;">        continue
</span><span style="color:#323232;">      if (ni, nj) in visited:
</span><span style="color:#323232;">        continue
</span><span style="color:#323232;">      result = self._find_longest((ni, nj), visited)
</span><span style="color:#323232;">      if result is not None:
</span><span style="color:#323232;">        options.append(result)
</span><span style="color:#323232;">    visited.remove(current)
</span><span style="color:#323232;">    if options:
</span><span style="color:#323232;">      return max(options) + 1
</span><span style="color:#323232;">    return None
</span><span style="color:#323232;">
</span><span style="color:#323232;">  def solve_first_star(self) -> int:
</span><span style="color:#323232;">    start_i = 0
</span><span style="color:#323232;">    start_j = self.lines[0].find('.')
</span><span style="color:#323232;">    result = self._find_longest((start_i, start_j), set())
</span><span style="color:#323232;">    assert result
</span><span style="color:#323232;">    return result
</span><span style="color:#323232;">
</span><span style="color:#323232;">  def _find_longest_2(self, current: tuple[int, int],
</span><span style="color:#323232;">                      connections: dict[tuple[int, int], list[tuple[int, int, int]]],
</span><span style="color:#323232;">                      visited: set[tuple[int, int]]) -> int|None:
</span><span style="color:#323232;">    i, j = current
</span><span style="color:#323232;">    if i == len(self.lines) - 1:
</span><span style="color:#323232;">      return 0
</span><span style="color:#323232;">    visited.add(current)
</span><span style="color:#323232;">    options = []
</span><span style="color:#323232;">    for ni, nj, length in connections[(i, j)]:
</span><span style="color:#323232;">      if (ni, nj) in visited:
</span><span style="color:#323232;">        continue
</span><span style="color:#323232;">      result = self._find_longest_2((ni, nj), connections, visited)
</span><span style="color:#323232;">      if result is not None:
</span><span style="color:#323232;">        options.append(result + length)
</span><span style="color:#323232;">    visited.remove(current)
</span><span style="color:#323232;">    if options:
</span><span style="color:#323232;">      return max(options)
</span><span style="color:#323232;">    return None
</span><span style="color:#323232;">
</span><span style="color:#323232;">  def solve_second_star(self) -> int:
</span><span style="color:#323232;">    start_i = 0
</span><span style="color:#323232;">    start_j = self.lines[0].find('.')
</span><span style="color:#323232;">
</span><span style="color:#323232;">    stack = [(start_i, start_j)]
</span><span style="color:#323232;">    connections = {}
</span><span style="color:#323232;">    visited = set()
</span><span style="color:#323232;">    while stack:
</span><span style="color:#323232;">      edge_i, edge_j = stack.pop()
</span><span style="color:#323232;">      i, j = edge_i, edge_j
</span><span style="color:#323232;">      path_length = 0
</span><span style="color:#323232;">      options = []
</span><span style="color:#323232;">      connections[(edge_i, edge_j)] = []
</span><span style="color:#323232;">      while True:
</span><span style="color:#323232;">        options = []
</span><span style="color:#323232;">        path_length += 1
</span><span style="color:#323232;">        visited.add((i, j))
</span><span style="color:#323232;">        for di, dj in ((0, 1), (0, -1), (1, 0), (-1, 0)):
</span><span style="color:#323232;">          ni, nj = i + di, j + dj
</span><span style="color:#323232;">          if ni < 0 or ni >= len(self.lines) or nj < 0 or nj >= len(self.lines[0]):
</span><span style="color:#323232;">            continue
</span><span style="color:#323232;">          if self.lines[ni][nj] == '#':
</span><span style="color:#323232;">            continue
</span><span style="color:#323232;">          if (ni, nj) in visited:
</span><span style="color:#323232;">            continue
</span><span style="color:#323232;">          options.append((ni, nj))
</span><span style="color:#323232;">        if len(options) == 1:
</span><span style="color:#323232;">          i, j = options[0]
</span><span style="color:#323232;">        else:
</span><span style="color:#323232;">          connections[(edge_i, edge_j)].append((i, j, path_length - 1))
</span><span style="color:#323232;">          break
</span><span style="color:#323232;">      connections[(i, j)] = [(ni, nj, 1) for ni, nj in options]
</span><span style="color:#323232;">      stack.extend(options)
</span><span style="color:#323232;">
</span><span style="color:#323232;">    connections_pairs = list(connections.items())
</span><span style="color:#323232;">    for (i, j), connected_nodes in connections_pairs:
</span><span style="color:#323232;">      for (ni, nj, d) in connected_nodes:
</span><span style="color:#323232;">        if (ni, nj) not in connections:
</span><span style="color:#323232;">          connections[(ni, nj)] = [(i, j, d)]
</span><span style="color:#323232;">        elif (i, j, d) not in connections[(ni, nj)]:
</span><span style="color:#323232;">          connections[(ni, nj)].append((i, j, d))
</span><span style="color:#323232;">
</span><span style="color:#323232;">    result = self._find_longest_2((start_i, start_j), connections, set())
</span><span style="color:#323232;">    assert result
</span><span style="color:#323232;">    return result
</span>
  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • tester
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • osvaldo12
  • ethstaker
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • ngwrru68w68
  • kavyap
  • GTA5RPClips
  • JUstTest
  • cisconetworking
  • InstantRegret
  • khanakhh
  • cubers
  • everett
  • Durango
  • tacticalgear
  • Leos
  • modclub
  • normalnudes
  • provamag3
  • anitta
  • lostlight
  • All magazines