This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rayon::prelude::*; | |
use thiserror::Error; | |
const ROWS: usize = 6; | |
const COLS: usize = 7; | |
#[derive(Debug)] | |
pub struct Connect4Action { | |
pub column: usize, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:stable-slim as get | |
WORKDIR /bun | |
RUN apt-get update | |
RUN apt-get install curl unzip -y | |
RUN curl --fail --location --progress-bar --output "/bun/bun.zip" "https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip" | |
RUN unzip -d /bun -q -o "/bun/bun.zip" | |
RUN mv /bun/bun-linux-x64/bun /usr/local/bin/bun | |
RUN chmod 777 /usr/local/bin/bun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ProcessGDBRemote::StartAsyncThread () | |
< 1> send packet: + | |
ProcessGDBRemote::AsyncThread (arg = 0x1498a7018, pid = 0) thread starting... | |
ProcessGDBRemote::AsyncThread (arg = 0x1498a7018, pid = 0) listener.WaitForEvent (NULL, event_sp)... | |
history[1] tid=0x0103 < 1> send packet: + | |
< 19> send packet: $QStartNoAckMode#b0 | |
< 1> read packet: + | |
< 6> read packet: $OK#9a | |
< 1> send packet: + | |
< 86> send packet: $qSupported:xmlRegisters=i386,arm,mips,arc;multiprocess+;fork-events+;vfork-events+#2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Op { | |
Noop, | |
Addx(i32), | |
} | |
fn parse<'a>(input: &'a str) -> impl Iterator<Item = Op> + 'a { | |
input.split("\n").map(|line| { | |
let mut split = line.split(" "); | |
let op = split.next().unwrap(); | |
match op { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashSet; | |
fn parse<'a>(input: &'a str) -> impl Iterator<Item = (&'a str, u32)> + 'a { | |
input.split("\n").map(|line| { | |
let mut split = line.split(" "); | |
let dir = split.next().unwrap(); | |
let steps = split.next().unwrap().parse::<u32>().unwrap(); | |
(dir, steps) | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use core::num; | |
fn parse(input: &str) -> Vec<Vec<u32>> { | |
let mut grid = vec![]; | |
for line in input.split("\n") { | |
let mut row = vec![]; | |
for c in line.chars() { | |
let i = c.to_digit(10).unwrap(); | |
row.push(i); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{collections::HashMap, iter::Peekable, str::Split}; | |
#[derive(Debug)] | |
struct Dir<'a> { | |
path: Vec<&'a str>, | |
files: HashMap<&'a str, File<'a>>, | |
} | |
#[derive(Debug)] | |
struct File<'a> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashSet; | |
fn main() { | |
let input = include_str!("day06_input.txt"); | |
let data: Vec<char> = input.chars().collect(); | |
// just let HashSet do all the work | |
let mut message_set = HashSet::new(); | |
for i in 0..data.len() { | |
if i >= 13 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let input = include_str!("day05_input.txt"); | |
let lines = input.split("\n").collect::<Vec<&str>>(); | |
// find where the file switches from stacks to instructions | |
let mut split = 0; | |
for (i, line) in lines.iter().enumerate() { | |
if line.is_empty() { | |
split = i; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn parse_line(line: &str) -> (i32, i32, i32, i32) { | |
let mut split = line.split(","); | |
let left = split.next().unwrap(); | |
let mut ls = left.split("-"); | |
let left_from: i32 = ls.next().unwrap().parse().unwrap(); | |
let left_to: i32 = ls.next().unwrap().parse().unwrap(); | |
let right = split.next().unwrap(); | |
let mut rs = right.split("-"); | |
let right_from: i32 = rs.next().unwrap().parse().unwrap(); | |
let right_to: i32 = rs.next().unwrap().parse().unwrap(); |