[-] snowe@programming.dev 3 points 10 months ago

Sorry for the silence. My years on the internet make me hesitant to claim I'll do something publicly until I'm already almost done. Else it's unlikely to get done and I'm then not keeping my word.

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

Man this would have been great to have read a day ago.

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

They’re saying you misspelled it.

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

That would be really strange if it was tied to Internet speed. I have a unifi setup and we have synchronous gigabit internet. Also both our gaming computers are wired so they normally get 800-1000mbps.

From what I can tell it’s literally just hl being badly optimized. There doesn’t seem to be any rhyme or reason

One thing I did discover is that you need at least 32gb of ram. It still stutters, but was less.

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

Ruby

!ruby@programming.dev

Somehow took way longer on the second part than the first part trying a recursive approach and then realizing that was dumb.

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

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

but how long is your commute? If I was to commute into my office it'd be around 42-50 miles round trip depending on which way I go. I'd plug in when I get home, and I'd literally never need to stop at a charging station. If I needed to travel more, I could simply charge while working at the office (plenty of L2 chargers in downtown denver parking garages). I think you'd have to have a round trip commute of over a hundred miles for it to be a problem, even then, you'd visit the charging station, sit there for 10 minutes, maybe less, and be ready to go for the next week.

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

Ruby

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

Part 1

execute(1, test_file_suffix: "p1") do |lines|
  lines.inject(0) do |acc, line|
    d = line.gsub(/\D/,'')
    acc += (d[0] + d[-1]).to_i
  end
end

Part 2

map = {
  "one": 1,
  "two": 2,
  "three": 3,
  "four": 4,
  "five": 5,
  "six": 6,
  "seven": 7,
  "eight": 8,
  "nine": 9,
}

execute(2) do |lines|
  lines.inject(0) do |acc, line|
    first_num = line.sub(/(one|two|three|four|five|six|seven|eight|nine)/) do |key|
      map[key.to_sym]
    end
    last_num = line.reverse.sub(/(enin|thgie|neves|xis|evif|ruof|eerht|owt|eno)/) do |key|
      map[key.reverse.to_sym]
    end

    d = first_num.chars.select { |num| numeric?(num) }
    e = last_num.chars.select { |num| numeric?(num) }
    acc += (d[0] + e[0]).to_i
  end
end

Then of course I also code golfed it, but didn't try very hard.

P1 Code Golf

execute(1, alternative_text: "Code Golf 60 bytes", test_file_suffix: "p1") do |lines|
  lines.inject(0){|a,l|d=l.gsub(/\D/,'');a+=(d[0]+d[-1]).to_i}
end

P2 Code Golf (ignore the formatting, I just didn't want to reformat to remove all the spaces, and it's easier to read this way.)

execute(1, alternative_text: "Code Golf 271 bytes", test_file_suffix: "p1") do |z|
  z.inject(0) { |a, l|
    w = %w(one two three four five six seven eight nine)
    x = w.join(?|)
    f = l.sub(/(#{x})/) { |k| map[k.to_sym] }
    g = l.reverse.sub(/(#{x.reverse})/) { |k| map[k.reverse.to_sym] }
    d = f.chars.select { |n| n.match?(/\d/) }
    e = g.chars.select { |n| n.match?(/\d/) }
    a += (d[0] + e[0]).to_i
  }
end
[-] snowe@programming.dev 3 points 2 years ago

well vscode isn't an IDE so not sure what that has to do with the question at all. You compared a GUI text editor with a console based text editor. Of course the console based text editor is faster.

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

Kagi is probably the paid one you have seen but it’s not open source. And it’s way better results. I make maybe 1 extra search for every 30 searches now compared to google where it was getting up to 3-5 extra searches every time I did a single search. Not sure of a better metric other than that.

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

huh? that's what I said.

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

I mean.. they're comic books. there's quite a few of them. but no, not a traditional "read the entire story" kind of book.

https://en.wikipedia.org/wiki/List_of_Calvin_and_Hobbes_books

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

Yeah it’s saved my bacon a bunch of times

view more: ‹ prev next ›

snowe

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