ali's recent activity

  1. Comment on Day 3: Toboggan Trajectory in ~comp.advent_of_code

    ali
    Link
    I joined this a bit late (only today). I just finished all of them, now I am in the mood for more Part 1 and 2 in Python input = [line.rstrip() for line in open('input.txt')] input = input...

    I joined this a bit late (only today). I just finished all of them, now I am in the mood for more

    Part 1 and 2 in Python
    input = [line.rstrip() for line in open('input.txt')]
    
    input = input
    input_width = len(input[0])
    
    def slope(right,down):
        position = [0, 0]  # -> and  V
        tree_counter = 0
        while(position[1]+down < len(input)):
    
            position[0] += right
            position[1] += down
    
            tree = 1 if input[position[1]][position[0] % input_width] == '#' else 0
            # print(tree)
            tree_counter += tree
        return tree_counter
    
    paths = [(1,1),(3,1),(5,1),(7,1),(1,2)] # 3,1 is Part 1
    trees = 1
    for path in paths:
        result = slope(path[0],path[1])
        print(result)
        trees = trees* result
    
    
    print(trees)
    
    2 votes
  2. Comment on Day 2: Password Philosophy in ~comp.advent_of_code

    ali
    Link
    Python Solutions by using count. I love that this is possible in python: a <= b <= c Part 1 def part_1(input): invalid = 0 for line in input: rule,text = line.split(":") text = text.strip() count,...

    Python Solutions by using count.
    I love that this is possible in python:

    a <= b <= c

    Part 1
    def part_1(input):
        invalid = 0
        for line in input:
            rule,text = line.split(":")
            text = text.strip()
            count, character = rule.split(" ")
            lower_bound,upper_bound = count.split('-')
            if int(lower_bound) <= text.count(character) <= int(upper_bound):
                invalid+=1
        return invalid
    
    Part 2
    def part_2(input):
        invalid = 0
        for line in input:
            rule, text = line.split(":")
            text = text.strip()
            count, character = rule.split(" ")
            first_position, second_position = count.split('-')
            first = text[int(first_position)-1] == character
            second = text[int(second_position)-1] == character
            if first and not second or not first and second:
                invalid += 1
        return invalid
    
    2 votes
  3. Comment on Day 1: Report Repair in ~comp.advent_of_code

    ali
    (edited )
    Link
    Here's my Python solution. It's very fast ( 0.268495 milliseconds on my laptop) - but it uses a sort at the start Part 1 import time start = time.perf_counter_ns() f = open("input.txt", "r") input...
    Here's my Python solution. It's very fast ( 0.268495 milliseconds on my laptop) - but it uses a sort at the start Part 1
    import time
    start = time.perf_counter_ns()
    
    
    f = open("input.txt", "r")
    input = f.readlines()
    input_arr = [int(i) for i in input]
    input_arr.sort()
    i = 0
    j = len(input_arr)-1
    while i<j:
        left_number = input_arr[i]
        right_number = input_arr[j]
        result = left_number+right_number
        if result == 2020:
            # result
            print(left_number*right_number)
            break
        elif result < 2020:
            i+=1
        elif result > 2020:
            j-=1
    
    end = time.perf_counter_ns()
    duration = (end - start) / 1_000_000
    print(f' {duration:.06f} milliseconds')
    
    I didn't realize there was a part 2 and I have to work a bit so I just brute forced it Part 1 ```python def prob_2(input_arr): for i in input_arr: for j in input_arr[1:]: for k in input_arr[2:]: if i+j+k == 2020: return i*j*k ```
    2 votes
  4. Comment on Day 1: Report Repair in ~comp.advent_of_code

    ali
    Link Parent
    that @timer stuff looks really cool I should look into that. I code tons of python for my AI nowadays but my coding interviews usually were always in python. I knew this type of problem and I...

    that @timer stuff looks really cool I should look into that. I code tons of python for my AI nowadays but my coding interviews usually were always in python.
    I knew this type of problem and I tried it using a sort and then going through the array from both ends

    Using your timer code it takes 0.386325 milliseconds. And your solution takes about the same amount of time for me

    brute_force: 654.206014 milliseconds
    better: 4.215089 milliseconds

    are you also using a macbook pro 2017?

    heres my solution: https://tildes.net/~comp.advent_of_code/to5/day_1_report_repair#comment-5x8u

    2 votes
  5. Comment on Apple MacBook iFixit teardowns: something old, something new in ~tech

    ali
    Link Parent
    The phrasing also confused me, but my fans did get very dusty. I opened them for the first time in 3 years last week and they were super dusty, i am not sure how big of a difference it makes, but...

    The phrasing also confused me, but my fans did get very dusty. I opened them for the first time in 3 years last week and they were super dusty, i am not sure how big of a difference it makes, but my place is pretty dusty in general

    4 votes
  6. Comment on YouTube can now place ads on all videos even if creators don’t want them in ~tech

    ali
    Link Parent
    I bit the bullet and went for this. Currently I am in the student plan. The single person plan is quite steep and the family plan is actually crazy compared to Netflix, but if it’s shared I guess...

    I bit the bullet and went for this. Currently I am in the student plan. The single person plan is quite steep and the family plan is actually crazy compared to Netflix, but if it’s shared I guess it’s fine. It’s getting to the point where I am splitting like 100 bucks a month with my family between Netflix, Spotify, iCloud, Disney plus

    3 votes
  7. Comment on Talking about video ads will also mess up uBlock? in ~test

    ali
    Link Parent
    Funny, I had the same issue with a content blocker yesterday on my phone blocking another thread here. I turned of content blockers for this site so I didn’t notice but this and...
    • Exemplary

    Funny, I had the same issue with a content blocker yesterday on my phone blocking another thread here.

    I turned of content blockers for this site so I didn’t notice but this and https://tildes.net/~test/tes/youtube_will_now_show_ads_on_all_videos_even_if_creators_dont_want_them

    Were both blocked on my phone, too

    1 vote
  8. Comment on YouTube can now place ads on all videos even if creators don’t want them in ~tech

    ali
    Link Parent
    The only time I see ads now is when I’m casting and my girlfriend adds a video to the queue. It’s pretty annoying to see that... especially because it is before every video she plays.

    The only time I see ads now is when I’m casting and my girlfriend adds a video to the queue. It’s pretty annoying to see that... especially because it is before every video she plays.

    1 vote
  9. Comment on Google Photos will no longer have unlimited free storage after June 1 in ~tech

    ali
    Link Parent
    What did you use for deduplication?

    What did you use for deduplication?

    2 votes
  10. Comment on What's something you don't understand the appeal of? in ~talk

    ali
    Link Parent
    I often watch games because I find games entertaining but I might be busy or only have a few minutes - no point in starting a game if I have to do other stuff in 5 min and i like background Noise...

    I often watch games because I find games entertaining but I might be busy or only have a few minutes - no point in starting a game if I have to do other stuff in 5 min and i like background Noise when I work or fall asleep

    3 votes
  11. Comment on Stadia offering a free Premiere Edition bundle for US YouTube Premium members in ~games

    ali
    Link Parent
    My pi hole did not block YouTube ads on my iPhone/chromecast

    My pi hole did not block YouTube ads on my iPhone/chromecast

    2 votes
  12. Comment on Introducing the next generation of Mac - A new MacBook Air, 13-inch MacBook Pro, and Mac mini powered by M1, Apple’s chip designed specifically for the Mac in ~tech

    ali
    Link Parent
    do you mean MacOS and iOS? because iOS and iPadOS literally split last year. And apple emphasised that they're not planning to merge both OS. I mean I also don't see them ever locking MacOS down...

    . I don't really see a scenario in which this doesn't end up with a merger of iOS and iPadOS over the next 10 years or so

    do you mean MacOS and iOS? because iOS and iPadOS literally split last year. And apple emphasised that they're not planning to merge both OS. I mean I also don't see them ever locking MacOS down like iOS, this would just move developers away from the platform for sure...

    1 vote
  13. Comment on Introducing the next generation of Mac - A new MacBook Air, 13-inch MacBook Pro, and Mac mini powered by M1, Apple’s chip designed specifically for the Mac in ~tech

    ali
    Link Parent
    what keeps the rest of the computer world to move to ARM longterm?

    what keeps the rest of the computer world to move to ARM longterm?

    1 vote
  14. Comment on Introducing the next generation of Mac - A new MacBook Air, 13-inch MacBook Pro, and Mac mini powered by M1, Apple’s chip designed specifically for the Mac in ~tech

    ali
    Link Parent
    What’s that?

    HBM

    What’s that?

    2 votes
  15. Comment on Covid-19 vaccine candidate is 90% effective, says manufacturer in ~health.coronavirus

    ali
    Link Parent
    If you’re not in a risk group there is pretty much no chance you’re getting it within 6 months of the widespread distribution... if the vaccine went through all stages of trial, I’d get it as...

    If you’re not in a risk group there is pretty much no chance you’re getting it within 6 months of the widespread distribution...
    if the vaccine went through all stages of trial, I’d get it as early as I could. I don’t mind staying at home but I’d love to be able to leave as soon as I could

    3 votes
  16. Comment on Share a link to a happy song! in ~music

    ali
    Link Parent
    ELO- Mr Blue Sky my last comment for now :D some of my favorite songs for sure

    ELO- Mr Blue Sky

    my last comment for now :D some of my favorite songs for sure

    2 votes
  17. Comment on Share a link to a happy song! in ~music

  18. Comment on Share a link to a happy song! in ~music

  19. Comment on Share a link to a happy song! in ~music

  20. Comment on Share a link to a happy song! in ~music