mii

joined 9 months ago
[–] [email protected] 1 points 2 weeks ago

Day 2, Part 1

use strict;
use List::Util qw( min max );

open(FH, '<', $ARGV[0]) or die $!;
my @lines;
while (<FH>) {
	my @report = split /\s/, $_;
	push @lines, \@report;
}

close FH;

sub in_range {
	my $diff = max($_[0], $_[1]) - min($_[0], $_[1]);
	return $diff >= 1 && $diff <= 3;
}

sub is_safe {
	my $prev = @$_[0];
	my $dir = 0;

	for (my $i = 1; $i < scalar @$_; ++$i) {
		my $el = @$_[$i];
		if ($el > $prev) {
			return 0 unless $dir >= 0;
			$dir = 1;
		} elsif ($el < $prev) {
			return 0 unless $dir <= 0;
			$dir = -1;
		}

		return 0 unless in_range $prev, $el;
		$prev = $el;
	}

	return 1;
}

sub part1 {
	my $safe_reports = 0;

	foreach (@_) {
		$safe_reports++ if is_safe @$_;
	}

	return $safe_reports;
}

print 'Part 1: ', part1(@lines), "\n";
My part 2 solution didn't work with the real input but worked with all the test cases I threw at it, so I couldn't figure out what was wrong with it and I'm too lazy to debug any more right now.
[–] [email protected] 3 points 2 weeks ago (2 children)

Advent of Code is one of these things I wanna do every year and then I end up in fucking end-of-the-year crunch time every December and work for 10-12 hours and really don't wanna code after work anymore.

But hey, here's a quick solution for day 1. Let's see how far I make it.

Day 1

use strict;
use List::Util qw( min max );

open(FH, '<', $ARGV[0]) or die $!;

my @left;
my @right;

while (<FH>) {
	my @nums = split /\s+/, $_;
	push(@left, $nums[0]);
	push(@right, $nums[1]);
}

@left = sort { $b <=> $a } @left;
@right = sort { $b <=> $a } @right;

my $dist = 0;
my $sim = 0;
my $i = 0;

foreach my $lnum (@left) {
	$sim += $lnum * grep { $_ == $lnum } @right;

	my $rnum = $right[$i++];
	$dist += max($lnum, $rnum) - min($lnum, $rnum);
}

print 'Part 1: ', $dist, "\n";
print 'Part 2: ', $sim, "\n";

close(FH);

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

Promptfondlers too lazy to even fondle prompts anymore. I’m sure this is the prime target demographic for Elon’s brain chips.

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

I'd say lol but I'm like 72% sure this is straight out of the video game industry's playbook and very much intentional to create hype because everyone has forgotten this shit even exists.

Also, I'm still waiting for just one use case for video-generating autoplag that is, even in theory, not either morally reprehensible or outright criminal.

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

So there's apparently a memecoin site with the not-at-all suspicious name pump.fun and Coffeezilla made a video about it on his second channel.

Also: Epilepsy warning for that site. It's full of flashing colors and moving elements like late 90s Geocities.

I have no idea what the fuck is even going on there, but apparently people threaten to kill themselves or their animals if you don't invest in their shitcoin there, or run actual cockfights where they murder the chickens live on stream if the line doesn't go up.

[–] [email protected] 9 points 4 weeks ago (1 children)

This is fucked even without the hallucinating Clippy in the backend.

If your desktop is idle for more than 30-60 seconds (no "meaningful" mouse & keyboard movement), you get a red flag

People getting ~~flogged~~ flagged for being lazy for a few seconds reminds me of something …

[–] [email protected] 21 points 4 weeks ago

That was a great read.

The point of all of this is to say: the tech utopia fantasy is truly dead to me. The image of the cool, hippie, leftist Silicon Valley tech is wrong.

I feel this in my soul, because I was that leftist hippie who got into tech because he believed all this shit and getting disillusioned over time was just fucking painful and made me hate those goons with a passion.

The straw I have left is that I’m not alone and that more people realize this and we make our own communities again that don’t suck. There’s still a long way to go, and Fedi has its own problems, especially when it comes to kick out the racists, sexists, and other bigots, but I try to stay positive that we’ll get there. At least to a degree.

(I mean, we have Awful and it’s an example that you can keep the bar nazi-free if you want to.)

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

Seems like they've actually done this now. There's a preface note now.

This topic was chosen based on the technical merit of the project before we were aware of its author's political views and controversies. Our coverage of technical projects is never an endorsement of the developers' political views. The moderation of comments here is not meant to defend, or defame, anybody, but is in keeping with our longstanding policy against personal attacks. We could certainly have handled both topic selection and moderation better, and will endeavor to do so going forward.

Which is better than nothing, I guess, but still feels like a cheap cop-out.

Side-note: I can actually believe that they didn't know about Justine being a fucking nazi when publishing this, because I remember stumbling across some of her projects and actually being impressed by it, and then I found out what an absolute rabbit hole of weird shit this person is. So I kinda get seeing the portable executables project, thinking, wow, this is actually neat, and running with it.

Not that this is an excuse, because when you write articles for a website that should come with a bit of research about the people and topic you choose to cover and you have a bit more responsibility than someone who's just browsing around, but what do I know.

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

So, ethics and legality are strategic liabilities? Jesus fucking Christ, that’s not even sneer-worthy. This guy is completely fucking insane.

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

Such meme. Much wow. I see we’re continuing with giving dumb names to everything the Muskrat is involved in. Glad that hasn’t changed.

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

Oh, that is so much better, thanks for the suggestion. I reworked the whole paragraph to follow that tone and it does work much better and feels less clunky.

"Feel Good Productivity" indeed, because doesn't it feel good to have a portfolio that keeps filling itself? To have a tool that promises to make writer's block go poof? Because that, everyone, must be the future of productivity!

[–] [email protected] 4 points 1 month ago* (last edited 1 month ago) (2 children)

Thank you for reading.

“fear of the empty page” is a bit oddly named.

Agreed, it does seem clunky in hindsight. I changed that passage into "To have a tool that promises to alleviate writer's block at the click of a button?" Which is just as much a bullshit claim as the other one, of course, but maybe gets the point across better. And I believe this is actually what some of the "writing assistant" autoplaggers claim to do.

view more: ‹ prev next ›