Servius's Avatar

Servius

@darksailor.dev

I like rust, nix and writing software as a hobby. I also like music https://last.fm/user/servius_ Probably got some (undiagnosed) adhd

12
Followers
21
Following
14
Posts
18.10.2024
Joined
Posts Following

Latest posts by Servius @darksailor.dev

The runback for Groal The Great was a bit much but I'll let it slide for the lore.
The boss is a bit easy if you use Delvers Drill anyways.

24.10.2025 17:39 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Post image

Just finished Hollow Knight: Silksong. 10/10 no words, Absolute Cinema

24.10.2025 17:36 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Post image

I can't believe it... It's real

05.09.2025 21:19 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
fry from futurama is holding a bunch of money in his hand ALT: fry from futurama is holding a bunch of money in his hand

Valve please let me buy silksong ffs

04.09.2025 14:14 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Video thumbnail

Printed a balisong on my 3d printer. Just learned the basics but now I can’t put it down 😭

28.08.2025 10:18 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

I remember there used to be an old app for symbian nokia/samsung phones that had a local chat feature over bluetooth. We used to mess around in class with that.

08.07.2025 23:20 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
use itertools::Itertools;
pub fn peaks_and_valleys<'a, T: PartialOrd + Copy + 'a>(
    iterator: impl IntoIterator<Item = &'a T>,
) -> Vec<usize> {
    iterator
        .into_iter()
        .enumerate()
        .tuple_windows()
        .filter_map(|((_, last), (idx, current), (_, next))| {
            ((current > last && current > next) || (current < last && current < next))
                .then_some(idx)
        })
        .sorted()
        .collect()
}

#[test]
fn test_peaks_and_valleys() {
    let data = vec![
        (vec![1, 2, 1, 3, 4, 5, 4, 3, 2, 1, 2, 3], vec![1, 2, 5, 9]),
        (vec![1, 1, 1, 1, 1, 1, 1], vec![]),
        (vec![1, 0, 1, 0, 1, 0], vec![1, 2, 3, 4]), // Wrong info in the original test case
        (vec![-5, -10, -7, -15, -12], vec![1, 2, 3]),
    ];

    for (input, expected) in data {
        let result = peaks_and_valleys(&input);
        assert_eq!(result, expected);
    }
}

use itertools::Itertools; pub fn peaks_and_valleys<'a, T: PartialOrd + Copy + 'a>( iterator: impl IntoIterator<Item = &'a T>, ) -> Vec<usize> { iterator .into_iter() .enumerate() .tuple_windows() .filter_map(|((_, last), (idx, current), (_, next))| { ((current > last && current > next) || (current < last && current < next)) .then_some(idx) }) .sorted() .collect() } #[test] fn test_peaks_and_valleys() { let data = vec![ (vec![1, 2, 1, 3, 4, 5, 4, 3, 2, 1, 2, 3], vec![1, 2, 5, 9]), (vec![1, 1, 1, 1, 1, 1, 1], vec![]), (vec![1, 0, 1, 0, 1, 0], vec![1, 2, 3, 4]), // Wrong info in the original test case (vec![-5, -10, -7, -15, -12], vec![1, 2, 3]), ]; for (input, expected) in data { let result = peaks_and_valleys(&input); assert_eq!(result, expected); } }

Iterators 🫑

13.06.2025 13:52 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Video thumbnail

Thank you for the pointer that worked wonderfully.

04.06.2025 17:48 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

Wow ! I was trying to get it to work with hot_lib_loader with no success.
Might have to switch to bevy/main for a while

03.06.2025 22:19 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Post image

Lunch

02.06.2025 09:32 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Post image

Update to my keyboard with nice!view and zmk.
Had to switch to zmk since rmk doesn’t yet support nice!view.

12.04.2025 22:18 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Post image

New keyboard
freshly built.
nrf52840 + rmk
nice!views coming soon

11.04.2025 20:23 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Post image

Got my first balatro win

11.01.2025 23:45 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Post image

3rd playthrough In wait of silksong

09.01.2025 16:27 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0