Skip to content

Instantly share code, notes, and snippets.

View sor4chi's full-sized avatar

Sor4chi sor4chi

View GitHub Profile
@sor4chi
sor4chi / main.tsx
Created January 29, 2025 06:18
Hono SPA Router
import {
MouseEventHandler,
ReactNode,
StrictMode,
useCallback,
useSyncExternalStore,
} from "react";
import { createRoot } from "react-dom/client";
import { Hono } from "hono";
import { Action, createBrowserHistory, Update } from "history";
import numpy as np
max_values = list(map(int, input().split()))
dice_counts = np.arange(1, 6)
prior_probs = np.ones(len(dice_counts)) / len(dice_counts)
def likelihood(max_val, dice_count):
@sor4chi
sor4chi / index.test.ts
Created January 26, 2024 18:25
Biome Sort Problem repro
import { afterAll, beforeAll, describe, expect, test } from "vitest";
import { unstable_dev } from "wrangler";
const images = ["test01.png", "test02.jpg", "test03.avif", "test04.gif"];
const imageUrl = (image: string) =>
`https://raw.githubusercontent.com/SoraKumo001/cloudflare-workers-image-optimization/master/images/${image}`;
describe("Wrangler", () => {
const property = beforeAll(async () => {
const worker = await unstable_dev("../src/index.ts", {
import { Hono } from "hono";
import { validator } from "hono/validator";
import { createFactory } from "hono/factory";
import { testClient } from "hono/testing";
const app = new Hono();
const factory = createFactory();
const handler = factory.createHandlers(
@sor4chi
sor4chi / webken-1.md
Created April 24, 2023 09:05
the first docs of Maximum'S Web Circle
date title author tags
2023-04-24
Webって何?触ってみよう
sor4chi
web
html
css
javascript

はじめに

Webは知らないといけない知識がとても多く、挫折しやすい分野です。特に自分のレベルから上の技術に挑戦しようとすると、すぐに挫折してしまうことが多いです。

#include <stdio.h>
// Define a struct to represent an LZ77 code
struct LZ77 {
int pos; // position of the longest match in the input string
int len; // length of the match
char next; // next character in the input string after the match
};
// Encode the input string using the LZ77 algorithm
@sor4chi
sor4chi / .zshrc
Created February 15, 2022 13:39
This is how to configure zsh-autosuggestions use in Oh My Posh(MacOS)
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh-completions:$FPATH
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
autoload -Uz compinit && compinit
fi
@sor4chi
sor4chi / tent_map.py
Last active October 27, 2021 16:37
情報システム工学入門_04 レポート課題1回答
x = [0.13, 0.13 + 10 ** -10]
dif_1 = abs(x[0]-x[1])
dif = 0
counter = 0
while (dif < dif_1 * 1000):
counter += 1
for i,value in enumerate(x):
x[i] = 2*value if value < 0.5 else -2*value + 2
dif = abs(x[0]-x[1])
print(counter)