Toric's recent activity

  1. Comment on What is Metamodernism? The era that follows postmodernity in ~humanities

    Toric
    Link
    we really have to stop describing art and philosiphy movements in terms of word meaning 'current'. In a couple decades, we will have meta-post-avant-modernism.

    we really have to stop describing art and philosiphy movements in terms of word meaning 'current'. In a couple decades, we will have meta-post-avant-modernism.

    3 votes
  2. Comment on Shut up and mint the coin in ~finance

    Toric
    Link
    are there any good articles that explain exactly how this is cannot in any way lead to a zimbabwae dollar or wimar republic mark? Ive had people tell me that this wont lead to hyperinflation, but...

    are there any good articles that explain exactly how this is cannot in any way lead to a zimbabwae dollar or wimar republic mark? Ive had people tell me that this wont lead to hyperinflation, but no one has ever been able to tell me why, and how this is different than what other countries have done.

    2 votes
  3. Comment on Whale hunts have been branded inhumane by activists and authorities as Icelandic report finds they suffer a long and painful death in ~enviro

    Toric
    Link Parent
    Not a hunter myself, but in an area where deer opening is practically a state holiday. Cant speak to skill, but culturally, an instant or near instant kill is something that is strived for. Most...

    Not a hunter myself, but in an area where deer opening is practically a state holiday. Cant speak to skill, but culturally, an instant or near instant kill is something that is strived for. Most state laws dictate that a hunter must try to track down an animal they have drawn blood from but not downed, and if they can find it, to put it out of its misery as soon as possible. Of course, not everyone is always a perfect shot, but clean kills are what people work towards.

    Also, the DNR is very conscientious about how many licenses it gives out, in fact its looking like hunters might only get 1 deer tag this year, with a few more given out via lottery.

    Overall, im actually pretty impressed by hunting culture, it certainly has its rough spots, but as a culture, it pays a lot of attention to ecological issues, and there is a lot of focus on preserving the woods and hunting for future generations to enjoy.

    10 votes
  4. Comment on So you want to turn an office building into a home? in ~design

    Toric
    Link Parent
    There probably are such exceptions, I just know that when my family was remodeling our basement to include a bedroom, there had to be an egress window made. I suspect that for larger buildings,...

    There probably are such exceptions, I just know that when my family was remodeling our basement to include a bedroom, there had to be an egress window made. I suspect that for larger buildings, the builders just have to have some form of proven fire escape.

    3 votes
  5. Comment on So you want to turn an office building into a home? in ~design

    Toric
    Link Parent
    IIRC, the requirements for windows is part of the fire code, not anything to do with natural light.

    IIRC, the requirements for windows is part of the fire code, not anything to do with natural light.

    5 votes
  6. Comment on The US needs to talk about the risk of war with China in ~misc

    Toric
    Link Parent
    I appreciate the fact that us gov acronyms try to keep to a theme.

    I appreciate the fact that us gov acronyms try to keep to a theme.

    2 votes
  7. Comment on US Supreme Court declines to hear Wikimedia Foundation’s challenge to NSA mass surveillance in ~tech

    Toric
    Link Parent
    that involves having a trusted cert on the computers. I guess its possible the NSA owns all root certs, but https is still theoretically secure.

    that involves having a trusted cert on the computers. I guess its possible the NSA owns all root certs, but https is still theoretically secure.

    6 votes
  8. Comment on Kerbal Space Program 2 | Early Access gameplay trailer in ~games

    Toric
    Link
    umm, title?

    umm, title?

    2 votes
  9. Comment on Honest question: Are Windows or Linux laptops more suited for freelancers? in ~tech

    Toric
    Link Parent
    Most of the code you are writing will most likely be on a linux machine, and as a freelancer you may not always get acess to a test server, so I would say that, as long as you are already...

    Most of the code you are writing will most likely be on a linux machine, and as a freelancer you may not always get acess to a test server, so I would say that, as long as you are already comfortable using linux to get work done, linux probably edges out here.

    7 votes
  10. Comment on Raspberry Pi 4 / 4GB giveaway in ~tech

    Toric
    Link
    I will happily take a pi, will be using it as a health monitor for my 'big' (x86 tower)' server, which, for obvious reasons, I dont just want to be another vm on the server.

    I will happily take a pi, will be using it as a health monitor for my 'big' (x86 tower)' server, which, for obvious reasons, I dont just want to be another vm on the server.

    1 vote
  11. Comment on Getty Images is suing the creators of AI art tool Stable Diffusion for scraping its content in ~tech

    Toric
    Link Parent
    I tend to take an information-theory approach to it. Is the size of the model even capable of storing verbatim content? With stable diffusion, the awnser is no, there is no way that terabytes upon...

    I tend to take an information-theory approach to it. Is the size of the model even capable of storing verbatim content? With stable diffusion, the awnser is no, there is no way that terabytes upon terabytes of input data could have been compressed into the 4.something gigabytes of the stable diffusion model, and you can verify this by observing that stable diffusion has never produced a verbatim output.

    1 vote
  12. Comment on Why not Mars in ~space

    Toric
    Link Parent
    Ok, backing up the species is a long term project, and a single mission to mars in no way accomplishes that goal. Are you saying its such a long term goal that we should never even start on it? We...

    Ok, backing up the species is a long term project, and a single mission to mars in no way accomplishes that goal. Are you saying its such a long term goal that we should never even start on it? We will never get to the point of living on multiple celestial bodies without sending a mission to at least one. Do you think there are better candidates?

    If the long-term goal is worth getting to, then surely the next step is also worth it?

    1 vote
  13. Comment on What did we get stuck in our rectums last year? in ~health

    Toric
    Link
    I love some of the sequences:

    I love some of the sequences:

    UNSCENTED SOAP BAR
    PERFUMED SOAP BAR
    SOAP DISPENSER

    6 votes
  14. Comment on Tildes Game Giveaway Thread: Holiday 2022 in ~games

    Toric
    Link Parent
    So I grew up in africa, probably about 100km from the nearest proper power grid, so almost no light polution. The night sky was really, really beautiful. Its hard to describe if you havent seen...

    So I grew up in africa, probably about 100km from the nearest proper power grid, so almost no light polution. The night sky was really, really beautiful. Its hard to describe if you havent seen it, but the sky is... vivd, bright, almost bright enough to see by. (more than bright enough on a full moon.) Id often sleep outside during the hot season, with nothing but a mosquito net between me and the sky. I remember seeing the milky way, not just as a few brighter spots in the sky, but as a whole stripe of the sky, lit up. Those pictures you see of 'dark sky zones'? there isnt photo editing there.

    Anyway, when I see the night sky today, in the US, I feel dissapointed, and sad. Industrialization has done a lot of good, dont get me wrong, but it saddens me that what used to be a universal experience is now just... not existence for a very large portion of humanity.

    5 votes
  15. Comment on Day 5: Supply Stacks in ~comp.advent_of_code

    Toric
    Link
    90% of the work today was just parsing the input. Once I had that, implementing the moves was pretty straightforward. Driver mod part1; mod part2; mod utilities; fn main() { let _input =...

    90% of the work today was just parsing the input. Once I had that, implementing the moves was pretty straightforward.

    Driver
    mod part1;
    mod part2;
    mod utilities;
    
    fn main() {
        let _input = include_str!("./input.txt");
        let _structured_input = utilities::parse(_input);
    
        println!("Part One");
        println!("Result: {:?}", part1::part1(&_structured_input));
    
        println!("Part Two");
        println!("Result: {:?}", part2::part2(&_structured_input));
    }
    
    Utilities
    use once_cell::sync::Lazy;
    use regex::Regex;
    #[derive(Debug, PartialEq, Eq, Clone)]
    pub struct Move {
        pub to: usize,
        pub from: usize,
        pub number: u8,
    }
    
    #[derive(Debug, PartialEq, Eq, Clone)]
    pub struct WorkArea {
        stacks: Vec<Vec<char>>,
    }
    
    impl WorkArea {
        pub fn new(stacks: Vec<Vec<char>>) -> Self {
            Self { stacks }
        }
        pub fn apply_move_cratemover9000(&mut self, action: &Move) {
            for _ in 0..action.number {
                let cargo = self.stacks.get_mut(action.from - 1).unwrap().pop().unwrap();
                self.stacks.get_mut(action.to - 1).unwrap().push(cargo);
            }
        }
        pub fn apply_move_cratemover9001(&mut self, action: &Move) {
            let mut crane_holder: Vec<char> = Vec::new();
            for _ in 0..action.number {
                let cargo = self.stacks.get_mut(action.from - 1).unwrap().pop().unwrap();
                crane_holder.push(cargo);
            }
            for cargo in crane_holder.iter().rev() {
                self.stacks.get_mut(action.to - 1).unwrap().push(*cargo);
            }
        }
        pub fn get_stacks(&self) -> &Vec<Vec<char>> {
            &self.stacks
        }
    }
    
    pub fn parse(input: &str) -> (WorkArea, Vec<Move>) {
        let mut input = input.split("\n\n");
        let work_area = parse_work_area(input.next().unwrap());
        let moves = parse_moves(input.next().unwrap());
        (work_area, moves)
    }
    
    pub fn parse_work_area(input: &str) -> WorkArea {
        //decode those bottom index numbers
        let index_row = input.lines().rev().next().unwrap();
        //some ascii math and array math to get the second to last char and convert it into a number.
        let index_max: usize = (index_row.as_bytes()[index_row.len() - 2] - b'0') as usize;
        //initalize the work area:
        let mut work_area: Vec<Vec<char>> = Vec::new();
        for _ in 0..index_max {
            work_area.push(Vec::new())
        }
    
        //now parse the rest
        for line in input.lines().rev() {
            for (y, cargo_crate) in line.as_bytes().chunks(4).enumerate() {
                let cargo = cargo_crate[1] as char;
                //easiest way to filter out that last line is just to filter out digits.
                if cargo != ' ' && !cargo.is_ascii_digit() {
                    work_area.get_mut(y).unwrap().push(cargo)
                }
            }
        }
    
        WorkArea::new(work_area)
    }
    
    pub fn parse_moves(input: &str) -> Vec<Move> {
        static PARSE_MOVES_REGEX: Lazy<Regex> =
            Lazy::new(|| Regex::new(r"^move (\d+) from (\d+) to (\d+)$").unwrap());
        input
            .lines()
            .map(|line| {
                let cap = PARSE_MOVES_REGEX.captures(line).unwrap();
                Move {
                    to: cap.get(3).unwrap().as_str().parse().unwrap(),
                    from: cap.get(2).unwrap().as_str().parse().unwrap(),
                    number: cap.get(1).unwrap().as_str().parse().unwrap(),
                }
            })
            .collect()
    }
    
    Part 1
    use crate::utilities::*;
    
    pub fn part1(input: &(WorkArea, Vec<Move>)) -> Vec<char> {
        let (mut work_area, moves) = input.to_owned();
        for r#move in moves {
            work_area.apply_move_cratemover9000(&r#move)
        }
        work_area
            .get_stacks()
            .iter()
            .map(|stack| stack.last().unwrap().to_owned())
            .collect()
    }
    
    Part 2
    use crate::utilities::*;
    
    pub fn part2(input: &(WorkArea, Vec<Move>)) -> Vec<char> {
        let (mut work_area, moves) = input.to_owned();
        for r#move in moves {
            work_area.apply_move_cratemover9001(&r#move)
        }
        work_area
            .get_stacks()
            .iter()
            .map(|stack| stack.last().unwrap().to_owned())
            .collect()
    }
    
    1 vote
  16. Comment on Day 6: Tuning Trouble in ~comp.advent_of_code

    Toric
    Link
    today was nice and easy. Had to find rusts window() function, though. Driver mod part1; mod part2; mod utilities; fn main() { let _input = include_str!("./input.txt"); println!("Part One");...

    today was nice and easy. Had to find rusts window() function, though.

    Driver
    mod part1;
    mod part2;
    mod utilities;
    
    fn main() {
        let _input = include_str!("./input.txt");
    
        println!("Part One");
        println!("Result: {}", part1::part1(_input));
    
        println!("Part Two");
        println!("Result: {}", part2::part2(_input));
    }
    
    Utilities
    pub fn find_dupes_stupid<T: PartialEq>(slice: &[T]) -> bool {
        for i in 1..slice.len() {
            if slice[i..].contains(&slice[i - 1]) {
                return true;
            }
        }
        false
    }
    
    Part 1
    use crate::utilities::*;
    
    pub fn part1(input: &str) -> usize {
        input
            .as_bytes()
            .windows(4)
            .position(|x| !find_dupes_stupid(x))
            .unwrap()+4
    }
    
    Part 2
    use crate::utilities::*;
    
    pub fn part2(input: &str) -> usize {
        input
            .as_bytes()
            .windows(14)
            .position(|x| !find_dupes_stupid(x))
            .unwrap()+14
    }
    
    2 votes
  17. Comment on Day 4: Camp Cleanup in ~comp.advent_of_code

    Toric
    Link Parent
    I ended up writing my own Range implementation, didnt think to look in std for one.

    I ended up writing my own Range implementation, didnt think to look in std for one.

    3 votes
  18. Comment on Day 4: Camp Cleanup in ~comp.advent_of_code

    Toric
    Link
    Decided to start impl on my custom types. Once again, rusts type system is coming in handy. Driver mod part1; mod part2; mod utilities; fn main() { let _input = include_str!("./input.txt"); let...

    Decided to start impl on my custom types. Once again, rusts type system is coming in handy.

    Driver
    mod part1;
    mod part2;
    mod utilities;
    
    fn main() {
        let _input = include_str!("./input.txt");
        let _structured_input = utilities::parse(_input);
    
        println!("Part One");
        println!("Result: {}", part1::part1(&_structured_input));
    
        println!("Part Two");
        println!("Result: {}", part2::part2(&_structured_input));
    }
    
    Utils
    use once_cell::sync::Lazy;
    use regex::Regex;
    #[derive(Debug, PartialEq, Eq)]
    pub struct Range {
        start: u16,
        end: u16,
    }
    
    impl Range {
        pub fn new(start: u16, end: u16) -> Self {
            Self {
                start: start.min(end),
                end: end.max(start),
            }
        }
    
        pub fn calc_size(&self) -> u16 {
            self.start.abs_diff(self.end)
        }
    
        pub fn any_overlap(&self, other: &Self) -> bool {
            self.start <= other.end && self.end >= other.start
        }
    
        pub fn calc_overlap(&self, other: &Self) -> Range {
            let overlap_start = self.start.min(other.start);
            let overlap_end = self.end.max(other.end);
            Range::new(overlap_start, overlap_end)
        }
    
        pub fn complete_overlap(&self, other: &Self) -> bool {
            self.calc_overlap(other) == *self || self.calc_overlap(other) == *other
        }
    
        pub fn start(&self) -> u16 {
            self.start
        }
    
        pub fn end(&self) -> u16 {
            self.end
        }
    }
    
    static PARSE_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"^(\d+)-(\d+),(\d+)-(\d+)").unwrap());
    
    pub fn parse(input: &str) -> Vec<(Range, Range)> {
        input
            .lines()
            .map(|line| {
                let cap = PARSE_REGEX.captures(line).unwrap();
                (
                    Range::new(
                        cap.get(1).unwrap().as_str().parse().unwrap(),
                        cap.get(2).unwrap().as_str().parse().unwrap(),
                    ),
                    Range::new(
                        cap.get(3).unwrap().as_str().parse().unwrap(),
                        cap.get(4).unwrap().as_str().parse().unwrap(),
                    ),
                )
            })
            .collect()
    }
    
    Part 1
    use crate::utilities::*;
    
    pub fn part1(input: &[(Range, Range)]) -> usize {
        input
            .iter()
            .filter(|tuple| tuple.0.complete_overlap(&tuple.1))
            .count()
    }
    
    Part 2
    use crate::utilities::*;
    
    pub fn part2(input: &[(Range, Range)]) -> usize {
        input
            .iter()
            .filter(|tuple| tuple.0.any_overlap(&tuple.1))
            .count()
    }
    
    2 votes
  19. Comment on Day 3: Rucksack Reorganization in ~comp.advent_of_code

    Toric
    Link Parent
    thats actually pretty clever...

    thats actually pretty clever...

    1 vote
  20. Comment on Day 3: Rucksack Reorganization in ~comp.advent_of_code

    Toric
    (edited )
    Link
    I really wish rusts HashSet implentation allowed finding the intersection of more than one other hashset at a time... Driver mod part1; mod part2; mod utilities; fn main() { let _input =...

    I really wish rusts HashSet implentation allowed finding the intersection of more than one other hashset at a time...

    Driver
    mod part1;
    mod part2;
    mod utilities;
    
    fn main() {
        let _input = include_str!("./input.txt");
        let _structured_input = utilities::parse(_input);
    
        println!("Part One");
        println!("Result: {}", part1::part1(&_structured_input));
    
        println!("Part Two");
        println!("Result: {}", part2::part2(&_structured_input));
    }
    
    utilites
    use std::collections::HashSet;
    #[derive(Debug, PartialEq, Eq)]
    pub struct Rucksack(pub HashSet<char>, pub HashSet<char>);
    
    pub fn parse(input: &str) -> Vec<Rucksack> {
        input
            .lines()
            .map(|line| {
                let (first, second) = line.split_at(line.len() / 2);
                Rucksack(first.chars().collect(), second.chars().collect())
            })
            .collect()
    }
    
    pub fn find_char_score(input: &char) -> usize {
        if input.is_uppercase() {
            *input as usize - 38
        } else {
            *input as usize - 96
        }
    }
    
    Part 1
    use crate::utilities::*;
    
    pub fn part1(input: &[Rucksack]) -> usize {
        input
            .iter()
            .map(|rucksack| rucksack.0.intersection(&rucksack.1).next().unwrap())
            .map(find_char_score)
            .sum()
    }
    
    Part 2
    use crate::utilities::*;
    use std::collections::HashSet;
    
    struct Group(HashSet<char>, HashSet<char>, HashSet<char>);
    
    pub fn part2(input: &[Rucksack]) -> usize {
        seperate_groups(input)
            .iter()
            .map(|group| {
                //manual implementation of intersection because doing chained intersections is annoying...
                group
                    .0
                    .iter()
                    .filter(|c| group.1.contains(c))
                    .filter(|c| group.2.contains(c))
                    .next()
                    .unwrap()
            })
            .map(find_char_score)
            .sum()
    }
    
    fn seperate_groups(input: &[Rucksack]) -> Vec<Group> {
        let mut output: Vec<Group> = Vec::new();
        for group in input.chunks_exact(3) {
            output.push(Group(
                group[0].0.union(&group[0].1).copied().collect(),
                group[1].0.union(&group[1].1).copied().collect(),
                group[2].0.union(&group[2].1).copied().collect(),
            ));
        }
        output
    }
    
    3 votes