Because I wasn’t aware of them, thanks!
- 57 Posts
- 2.77K Comments
Yeah, Im hoping it picks up. No mazes yet :(
CameronDevto
Science@beehaw.org•Giving men a common antidepressant could help tackle domestic violence: world-first study
30·8 hours agoI used to sleep with a hammer under my bed. Since he started this medication, I can sleep more easily, and I don’t need to sleep with the hammer anymore.
That is such a sad quote. That they ever thought that was normal or okay.
Ulua probably has a single character that rotates the input -90 degrees…
Rust
Pt1 easy, pt2 cry
edit: Updated with more iterring :)
view code
#[test] fn test_y2025_day6_part1() { let input = include_str!("../../input/2025/day_6.txt"); let lines = input.lines().collect::<Vec<&str>>(); let nr = lines[0..4] .iter() .map(|l| { l.split_whitespace() .map(|s| s.parse::<usize>().unwrap()) .collect::<Vec<usize>>() }) .collect::<Vec<Vec<usize>>>(); let operations = lines[4].split_whitespace().collect::<Vec<&str>>(); let total = operations .iter() .enumerate() .map(|(i, op)| match *op { "*" => [0, 1, 2, 3].iter().map(|j| nr[*j][i]).product::<usize>(), "+" => [0, 1, 2, 3].iter().map(|j| nr[*j][i]).sum::<usize>(), _ => panic!("Unknown operation {}", op), }) .sum::<usize>(); assert_eq!(4412382293768, total); println!("Total: {}", total); } #[test] fn test_y2025_day6_part2() { let input = std::fs::read_to_string("input/2025/day_6.txt").unwrap(); let lines = input .lines() .map(|s| s.chars().collect::<Vec<char>>()) .collect::<Vec<Vec<char>>>(); let mut i = lines[0].len(); let mut numbers = vec![]; let mut total = 0; while i > 0 { i -= 1; let number = [0, 1, 2, 3] .iter() .filter_map(|j| lines[*j][i].to_digit(10)) .fold(0, |acc, x| acc * 10 + x); if number == 0 { continue; } numbers.push(number as usize); match lines[4][i] { '*' => { total += numbers.iter().product::<usize>(); numbers.clear(); } '+' => { total += numbers.iter().sum::<usize>(); numbers.clear(); } ' ' => {} _ => panic!("Unknown operation {}", lines[4][i]), } } assert_eq!(7858808482092, total); println!("Total: {}", total); }
Yup, in the pinned post: https://programming.dev/post/6631465 :)
So, EFTPOS over Meshtastic then.
Rust
#[test] fn test_y2025_day5_part2() { let input = std::fs::read_to_string("input/2025/day_5.txt").unwrap(); let (fresh, _) = input.split_once("\n\n").unwrap(); let mut fresh = fresh .lines() .map(|l| { let (p1, p2) = l.split_once("-").unwrap(); (p1.parse::<usize>().unwrap(), p2.parse::<usize>().unwrap()) }) .collect::<Vec<(usize, usize)>>(); fresh.sort_by_key(|a| a.0); let mut non_overlapping = vec![*fresh.first().unwrap()]; for range in fresh[1..].iter() { let last = *non_overlapping.last().unwrap(); if range.0 > last.1 { // println!("Non overlapping: {range:?} -> {last:?}"); non_overlapping.push((range.0, range.1)); continue; } if range.0 <= last.1 && range.1 > last.1 { // println!("Overlapping: {range:?} -> {last:?}"); let new_last = (last.0, range.1); non_overlapping.pop(); non_overlapping.push(new_last); continue; } // println!("{range:?} is entirely within {last:?}"); } let mut count = 0; for r in &non_overlapping { count += r.1 - r.0 + 1; } assert_eq!(count, 352556672963116); println!("{}", count); }Took me way longer than it should have to work out pt2, got tripped up by a
<instead of<=.
CameronDevto
Technology@lemmy.zip•EU's Top Court Just Made It Impossible to Run a User-Generated Platform LegallyEnglish
14·2 days ago1 is impossible. You cannot screen every message sent, even screening every post would be a full time 24/7 job (3x full time moderators working in shifts).
The big platforms will run it through a blackbox content moderator system, and lobby to keep fines minimal. Lemmy would be screwed.
CameronDevto
Hardware@lemmy.world•The NPU in your phone keeps improving—why isn’t that making AI better?English
16·2 days agoPretty sure AI isnt meant to make things better, its to sell stuff. If it does make any improvements, thats just a happy accident.
Samsung spokesperson Elise Sembach said the company’s AI efforts are grounded in enhancing experiences while maintaining user control
Oops. Said it out loud?
And here’s the funny thing: it never broke
LOL
He was hooked on it.
CameronDevto
Showerthoughts@lemmy.world•Usually, silicone nippled showerheads aren't replaced or cleaned regularly.
11·2 days agoThose are rookie numbers, mine are definitely yellowing and cracking :(
Love a good visualisation <3
I was gonna do the same later when some free time, was wondering if it generated some kind of image.
Rust
fn count_sides(grid: &[Vec<char>], x: usize, y: usize) -> usize { let mut count = 0; for i in y.saturating_sub(1)..=y + 1 { for j in x.saturating_sub(1)..=x + 1 { if i == y && j == x { continue; } if let Some(row) = grid.get(i) { if let Some(col) = row.get(j) { if *col == '@' { count += 1; } } } } } count } #[test] fn test_y2025_day4_part1() { let input = std::fs::read_to_string("input/2025/day_4.txt").unwrap(); let grid = input .lines() .map(|l| l.chars().collect::<Vec<_>>()) .collect::<Vec<_>>(); let mut total = 0; let width = grid[0].len(); let height = grid.len(); for y in 0..height { for x in 0..width { if grid[y][x] != '@' { continue; } if count_sides(&grid, x, y) < 4 { total += 1 } } } println!("Total = {total}") } #[test] fn test_y2025_day4_part2() { let input = std::fs::read_to_string("input/2025/day_4.txt").unwrap(); let grid = input .lines() .map(|l| l.chars().collect::<Vec<_>>()) .collect::<Vec<_>>(); let mut grid = input .lines() .map(|l| l.chars().collect::<Vec<_>>()) .collect::<Vec<_>>(); let mut total = 0; let width = grid[0].len(); let height = grid.len(); loop { let mut iter_total = 0; for y in 0..height { for x in 0..width { if grid[y][x] != '@' { continue; } if count_sides(&grid, x, y) < 4 { grid[y][x] = '*'; iter_total += 1 } } } println!("Moved = {iter_total}"); if iter_total == 0 { break; } total += iter_total; } println!("Total = {total}"); }Nothing really exciting here, was pretty straightforward
CameronDevto
Australia@aussie.zone•NSW Pulls Plug On Pokies Operating During 'High Risk' HoursEnglish
3·3 days agoAre the venues lively though? My only real experience with pokies was a cruise ship casino, and it was so depressing. Just a bunch of bored looking people mindlessly hitting the button.
No amount of raffles and free food makes that sound like a place to be











Excel
Pt1 - Its a solution, but the column width on Numbers prevents a full solution
https://docs.google.com/spreadsheets/d/e/2PACX-1vTzFApVAk9k5Q4EQhozST1HftYLgVzApgxjQx7MAl5AAE5eWEvrQnDQWmdj7J2Hyw/pub?output=ods
If I get p2 working, I’ll post a new link. Dont think i will have much luck though.