Acters

joined 2 years ago
[–] [email protected] 2 points 2 weeks ago* (last edited 2 weeks ago)

Don't listen to the haters but it would have been nice if you collapsed this because it is very long and generalized to the point that it is pretty much an eyesore. Plus most people can ask their AI of choosing semi-random topics. I don't see what was interesting in the AI response at all. It states some blatantly obvious facts and is rather too wordy. I intentionally include into the system prompt or "personalization" about how I like things to be kept short and to not reiterate what I had posted especially if it just sounds like the "AI" is thinking out loud.

[–] [email protected] 5 points 3 weeks ago (1 children)

I wish open to public DMs didn't exist. I hate them. I only get spam.

[–] [email protected] 7 points 3 weeks ago (2 children)

I usually ask AI to summarize it and then I get a pretty good idea of what it was meant to do. It's just another tool to me. AI generated code sucks but it's nice when it's a quick summary.

[–] [email protected] 1 points 3 weeks ago* (last edited 3 weeks ago)

I run a personal dnsmasq just for dns resolving/routing. It integrates well with Networkmanager. Easy to work with and very reliable to have the DNS resolution and routing be handled by dnsmasq. Single command to reload NetworkManager which also reloads the integrated dnsmasq. I like it and it offers a lot of control for me. I hate having to use the hosts file for when I am connecting to labs via VPN with their own network. dnsmasq is way better at handling subdomains than the hosts file and it feels way more reliable than just hoping the minimal DNS routing system works properly.

[–] [email protected] 1 points 3 weeks ago

You should try to min-max your weekend but instead shift what your expectations are for the min-max. Planning ahead of the weekend is good to reduce anxiety over what you are doing at each minute of the weekend. You plan it out and stick to it. If something comes up that fucks the plan up, then simply it was just not meant to be. Do plan out moments where you are resting too, because if you are planning to do tasks, then you should plan when there is a clear time to rest. Usually tasks happen between times of rest. So plan those rest times accordingly, as those are the only moments when your body can repair and do what it needs to do to keep you healthy. Good luck

[–] [email protected] 4 points 4 weeks ago* (last edited 4 weeks ago)

there is one separating detail that is not shared between most of us. It really depends on how long that tenant lives there. if they are living there for a long period of time and like the place, then yes you are a leech, but a good one since they enjoy living there enough to stay. On the other hand, if you switch tenants often because of high rent costs or bad housing(maintenance included), then you are just simply a leech and not a good one because you are not even providing anything, you instead are holding the property that is simply rotting away with no way for the family holding it to be able to make changes or work towards making it better as they don't own it. If they leave for other reasons outside of your control, then you are not a leech and provided good housing for someone.

Since this isn't usually known by most and takes time to build that moral ideal, it is usually up to you to consider how to act and there is not really an incentive or demand for you to act morally good. Your current living arrangements, life choices and poor job market is not applicable here, you held a home and still operate on living on someone's paycheck. I hope the best for you and anyone who might be put in a bad spot, I know I am in my own bad spot. Would I try to hold myself to a moral high ground? maybe, though pain is short and I will likely still act not morally good at times, though I am not going to consider myself otherwise but a leech if I do. I would rather make sure I can get new tenants by making sure I get the current one is able to get one that is better or their own property, and help someone new with housing. That is what I think a good landlord could do but if the family likes the house then I can help them afford to buy it off me. See it is just business.

That is only for leeching aspects. I bet there are more complex thinking involved but this is what I think who a financial/real state leech is.

[–] [email protected] 2 points 1 month ago

Ah the chaos theory reasoning. There can't be anything perfect when thinking about it as a whole but you can find sections in a diversified area that are mostly perfect at some point in time but nothing ever lasts.

[–] [email protected] 1 points 1 month ago

I don't even use votes, it's a system that breeds self satisfaction. Unhealthy thoughts and feelings too

[–] [email protected] 1 points 1 month ago

And yet I still believe there were kids who had good tasting vegetables. I already agreed that some didn't but the ones who did? It was still common for kids to not step up and learn. Oh well, how about I just accept whatever you say but not actually believe your narrow view of life?

[–] [email protected] 1 points 1 month ago (2 children)

Fr I don't think you want to think about it much past the surface level. I agree to some points but not the myth that kids all kids can't taste good vegetables at all. Conversation ran it's course, I don't mind. It is what it is. I believe differently.

[–] [email protected] 1 points 1 month ago

I guess, but really I had some bad habits and didn't know how to make anything more than simple dishes like spaghetti and meatballs. Salads seemed like way too much effort until you get the proper technique to chop them up. I understand what you mean but I still wish I had learned it as a kid. The muscle memory/technique to hone in on would have been nice before I became an adult and had to rely on eating out or eating random stuff at home because I also never learned to plan out meals properly. I guess there is more to it than cooking is what I am saying.

 

hi I know this is a year old, but I solved it and used a custom implementation of binary search to solve this.
interestingly enough, in python at least, it is almost as performant as the quadratic equation for solving this lol (43.7 microseconds vs 64.9 microseconds) but now that I realized it is a simple parabola, you can just get the maximum after getting the minimum time and practically matches the quadratic equation performance. lol I know the math is faster as search space grows but I still think its interesting how performant this was.

TLDR: I'm so data structures and programming pilled that I forgot basic algebra.

code

from os.path import dirname,realpath,join

def profiler(method):
    from time import perf_counter_ns
    def wrapper_method(*args: any, **kwargs: any) -> any:
        start_time = perf_counter_ns()
        ret = method(*args, **kwargs)
        stop_time = perf_counter_ns() - start_time
        time_len = min(9, ((len(str(stop_time))-1)//3)*3)
        time_conversion = {9: 'seconds', 6: 'milliseconds', 3: 'microseconds', 0: 'nanoseconds'}
        print(f"Method {method.__name__} took : {stop_time / (10**time_len)} {time_conversion[time_len]}")
        return ret
    return wrapper_method

def binary_search(low_point, high_point, record_distance,record_time,min_or_max):
    if min_or_max == 'min':
        # custom binary search algorithm for minimum charge time to surpass the target distance
        while low_point < high_point:
            mid = (low_point + high_point)//2
            if ((record_time - mid) * mid) > record_distance:
                # if it is valid then we mark it as the high_point and continue searching
                high_point = mid
            else:
                # if it is not valid then we check if the next number up is valid and that should be the minimum time
                if ((record_time - mid + 1) * (mid + 1)) > record_distance:
                    return mid + 1
                # else we continue searching
                low_point = mid + 1
    elif min_or_max == 'max':
        # custom binary search algorithm for maximum charge time to surpass the target distance
        while low_point < high_point:
            mid = -((low_point + high_point)//-2) # math trick to do ceiling division
            if ((record_time - mid) * mid) > record_distance:
                low_point = mid
            else:
                # if it is not valid then we check if the next number down is valid and that should be the maximum time
                if ((record_time - mid + 1) * (mid + 1)) > record_distance:
                    return mid - 1
                # else we continue searching
                high_point = mid - 1

@profiler
def solver(input_str: str) -> tuple[int,int]:
    part_1_solve = 1
    for record_time,record_distance in zip( *[ [ int(number) for number in line.split()[1:] ] for line in input_str.split('\n') ] ):
        minimum_time = binary_search(0,record_time//2,record_distance,record_time,'min')
        # maximum_time = binary_search(record_time//2,record_time,record_distance,record_time,'max') # before I realized it was parabola lmao
        maximum_time = record_time - minimum_time
        part_1_solve *= maximum_time - minimum_time + 1

    # part 2
    # instead of splitting the numbers into multiple pairs, we will just remove the spaces and have one pair of numbers for time and distance.
    record_time,record_distance = [ int(line.replace(' ', '').split(':')[1]) for line in input_str.split('\n') ]
    minimum_time = binary_search(0,record_time//2,record_distance,record_time,'min')
    # maximum_time = binary_search(record_time//2,record_time,record_distance,record_time,'max') # before I realized it was parabola lmao
    maximum_time = record_time - minimum_time
    part_2_solve = maximum_time - minimum_time + 1

    return part_1_solve,part_2_solve

if __name__ == "__main__":
    BASE_DIR = dirname(realpath(__file__))
    with open(join(BASE_DIR, r'input'), 'r') as f:
        input_data = f.read().replace('\r', '').strip()
    result = solver(input_data)
    print("Part 1:", result[0], "\nPart 2:", result[1])

view more: next ›