Skip to content

Instantly share code, notes, and snippets.

View indiv0's full-sized avatar

Nikita Pekin indiv0

View GitHub Profile
@indiv0
indiv0 / day_6_1_gpu.rs
Created December 10, 2023 04:57
day_6_1_gpu.rs
use std::borrow;
use wgpu::util::DeviceExt as _;
// ===========
// === Run ===
// ===========
@indiv0
indiv0 / main.rs
Created December 9, 2023 18:55
runner/src/main.rs
#![feature(portable_simd)]
use std::{
hint::black_box,
time::{Duration, Instant},
};
trait IntoInput<T: Copy> {
fn into_input(self) -> T;
}
@indiv0
indiv0 / bot.py
Created December 9, 2023 17:47
bot.py
import docker
import discord
import asyncio
import sqlite3
import io
import functools
import os
from os import listdir
from os.path import isfile, join
from datetime import datetime, timedelta, timezone
@indiv0
indiv0 / day_6_1.rs
Created December 8, 2023 09:38
9ns.rs
// ===========
// === Run ===
// ===========
pub fn run(s: &str) -> u64 {
let (times, distances) = parse_input(s);
let times = &[times.0, times.1, times.2, times.3];
let distances = &[distances.0, distances.1, distances.2, distances.3];
let wins0 = simulate_race(times[0] as u16, distances[0]) as u64;
@indiv0
indiv0 / day_6_1.rs
Created December 6, 2023 20:21
day_6_1.rs
pub fn run(s: &str) -> u64 {
let (times, distances) = parse_input(s);
let times = &[times.0, times.1, times.2, times.3];
let distances = &[distances.0, distances.1, distances.2, distances.3];
let wins0 = simulate_race(times[0] as u16, distances[0]) as u64;
let wins1 = simulate_race(times[1] as u16, distances[1]) as u64;
let wins2 = simulate_race(times[2] as u16, distances[2]) as u64;
let wins3 = simulate_race(times[3] as u16, distances[3]) as u64;
let counter = wins0 * wins1 * wins2 * wins3;
counter
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#[inline]
fn is_hex_prefixed_matches(s: &str) -> bool {
matches!(s.as_bytes(), [b'0',b'x', ..] | [b'0',b'X', ..])
}
#[inline]
fn is_hex_prefixed_unsafe(s: &str) -> bool {
let x =
unsafe { ((*s.as_ptr() as u16) << 8) | (*s.as_ptr().add((s.len() > 1) as usize)) as u16 };
(x ^ 0x3078) & (x ^ 0x3050) == 0
@indiv0
indiv0 / index.html
Last active October 3, 2019 18:50 — forked from spiermar/index.html
d3-flame-graph
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css"
href="https://cdn.jsdelivr.net/gh/spiermar/[email protected]/dist/d3.flameGraph.min.css"
integrity="sha256-w762vSe6WGrkVZ7gEOpnn2Y+FSmAGlX77jYj7nhuCyY="
crossorigin="anonymous"
/>
</head>
# Mnemosyne configuration file.
# This file contains settings which we deem to be too specialised to be
# accesible from the GUI. However, if you use some of these settings, feel
# free to inform the developers so that it can be re-evaluated if these
# settings need to be exposed in the GUI.
# Science server. Only change when prompted by the developers.
science_server = "mnemosyne-proj.dyndns.org:80"
from curio import run
from curio.socket import *
import os
import sys
from common import send_message, read_message, b8zs_encode
DEFAULT_HOST = '127.0.0.1'
DEFAULT_PORT = 8080