Show more
Handsome boosted

Can't even escape diet culture in Advent of Code, I see.

Advent of Code Day 2 in Rust 

gitlab.com/MisterBiggs/aoc_202

use itertools::Itertools;use std::fs;pub fn run() {    println!("Day 2:");    let input = fs::read_to_string("./inputs/day2.txt").expect("Could not read file");    println!("\tPart 1: {}", part1(&input));    println!("\tPart 2: {}", part2(&input));}#[derive(PartialEq, Clone, Copy)]enum Hand {    Rock = 1,    Paper,    Scissors,}#[derive(Clone, Copy)]enum Outcome {    Lost = 0,    Draw = 3,    Win = 6,}fn part1(input: &str) -> usize {    input        .trim()        .split('\n')        .map(|round_str| {            let round = round_str.split_once(' ').unwrap();            let opponent = match round.0 {                "A" => Hand::Rock,                "B" => Hand::Paper,                "C" => Hand::Scissors,                _ => panic!(),            };            let me = match round.1 {                "X" => Hand::Rock,                "Y" => Hand::Paper,                "Z" => Hand::Scissors,                _ => panic!(),            };            let outcome = match (opponent, me) {                (l, r) if l == r => Outcome::Draw,                (Hand::Rock, Hand::Paper) => Outcome::Win,                (Hand::Paper, Hand::Scissors) => Outcome::Win,                (Hand::Scissors, Hand::Rock) => Outcome::Win,                _ => Outcome::Lost,            };            outcome as usize + me as usize        })        .sum()}fn part2(input: &str) -> usize {    input        .trim()        .split('\n')        .map(|round_str| {            let round = round_str.split_once(' ').unwrap();            let opponent = match round.0 {                "A" => Hand::Rock,                "B" => Hand::Paper,                "C" => Hand::Scissors,                _ => panic!(),            };            let outcome = match round.1 {                "X" => Outcome::Lost,                "Y" => Outcome::Draw,                "Z" => Outcome::Win,                _ => panic!(),            };            let me = match (outcome, opponent) {                (Outcome::Draw, _) => opponent,                (Outcome::Win, Hand::Rock) => Hand::Paper,                (Outcome::Win, Hand::Paper) => Hand::Scissors,                (Outcome::Win, Hand::Scissors) => Hand::Rock,                (Outcome::Lost, Hand::Rock) => Hand::Scissors,                (Outcome::Lost, Hand::Paper) => Hand::Rock,                (Outcome::Lost, Hand::Scissors) => Hand::Paper,            };            outcome as usize + me as usize        })        .sum()}

Advent of code day 1 in rust 

gitlab.com/MisterBiggs/aoc_202

fn part1(food_input: &str) -> usize {    food_input        .split("\n\n")        .collect::<Vec<&str>>()        .into_iter()        .map(|elf| {            elf.split_whitespace()                .map(|food| food.parse::<usize>().unwrap())                .sum()        })        .collect::<Vec<usize>>()        .into_iter()        .max()        .unwrap()}
fn part2(food_input: &str) -> usize {    let mut elves_calories = food_input        .split("\n\n")        .collect::<Vec<&str>>()        .into_iter()        .map(|elf| {            elf.split_whitespace()                .map(|food| food.parse::<usize>().unwrap())                .sum()        })        .collect::<Vec<usize>>();    elves_calories.sort_by(|l, r| r.cmp(l));    elves_calories[..3].iter().sum::<usize>()}
Handsome boosted

The best dating advice I ever got was to remember that if someone ghosts me, they were probably a hired assassin who fell in love and couldn't finish the job.

Handsome boosted

"the secret scientists don't want you to know!!" Dude have you ever met a single scientist? My scientist friends are desperate for me to know about the changing mating habits of Brown marmorated stink bugs. They're screaming at the top of their lungs to tell you EVERYTHING.

The amount of work it takes to maintain header files in is honestly absurd

Any users out there notice service has been steadily degrading?

Handsome boosted

ATTENTION EVERYONE WRINGING THEIR HANDS OVER “#MASTODON ADMINS CAN READ MY DIRECT MESSAGES”: #SysAdmins have *always* been able to read your #email and DMs unless encrypted, including at the big #SocialNetworks and Internet providers. We used to have t-shirts that said, “I READ YOUR EMAIL.”

It’s just hitting now because you got used to places where the admins were kept away in their cubicles and data centers instead of greeting you at the front door.

#privacy #security #InfoSec #cybersecurity

Handsome boosted

I’ve been practicing No vember, where for the whole month I simply don’t

Handsome boosted

NASA's Artemis-1 Orion capsule has reached its 1st perilune. It flew behind the moon and successfully did the OPF (outbound powered flyby) burn.

Handsome boosted

Interested in the automated discovery of physical equations from data? Check out Julius's talk on DataDrivenDiffeq: a #julialang #sciml #symbolicregression #SymbolicAI package which lets you give time series data and returns the equations which generated the data. It even generates the LaTeX!

youtube.com/watch?v=Cn5HO78Q2X

Handsome boosted
Handsome boosted

I'm Commander Shepard, and This Is My Favorite Day on the Citadel to Celebrate the 15th Anniversary of Mass Effect.
Art by Matt Rhodes (early Prothean) & Derek Watts (early Citadel)
#Masseffect #scifi #Normandy #games #conceptart #bioware

Sure is a drag writing going back C at work after writing all weekend

Handsome boosted
Handsome boosted

If you think it’s horrible one billionaire bought up the public square and killed it, wait until you find out why your city doesn’t have a trolley system

Handsome boosted

A few recommendations for life on Mastodon:

1) Follow anyone you think looks potentially interesting; you can always unfollow later, and they may lead you to new people via boosted posts.

2) Boost posts you think are worthy, so others can discover new content.

3) Don't obsess on replicating your Twitter follows on Mastodon; let it be its own experience, and grow it organically. Obvs follow anyone you miss from Twitter, but this isn't a 1:1 replacement; have fun, follow your instincts.

Handsome boosted

Watching Artemis is like watching a pitch drop experiment.

Show more
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.