RagingHungryPanda

joined 2 years ago
[–] RagingHungryPanda@lemm.ee 10 points 1 month ago (1 children)

As one user posted, the best way is to do them manually. Proton has a spam filter, but their whole thing is not reading your email.

[–] RagingHungryPanda@lemm.ee 3 points 1 month ago (1 children)

I think the background choice is fine, it's not like she has to ditch the tech because she left the city or anything. Just going a stroll, watching for bears.

I like the piece! I never heard of that game though. Sounds fun!

[–] RagingHungryPanda@lemm.ee 16 points 1 month ago

I love the old guy they quoted: we built tunnels to hide from the Americans, building one for a train shouldn't be hard! 🤣

Back in my day, we dug them out by hand, had no light, and had to haul the dirt back ourselves! You kids have it too easy!

[–] RagingHungryPanda@lemm.ee 1 points 1 month ago

I'm way behind, but I'm trying to learn F#.

I'm using the library Combinatorics in dotnet, which I've used in the past, generate in this case every duplicating possibility of the operations. I the only optimization that I did was to use a function to concatenate numbers without converting to strings, but that didn't actually help much.

I have parser helpers that use ReadOnlySpans over strings to prevent unnecessary allocations. However, here I'm adding to a C# mutable list and then converting to an FSharp (linked) list, which this language is more familiar with. Not optimal, but runtime was pretty good.

I'm not terribly good with F#, but I think I did ok for this challenge.

F#

// in another file:
let concatenateLong (a:Int64) (b:Int64) : Int64 =
    let rec countDigits (n:int64) =
        if n = 0 then 0
        else 1 + countDigits (n / (int64 10))   

    let bDigits = if b = 0 then 1 else countDigits b
    let multiplier = pown 10 bDigits |> int64
    a * multiplier + b

// challenge file
type Operation = {Total:Int64; Inputs:Int64 list }

let parse (s:ReadOnlySpan<char>) : Operation =
    let sep = s.IndexOf(':')
    let total = Int64.Parse(s.Slice(0, sep))
    let inputs = System.Collections.Generic.List<Int64>()
    let right:ReadOnlySpan<char> = s.Slice(sep + 1).Trim()

   // because the Split function on a span returns a SpanSplitEnumerator, which is a ref-struct and can only live on the stack, 
   // I can't use the F# list syntax here
    for range in right.Split(" ") do
        inputs.Add(Int64.Parse(sliceRange right range))
        
    {Total = total; Inputs = List.ofSeq(inputs) }

let part1Ops = [(+); (*)]

let execute ops input =
    input
    |> PSeq.choose (fun op ->
        let total = op.Total
        let inputs = op.Inputs
        let variations = Variations(ops, inputs.Length - 1, GenerateOption.WithRepetition)
        variations
        |> Seq.tryFind (fun v ->
            let calcTotal = (inputs[0], inputs[1..], List.ofSeq(v)) |||> List.fold2 (fun acc n f -> f acc n) 
            calcTotal = total
            )
        |> Option.map(fun _ -> total)
        )
    |> PSeq.fold (fun acc n -> acc + n) 0L

let part1 input =
    (read input parse)
    |> execute part1Ops

let part2Ops = [(+); (*); concatenateLong]

let part2 input = (read input parse) |> execute part2Ops

The Gen0 garbage collection looks absurd, but Gen0 is generally considered "free".

Method Mean Error StdDev Gen0 Gen1 Allocated
Part1 19.20 ms 0.372 ms 0.545 ms 17843.7500 156.2500 106.55 MB
Part2 17.94 ms 0.355 ms 0.878 ms 17843.7500 156.2500 106.55 MB

V2 - concatenate numbers did little for the runtime, but did help with Gen1 garbage, but not the overall allocation.

Method Mean Error StdDev Gen0 Gen1 Allocated
Part1 17.34 ms 0.342 ms 0.336 ms 17843.7500 125.0000 106.55 MB
Part2 17.24 ms 0.323 ms 0.270 ms 17843.7500 93.7500 106.55 MB
[–] RagingHungryPanda@lemm.ee 1 points 1 month ago (1 children)

I'm way behind in AoC this year, but I thought I'd give some feedback. I haven't used gleam, but I'm using F# and this looks quite similar:

let new_pos = case guard.direction {
    North -> #(-1, 0)
    East -> #(0, 1)
    South -> #(1, 0)
    West -> #(0, -1)
  }

I never thought of doing that to change points. thumbs up!

Overall your approach looks good.

[–] RagingHungryPanda@lemm.ee 4 points 1 month ago

Hol' up a minute

[–] RagingHungryPanda@lemm.ee 8 points 1 month ago (1 children)

Oh this is actually a real thing I was rolling my eyes like "just show me the clicks and clucks in the code"

[–] RagingHungryPanda@lemm.ee 4 points 1 month ago

It was managed, just not for his benefit

[–] RagingHungryPanda@lemm.ee 4 points 1 month ago

(╯°□°)╯︵ ┻━┻

[–] RagingHungryPanda@lemm.ee 9 points 1 month ago (2 children)

I don't really understand people saying it's not part of the lore. I did the expansions and everything. I got the ending, assuming that I remember correctly, where Ciri becomes a witcher. And in the expansions, Geralt just wanted to retire on a mountain vineyard in not-France.

One thing I was thinking of with the announcement is what would they do with the witcher powers, but from the electric punch in the preview, my guess is they're going to expand her psychic powers to take the place of witcher powers.

I'm looking foward to it. It looks kick ass.

Also - are there actually as many compaints as people make it out to be? Like I've never met anyone in real life who didn't like that a game featured a woman.

[–] RagingHungryPanda@lemm.ee 10 points 1 month ago (1 children)

Nobody who says this has ever given housing to the poor or kept a poor family fed. Also, nice use of equating a conquering empire to your own government, as if those were anything closely equal.

I'll do Jesus' principals with my actions. You can stick to your platitudes.

[–] RagingHungryPanda@lemm.ee 78 points 1 month ago

Nitpick: eminent domain is not the means for publicizing a company, that's for land for public works

 

Edit: trying to figure out the spoiler tag...sorry

Edit 2: I tried three ways and nothing worked, but spoilers below

I've run into a lot of times where needed things don't trigger bc I'm hiding

spoiler hag

! For example, when rescuing Mayrina the first time, I snuck past them and tried to talk to her, which triggered the cutscenes and hag transformation.

Combat was supposed to start, but didn't. So I went into the fireplace thinking that was a good escape route and into the lair, where she, in hag form, told me I shouldn't be sneaking around and to leave, but with the normal lady's voice.

Then, when rescuing from the cage, I used the druids thorn whip to yang Mayrina down. Combat triggered and she acting like she was still in the cage instead of running through the open door behind us.

I tried a second time and she ran through, but disappeared. When I went back, she was outside the cage. I thought she was the hag bc she had 0 damage, so I cast blindness on her and she ran...somewhere.

Also, the hag never rendered, but I could see her vision outline.

Anyway, now I think I actually have to fight the hag. I read something about a water trick, so I'll try that was well.

But jeez, with all the warnings to run away from a hag, I thought I'd be able to do that.

Of course leaving an angry hag alive is no good, so 🤷‍♂️!<

 

This is a feature that I miss, along with attachments on calendar events. I was thinking of building something myself using NLP and NER to read an email and extract calendar details from it, but I'd need access to an API to be able to do that and the API is no longer public. Is there any way to either get access to these APIs or some other workaround for this?

 

I noticed my battery drained really quickly since getting proton mail, but the energy use in Androids battery report would only show a few percent. I went from being able to go w whole day with plenty of battery left it having to charge once or twice a day. I turned off the background email loading and my battery levels are back to normal.

 

Hey there! I recently got server banned b/c I was sharing a link in men's communities and I was mistaken for a bot.

I didn't have a way to respond to the ban. I was just logged out. I didn't see a link or even which mod did the ban so that I could reply to them, but then I couldn't get into my account to reply anyway.

It'd be nice to maybe get a "if you think this was in error" email or something.

Although I know that if lemmy was the size of reddit, people would hook that email up to chatgpt, so :/

Anyway, it'd be a nice feature to have. I doubt I'll need it again, but I was quite confused as to what to do.

 

From my friend: men are lonely and no one is doing anything about it, so I want to do something about it.

dudefriends.com

 

I've tried a few times and resorted to leaving a link. Is there a better way, alternative, or a Lemmy version of imgur or something?

I mainly use the Sync app.

view more: ‹ prev next ›