Skip to content

Instantly share code, notes, and snippets.

View AcrylicShrimp's full-sized avatar
⚙️
Working

AcrylicShrimp AcrylicShrimp

⚙️
Working
View GitHub Profile
@AcrylicShrimp
AcrylicShrimp / problem.rs
Last active June 28, 2023 13:17
Rust HKT(Higher-Kinded Type) Solution
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum TypeDispatchKind {
Bool,
Int,
}
// From LLVM
pub struct BoolValue<'ctx> {
pub value: bool,
_phantom: std::marker::PhantomData<&'ctx ()>,
@AcrylicShrimp
AcrylicShrimp / main.py
Created December 26, 2022 13:27
Korea Steam Deck Parcel Crawler
import asyncio
import aiohttp
import re
import time
from urllib import parse
MUL = 1
PAGE = 1000
BASE = 568587337453
# BASE = 568586360001 6번대는 여기 직전까지 없는거 확인 - 이 번호부터 시작 (12/26)
@AcrylicShrimp
AcrylicShrimp / calc.py
Created October 17, 2022 09:03
Basic calculator via Python 3
class Cursor():
def __init__(self, s):
self.s = ''.join(s.split())
def is_remains(self, i=0):
return i < len(self.s)
def advance(self, n):
@AcrylicShrimp
AcrylicShrimp / shader.rs
Created August 21, 2021 04:40
Rustfmt fails to format it.
use crate::{
NativeHandle, Object, ShaderAttribute, ShaderAttributeType, ShaderUniform, ShaderUniformBlock,
ShaderUniformType,
};
use gl33::types::*;
use std::any::type_name;
use std::collections::HashMap;
use std::ffi::CString;
use std::mem::forget;
use std::ptr::{null, null_mut};
@AcrylicShrimp
AcrylicShrimp / renderer_systems.rs
Created August 12, 2021 16:12
Rendering system logic
use crate::component::*;
use crate::render::*;
use crate::system::System;
use crate::EngineContextWithoutSystemManager;
use legion::*;
use std::cmp::{max, min, Ordering};
use std::mem::size_of;
use std::sync::Arc;
enum RendererRef<'r> {
@AcrylicShrimp
AcrylicShrimp / main.rs
Created July 27, 2021 09:39
1347명이 있는 카톡 방에서 전체 인원의 95% 이상이 선물을 한번이라도 받을 때까지 무작위 세 명에게 선물하고 그 세 명중 한 사람이 다시 같은 행위를 반복하면 몇 회만에 종료될까
use rand::seq::SliceRandom;
use rand::{thread_rng, Rng};
fn main() {
let mut rng = thread_rng();
for _ in 0..1000 {
let total = 1347;
let mut count_who_never_received = 1347;
let mut users = (0..total).collect::<Vec<_>>();
@AcrylicShrimp
AcrylicShrimp / build.ts
Created May 22, 2021 12:38
An automatic artifact generator for AWS Lambda
import * as fs from 'fs';
import * as path from 'path';
import { spawnSync } from 'child_process';
const intPath = path.join('dist', 'intermediates', 'exp-deps');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const deps = [];
if (pkg.dependencies) for (const dep in pkg.dependencies) deps.push(`${dep}@${pkg.dependencies[dep]}`);
@AcrylicShrimp
AcrylicShrimp / main.rs
Created August 4, 2020 07:58
horizon-kias-re-kr-15230
use std::cmp::max;
use std::collections::VecDeque;
macro_rules! loop_perm {
($src_queue:ident, $src_queue_len:literal, $target_stack:ident => $code:block) => {
for _ in 0..$src_queue_len {
$target_stack.push($src_queue.pop_back().unwrap());
$code
$src_queue.push_front($target_stack.pop().unwrap());
}
@AcrylicShrimp
AcrylicShrimp / mcts_pure.py
Last active March 8, 2020 13:05
A pure MCTS implementation written in Python 3.
import math
import random
import torch
from game import Game
import math
import random
import torch
from torch.distributions.dirichlet import Dirichlet
from game import Game