[-] snowe@programming.dev 2 points 2 years ago

You evidently had enough time to post elsewhere, so it's not unreasonable to think you might've read my reply already.

Evidently? Huh?

How is the WP article showing misinformation? It basically boils down to "Israel alleged something and provided some evidence, but we think it's not conclusive". It does not show that Israel knowingly lied about anything, which is what you're insinuating.

The article is literally about how Israel claimed a bunch of things as complete truths and then every single thing they claimed was wrong.

This has been the case for almost everything Israel has said until this point. They lied about hostages being raped, they lied about not going to bomb specific areas, they lied about certain areas being safe for Palestinians, they lied about only trying to kill hamas, and have killed over 20k civilians as a result, they lied about not actively trying to kill journalists. The list is endless. It’s perfectly clear that Israel is committing genocide against the Palestinians and if you support that, I’m sorry but you’re absolutely evil.

[-] snowe@programming.dev 2 points 2 years ago

Can’t tell if you’re joking…literally the entire run is a trick. Let’s see you make a single one of those jumps.

[-] snowe@programming.dev 2 points 2 years ago

You can help someone learn in a much nicer way than by making fun of their mistakes.

[-] snowe@programming.dev 2 points 2 years ago

Kagi is orders of magnitude better than DDG. I hated DDG results.

[-] snowe@programming.dev 2 points 2 years ago

My brother in law works as a biologist for a large processed food company and he has to measure and track all the different batches of food they process. According to him it’s the exact opposite, there are measurable amounts of pesticide in all of the non-organic foods they get in (apples, sweet potatoes, etc) and absolutely zero measurable amount of pesticides in the organic food they receive.

I used to think the same as you until hearing it from him that it’s an actual measurable difference and the exact opposite of what I thought.

[-] snowe@programming.dev 2 points 2 years ago

I don’t understand how you get the ai to mix two body types. I can’t even generate a decent dnd character because it absolutely doesn’t like generating anything other than human, even if I use specific dnd Lora’s along with control net

[-] snowe@programming.dev 2 points 2 years ago

@willya@lemmyf.uk was right, I only got notified about the tag after you commented it.

From my perspective, I want as little user information on my servers as possible. I'd need to think about it a little more, but initially I am slightly against using reddit oauth. I understand that we could reduce down the retrieved data, so I could be convinced, but also, we like to do polls of our users for these kinds of things, so I also wouldn't make a unilateral decision without a poll first.

[-] snowe@programming.dev 2 points 2 years ago

I meant tools like jq. I hardly ever use it as it’s hard to use and as a result I forget it making it even harder to use. The same applies to awk, sed, etc. Any tool with a bunch of command line flags and hard to understand arguments and syntax will always be low on my “want to use” list. Ripgrep is a prime example of how to build a command line app that is easy to use every time without trying to remember a billion things.

[-] snowe@programming.dev 2 points 2 years ago

how in the world are you getting top 1k with rust? sheesh!

[-] snowe@programming.dev 2 points 2 years ago

Ruby

!ruby@programming.dev

Man I did not understand how to solve this one (part 2, p1 was easy). After I understood it and looked at other people's solutions I was able to extend mine quite easily...

https://github.com/snowe2010/advent-of-code/blob/master/ruby_aoc/2023/day08/day08.rb

[-] snowe@programming.dev 2 points 2 years ago* (last edited 2 years ago)

Ruby

!ruby@programming.dev

https://github.com/snowe2010/advent-of-code/blob/master/ruby_aoc/2023/day07/day07.rb

Gonna clean it up now, but pretty simple at the end of it all. Helps that ruby has several methods to make this dead simple, like tally, any?, all?, and zip


Cleaned up solution:

def get_score(tally)
  vals = tally.values
  map = {
    ->(x) { x.any?(5) } => 7,
    ->(x) { x.any?(4) } => 6,
    ->(x) { x.any?(3) && x.any?(2) } => 5,
    ->(x) { x.any?(3) && tally.all? { |_, v| v != 2 } } => 4,
    ->(x) { x.count(2) == 2 } => 3,
    ->(x) { x.one?(2) && tally.all? { |_, v| v <= 2 } } => 2,
    ->(x) { x.all?(1) } => 1,
  }
  map.find { |lambda, _| lambda.call(vals) }[1]
end

def get_ranking(lines, score_map, scores)
  lines.zip(scores).to_h.sort do |a, b|
    a_line, a_score = a
    b_line, b_score = b
    if a_score == b_score
      a_hand, _ = a_line.split
      b_hand, _ = b_line.split
      diff = a_hand.chars.zip(b_hand.chars).drop_while { |a, b| a == b }[0]
      card_1 = score_map.index(diff[0])
      card_2 = score_map.index(diff[1])
      card_1 <=> card_2
    else
      a_score <=> b_score
    end
  end
end

def calculate_total_winnings(ranking)
  max_rank = ranking.size
  (1..max_rank).sum(0) do |rank|
    line = ranking[rank - 1]
    _, bid = line[0].split
    bid.to_i * rank
  end
end

score_map_p1 = %w[. . 2 3 4 5 6 7 8 9 T J Q K A]
score_map_p2 = %w[. . J 2 3 4 5 6 7 8 9 T Q K A]

execute(1) do |lines|
  scores = lines.map do |line|
    hand, _ = line.split
    tally = hand.split('').tally
    get_score tally
  end
  ranking = get_ranking(lines, score_map_p1, scores)
  calculate_total_winnings ranking
end

execute(2) do |lines|
  scores = lines.map do |line|
    hand, _ = line.split
    hand_split = hand.split('')
    tally = hand_split.tally
    if hand_split.any? { |c| c == 'J' }
      highest_non_j = tally.reject { |k, v| k == 'J' }.max_by { |k, v| v }
      if highest_non_j.nil?
        tally = { 'A': 5 }
      else
        tally[highest_non_j[0]] += tally['J']
      end
      tally.delete('J')
    end
    get_score tally
  end
  ranking = get_ranking(lines, score_map_p2, scores)
  calculate_total_winnings(ranking)
end
view more: ‹ prev next ›

snowe

0 post score
0 comment score
joined 3 years ago
MODERATOR OF