Skip to content

Instantly share code, notes, and snippets.

View AcrylicShrimp's full-sized avatar
⚙️
Working

AcrylicShrimp AcrylicShrimp

⚙️
Working
View GitHub Profile
@AcrylicShrimp
AcrylicShrimp / download_gallery_from_hitomi.py
Last active November 10, 2019 13:07
hitomi.la gallery download code
pub struct FuncGen<'ctx> {
pub function: FunctionValue<'ctx>,
pub prototype: FuncPrototype<'ctx>,
pub statement_stack: Vec<StatementGen<'ctx>>,
pub scope_stack: Vec<ScopeGen<'ctx>>,
}
pub struct StatementGen<'ctx> {
pub name: String,
pub entry_block_gen: BlockGen<'ctx>,
@AcrylicShrimp
AcrylicShrimp / gotcha.js
Last active February 27, 2020 07:59
Implementing gotcha system.
const itemArray = [
['banana-1000', 0.65],
['choco-960', 0.65],
['back-0', 13.7 / 16],
['back-1', 13.7 / 16],
['back-2', 13.7 / 16],
['char-0', 13.7 / 16],
['char-1', 13.7 / 16],
['char-2', 13.7 / 16],
['char-3', 13.7 / 16],
import math
import random
import torch
from torch.distributions.dirichlet import Dirichlet
from game import Game
@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
@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 / 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 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 / 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 / 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};