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

Can you link it? I’d like to listen.

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

Ruby

!ruby@programming.dev [LANGUAGE: Ruby]

I found today really easy thankfully. Hardest part was remembering the language features haha

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

edit: code golfing this one was easy too! man this day really worked out huh

    def get_subsequent_reading(reading)
      puts "passed in readings #{reading}"
      if reading.all?(0)
        reading << 0
      else
        readings = reading.each_cons(2).map do |a, b|
          b - a
        end
        sub_reading = get_subsequent_reading(readings)
        reading << (reading[-1] + sub_reading[-1])
        puts "current reading #{reading}"
        reading
      end
    end
    
    execute(1) do |lines|
      lines.map do |reading|
        get_subsequent_reading(reading.split.map(&:to_i))
      end.map {|arr| arr[-1]}.sum
    end
    
    
    def get_preceeding_readings(reading)
      puts "passed in readings #{reading}"
      if reading.all?(0)
        reading.unshift(0)
      else
        readings = reading.each_cons(2).map do |a, b|
          b - a
        end
        sub_reading = get_preceeding_readings(readings)
        reading.unshift(reading[0] - sub_reading[0])
        puts "current reading #{readings} #{sub_reading}"
        reading
      end
    end
    
    
    execute(2, test_only: false, test_file_suffix: '') do |lines|
      lines.map do |reading|
        get_preceeding_readings(reading.split.map(&:to_i))
      end.map {|arr| arr[0]}.sum
    end

code golf

  a=->r{r.unshift(r.all?(0)?0:(r[0]-a[r.each_cons(2).map{_2-_1}][0]))}
  l.map{a[_1.split.map(&:to_i)]}.map{_1[0]}.sum
[-] snowe@programming.dev 4 points 2 years ago

My wife works in the industry, they do not refer to petroleum as gasoline until it is all the way downstream. Gas always refers to natural gas at the midstream point. If you are an end consumer then you have natural gas, gasoline, and diesel.

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

Oh no I have to mod a config file to make it do what I want…why can’t the devs just read my mind???

nobody has to read anyone's fucking mind, why can't you just make it a fucking settings menu? You're the ones making it HARDER TO EVANGELIZE FOSS. For fuck's sake! You're entirely missing the point!

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

I making a point that you seem to be missing. If you have to point out some way to get around a problem that any given user will have with a piece of software, then that’s why your software is not being used. This is the continual problem with the Linux community, they think that everyone wants to learn this stuff. Most people just want their software to work. They don’t want to have to do any sort of googling to figure out why it’s crashing or why it’s running slow or why it doesn’t have this or that feature. Every time someone like you tries to point out that someone can just google something you lose another person that may have been willing to use FOSS in the future. Instead, maybe go try to fix their problem because they sure as hell aren’t going to.

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

Ruby

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

Second part was soooo much easier today than yesterday. Helps I solved it exactly how he wanted you to solve it I think.

I'm going to work on some code golf now.

Golfed P2 down to 133 characters:

p g.map{_1.sub!(/.*:/,'')
m=Hash.new(0)
_1.split(?;){|r|r.split(?,){|a|b,c=a.split
m[c]=[m[c],b.to_i].max}}
m.values.reduce(&:*)}.sum
[-] snowe@programming.dev 4 points 2 years ago

I have an Ioniq 5 limited awd and the range is great. I don’t know what people are doing that they need 300+ miles of range every day, but it charges in minutes, overnight with a 120, and I haven’t once felt any range anxiety.

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

That’s funny because I switched off of plex to Jellyfin because of how bad the experience on plex was.

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

we're at like $48 a month for the main server, we have a staging server at about $6 a month, the domain is quite expensive, $580 or something for the first year, $427 for the following years. Email is $35 a month, but we had a snafu with it so we had actually gone with a different provider and that was $20 for 3 months. We also have cloudflare and I expect I'll need to set up CSAM protection eventually but that will be a bit of money too, so I'm working on getting a donation box set up first and then we'll move on with that.

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

Ha, yes I did that in the first post ever 😜 https://programming.dev/post/1

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

I plan on setting up something, but as of right now, they're not something I'm worrying about! Thank you! When we do add something, we'll make a post and put the link in the main sidebar.

view more: ‹ prev next ›

snowe

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