This file contains hidden or 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
-- Original: https://zenn.dev/kirimin/articles/3abcada2b1646f by kirimin https://github.com/kirimin | |
-- convention of voice/text file: "num_character_content" + ".wav" or ".txt" | |
-- Replace configs here | |
local TEXT_DIR = "/Users/mikuroxina/Documents/Projects/Scripts/pencil-puzzles/05/voices/" -- folder contains txt and wav | |
local AUDIO_TRACK = 2 -- number of audio track placed character voices | |
local CHARACTERS = { "中国うさぎ" } -- names of character, used in file name | |
-- -------------------------------------------------- |
This file contains hidden or 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::marker::PhantomData; | |
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] | |
pub enum Z {} | |
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] | |
pub struct S<Z>(PhantomData<Z>); | |
/// `Int<M, N>` represents an integer `M - N`. | |
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] | |
pub struct Int<M, N>(i64, PhantomData<(M, N)>); |
This file contains hidden or 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
/// Finds the ceiling value of square root of `n`. | |
pub fn ceil_sqrt(n: i64) -> i64 { | |
let mut base = (n as f64).sqrt() as i64 - 1; | |
while (base + 1) * (base + 1) <= n { | |
base += 1; | |
} | |
base | |
} |
This file contains hidden or 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
{-# LANGUAGE LambdaCase #-} | |
{-# OPTIONS_GHC -Wno-name-shadowing #-} | |
module Lib ( | |
(+++), | |
chainL, | |
chainR, | |
char, | |
delimited, | |
integer, |
This file contains hidden or 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
import Control.Monad.State.Lazy | |
import qualified Data.Map.Strict as Map | |
import Data.Maybe | |
data Op = Plus | Minus | And | Or deriving (Show) | |
newtype VarName = VarName (String) deriving (Show, Ord, Eq) | |
data Expr | |
= Var (VarName) |
This file contains hidden or 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
export type SizedArray<N extends number, T> = SizedArrayInner<N, T, []>; | |
type SizedArrayInner< | |
N extends number, | |
T, | |
Acc extends unknown[], | |
> = N extends PositiveInteger<N> | |
? number extends N | |
? T[] | |
: N extends Acc["length"] |
This file contains hidden or 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 main | |
import ( | |
"fmt" | |
"html" | |
"log" | |
"net/http" | |
"strconv" | |
"strings" | |
"time" |
This file contains hidden or 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
/// Searches the maximum value of `query` in section between `lower` (exclusive) and `upper` (exclusive). | |
fn fibonacci_section(lower: usize, upper: usize, mut query: impl FnMut(usize) -> u32) -> u32 { | |
let n = upper - lower - 1; | |
if n == 1 { | |
return query(1); | |
} | |
let mut fib = vec![1, 2]; | |
for i in 2.. { | |
let next = fib[i - 2] + fib[i - 1]; | |
if next > n { |
This file contains hidden or 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
/// Design reference: https://zenn.dev/yuhi_junior/articles/062cf4f30b083d | |
use itertools::Itertools; | |
use std::cell::RefCell; | |
use std::rc::Rc; | |
#[derive(Debug, Clone, PartialEq, Eq)] | |
pub struct Cell { | |
has_bomb: bool, | |
flagged: bool, |
This file contains hidden or 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
#![feature(float_next_up_down)] | |
//! Source: http://verifiedby.me/adiary/pub/kashi/image/201406/nas2014.pdf | |
/// Floating point number with mathematical error. | |
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)] | |
pub struct F64E { | |
/// An actual result by the default rounding mode. | |
base: f64, | |
/// Mathematical error for an ideal result. |
NewerOlder