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
I am the Miaou user with id 2097 and name "wisely" on https://dystroy.org/miaou |
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
extern crate texture; | |
extern crate glutin_window; | |
extern crate graphics; | |
extern crate opengl_graphics; | |
use opengl_graphics::Texture; | |
use graphics::image::Image; | |
use texture::TextureSettings; | |
fn main() { |
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
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
char last_input; | |
char *getstdin() { | |
char *line = NULL, *tmp = NULL; | |
size_t size = 0, index = 0; | |
int ch = EOF; |
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
[package] | |
name = "webtesto" | |
version = "0.1.0" | |
authors = ["Matthew Tran <0e4ef622@gmail.com>"] | |
[dependencies] | |
actix-web = "0.6" | |
actix = "^0.5.8" | |
futures = "0.1" | |
serde_derive = "1.0" |
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
[package] | |
name = "glutin-window-bug" | |
version = "0.1.0" | |
authors = ["Matthew Tran <0e4ef622@gmail.com>"] | |
edition = "2018" | |
[dependencies] | |
piston = "0.37" | |
piston-texture = "0.6" | |
# uncomment one of the below |
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
macro_rules! gen_execute_macro { | |
($(($($idl:tt $it:tt $in:tt),*), ($($odl:tt $ot:tt $on:tt),*),)*) => { | |
macro_rules! execute_2 { | |
$( | |
($oname:ident, ($($idl$it:ty),*), ($($odl$ot:ty),*)) => { | |
fn execute(&self, in_var: Self::InType) -> Self::OutType { | |
let mut res = Self::OutType::default(); | |
let kmut = (*KERNEL).clone(); | |
let mut k = kmut.lock(); | |
unsafe { |
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
#[derive(Clone, Copy)] | |
enum Event { | |
Begin(usize), | |
Sleep, | |
Wake, | |
} | |
#[derive(Clone, Copy)] | |
struct Entry { | |
minute: 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
use std::collections::*; | |
pub fn part1(input: &str) -> usize { | |
let mut input = input.split_whitespace().peekable(); | |
let mut entries = Vec::new(); | |
parse_node(input.by_ref(), &mut entries); | |
entries.into_iter().sum() | |
} | |
fn parse_node<'a>(input: &mut impl Iterator<Item = &'a str>, entries: &mut Vec<usize>) { | |
let child_node_count = input.next().unwrap().parse::<usize>().unwrap(); |
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::iter::{IntoParallelIterator, ParallelIterator}; | |
pub fn part1(serial_number: usize) -> (usize, usize) {unsafe{ | |
let mut cells = vec![[0isize; 300]; 300]; | |
for y in 1..=300 { | |
let id = 11; | |
*cells.get_unchecked_mut(y-1).get_unchecked_mut(0) = ((id*y+serial_number)*id/100%10) as isize - 5; | |
if y != 1 { | |
*cells.get_unchecked_mut(y-1).get_unchecked_mut(0) += *cells.get_unchecked_mut(y-2).get_unchecked_mut(0); | |
} | |
} |
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 load(input: &str) -> (isize, isize, Vec<u8>, Vec<(isize, isize, isize, isize, usize)>) { | |
let width = input.lines().next().unwrap().len() as isize; | |
let height = input.lines().count() as isize; | |
let mut matrix = vec![0; (width*height) as usize]; | |
let mut cars: Vec<(isize, isize, isize, isize, usize)> = vec![]; // (y, x, dx, dy, state) for sorting, down is positive | |
for (y, line) in input.lines().enumerate() { | |
for (x, &c) in line.as_bytes().iter().enumerate() { | |
let x = x as isize; | |
let y = y as isize; | |
matrix[(y*width+x) as usize] = c; |
OlderNewer