mirror of
https://github.com/kou029w/_.git
synced 2025-04-02 19:16:23 +00:00
Compare commits
45 commits
Author | SHA1 | Date | |
---|---|---|---|
cf2df3404b | |||
1926a1dbfc | |||
209623965e | |||
747beab8f8 | |||
b395df0932 | |||
8f13edab1e | |||
8b1036e9fb | |||
f55e325b40 | |||
428880002c | |||
3d8c2deba7 | |||
204673694b | |||
7f458326eb | |||
10d7e8f4c7 | |||
485537101b | |||
c2ea74cf70 | |||
0bda09bafb | |||
75ba18676f | |||
d314e83b18 | |||
ffe2af2621 | |||
876d84fb75 | |||
3ef34e52e2 | |||
2794034e55 | |||
84b0494547 | |||
aa1ba85751 | |||
785fe1a122 | |||
772eb9f5d7 | |||
d39897e834 | |||
fa2e298e62 | |||
0fa1ac35b5 | |||
07f7302115 | |||
31c822e1c1 | |||
41a5be34b4 | |||
051d8906d5 | |||
65d2e4a71f | |||
08f797b3f2 | |||
acabdaec8c | |||
07d437da3d | |||
6a43e9ddbe | |||
c5b6327a2e | |||
e9b42a86e4 | |||
ef737c75b5 | |||
e834f57b2d | |||
6c8a9adcb8 | |||
c0a5e05a32 | |||
a31c92a13d |
142 changed files with 29687 additions and 3952 deletions
.github
.gitignoreastro-fastify-ssg
astro-fastify
bitnet
deno-playwright
deno
docker-playwright
docmost
eslint-plugin-tailwindcss
.eslintrc.cjs.gitignoreREADME.mdindex.htmlpackage-lock.jsonpackage.json
public
src
tailwind.config.jsvite.config.jsfastify-validation
goose
groq
histfilesize
hoarder
hono
jose
kamal
kita
metube
node-test
playwright-screenshot
playwright
poppler-rs
serialize-error
11
.github/ISSUE_TEMPLATE/bug.yml
vendored
Normal file
11
.github/ISSUE_TEMPLATE/bug.yml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
name: Bug Report
|
||||
description: File a bug report.
|
||||
title: "[Bug]: "
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe the bug
|
14
.github/workflows/add-project.yml
vendored
14
.github/workflows/add-project.yml
vendored
|
@ -1,14 +0,0 @@
|
|||
name: Add bugs to bugs project
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
jobs:
|
||||
add-to-project:
|
||||
name: Add issue to project
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/add-to-project@v0.5.0
|
||||
with:
|
||||
project-url: https://github.com/users/kou029w/projects/2
|
||||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
20
.github/workflows/auto-move-to-in-progress-on-assign.yml
vendored
Normal file
20
.github/workflows/auto-move-to-in-progress-on-assign.yml
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
name: Auto Move to In Progress on Assign
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- assigned
|
||||
jobs:
|
||||
move-to-in-progress:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Move Issue to In Progress
|
||||
run: |
|
||||
PROJECT_NODE_ID=$(gh project view --owner "${{ github.repository_owner }}" "${PROJECT_ID}" --format json --jq .id)
|
||||
PROJECT_ITEM_ID=$(ISSUE_NUMBER="${{ github.event.issue.number }}" gh project item-list --owner "${{ github.repository_owner }}" "${PROJECT_ID}" --limit 100000 --format json --jq '.items[] | select(.content.repository == env.GITHUB_REPOSITORY and .content.number == (env.ISSUE_NUMBER | tonumber)) | .id')
|
||||
gh project item-edit --project-id "${PROJECT_NODE_ID}" --id "${PROJECT_ITEM_ID}" --field-id "${STATUS_FIELD_ID}" --single-select-option-id "${IN_PROGRESS_STATUS_ID}"
|
||||
env:
|
||||
# read:org project
|
||||
GITHUB_TOKEN: "${{ secrets.ADD_TO_PROJECT_PAT }}"
|
||||
PROJECT_ID: "2"
|
||||
STATUS_FIELD_ID: PVTSSF_lAHOABpmus0uuM4AAVPr
|
||||
IN_PROGRESS_STATUS_ID: "98236657"
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
node_modules/
|
||||
dist/
|
||||
test-results/
|
||||
.next/
|
||||
.env
|
||||
|
|
19
astro-fastify-ssg/package.json
Normal file
19
astro-fastify-ssg/package.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "@kou029w/astro-fastify-ssg",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "fastify start --log-level=info --debug --watch server.js -- --dev",
|
||||
"build": "astro build",
|
||||
"start": "fastify start server.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fastify/http-proxy": "^9.5.0",
|
||||
"@fastify/static": "^7.0.1",
|
||||
"astro": "^4.5.9",
|
||||
"fastify": "^4.26.2",
|
||||
"fastify-cli": "^6.1.1"
|
||||
}
|
||||
}
|
4440
astro-fastify-ssg/pnpm-lock.yaml
generated
Normal file
4440
astro-fastify-ssg/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load diff
1
astro-fastify-ssg/public/public.txt
Normal file
1
astro-fastify-ssg/public/public.txt
Normal file
|
@ -0,0 +1 @@
|
|||
public
|
25
astro-fastify-ssg/server.js
Normal file
25
astro-fastify-ssg/server.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import fastifyStatic from "@fastify/static";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
/** @type {import("fastify").FastifyPluginAsync} */
|
||||
const app = async (fastify, opts) => {
|
||||
fastify.get("/hello", async () => "hello");
|
||||
|
||||
if (opts.dev) {
|
||||
const astro = await import("astro");
|
||||
const astroDevServer = await astro.dev({
|
||||
root: fileURLToPath(import.meta.resolve(".")),
|
||||
});
|
||||
await fastify.register(await import("@fastify/http-proxy"), {
|
||||
upstream: `http://localhost:${astroDevServer.address.port}`,
|
||||
});
|
||||
} else {
|
||||
await fastify.register(fastifyStatic, {
|
||||
root: fileURLToPath(import.meta.resolve("./dist")),
|
||||
});
|
||||
}
|
||||
|
||||
fastify.get("/world", async () => "world");
|
||||
};
|
||||
|
||||
export default app;
|
1
astro-fastify-ssg/src/env.d.ts
vendored
Normal file
1
astro-fastify-ssg/src/env.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/// <reference types="astro/client" />
|
1
astro-fastify-ssg/src/pages/index.md
Normal file
1
astro-fastify-ssg/src/pages/index.md
Normal file
|
@ -0,0 +1 @@
|
|||
**Hello, World!**
|
9
astro-fastify/astro.config.ts
Normal file
9
astro-fastify/astro.config.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { defineConfig } from "astro/config";
|
||||
import node from "@astrojs/node";
|
||||
|
||||
export default defineConfig({
|
||||
output: "server",
|
||||
adapter: node({
|
||||
mode: "middleware",
|
||||
}),
|
||||
});
|
21
astro-fastify/package.json
Normal file
21
astro-fastify/package.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "@kou029w/astro-fastify",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "fastify start --log-level=info --debug --watch server.js -- --dev",
|
||||
"build": "astro build",
|
||||
"start": "fastify start server.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/node": "^8.2.5",
|
||||
"@fastify/http-proxy": "^9.5.0",
|
||||
"@fastify/middie": "^8.3.0",
|
||||
"@fastify/static": "^7.0.1",
|
||||
"astro": "^4.5.9",
|
||||
"fastify": "^4.26.2",
|
||||
"fastify-cli": "^6.1.1"
|
||||
}
|
||||
}
|
4553
astro-fastify/pnpm-lock.yaml
generated
Normal file
4553
astro-fastify/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load diff
1
astro-fastify/public/public.txt
Normal file
1
astro-fastify/public/public.txt
Normal file
|
@ -0,0 +1 @@
|
|||
public
|
29
astro-fastify/server.js
Normal file
29
astro-fastify/server.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
import fastifyMiddie from "@fastify/middie";
|
||||
import fastifyStatic from "@fastify/static";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
/** @type {import("fastify").FastifyPluginAsync} */
|
||||
const app = async (fastify, opts) => {
|
||||
fastify.get("/hello", async () => "hello");
|
||||
|
||||
if (opts.dev) {
|
||||
const astro = await import("astro");
|
||||
const astroDevServer = await astro.dev({
|
||||
root: fileURLToPath(import.meta.resolve(".")),
|
||||
});
|
||||
await fastify.register(await import("@fastify/http-proxy"), {
|
||||
upstream: `http://localhost:${astroDevServer.address.port}`,
|
||||
});
|
||||
} else {
|
||||
await fastify.register(fastifyStatic, {
|
||||
root: fileURLToPath(import.meta.resolve("./dist/client")),
|
||||
});
|
||||
await fastify.register(fastifyMiddie);
|
||||
const astroServer = await import("./dist/server/entry.mjs");
|
||||
fastify.use(astroServer.handler);
|
||||
}
|
||||
|
||||
fastify.get("/world", async () => "world");
|
||||
};
|
||||
|
||||
export default app;
|
1
astro-fastify/src/env.d.ts
vendored
Normal file
1
astro-fastify/src/env.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/// <reference types="astro/client" />
|
9
astro-fastify/src/pages/index.ts
Normal file
9
astro-fastify/src/pages/index.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import type { APIRoute } from "astro";
|
||||
|
||||
export const GET: APIRoute = () => {
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
number: Math.random(),
|
||||
}),
|
||||
);
|
||||
};
|
14
bitnet/Dockerfile
Normal file
14
bitnet/Dockerfile
Normal file
|
@ -0,0 +1,14 @@
|
|||
FROM python:3.9-alpine
|
||||
RUN apk add --no-cache build-base cmake clang git && \
|
||||
rm -rf /var/cache/apk/*
|
||||
RUN git clone --recursive --depth 1 https://github.com/microsoft/BitNet.git && \
|
||||
rm -rf BitNet/.git
|
||||
WORKDIR /BitNet
|
||||
RUN pip install -r requirements.txt && \
|
||||
pip cache purge
|
||||
RUN python3 utils/codegen_tl2.py --model Llama3-8B-1.58-100B-tokens --BM 256,128,256,128 --BK 96,96,96,96 --bm 32,32,32,32
|
||||
RUN cmake -B build -DBITNET_X86_TL2=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
||||
RUN cmake --build build --target llama-cli --config Release
|
||||
ADD https://huggingface.co/brunopio/Llama3-8B-1.58-100B-tokens-GGUF/resolve/main/Llama3-8B-1.58-100B-tokens-TQ2_0.gguf .
|
||||
RUN echo "2565559c82a1d03ecd1101f536c5e99418d07e55a88bd5e391ed734f6b3989ac Llama3-8B-1.58-100B-tokens-TQ2_0.gguf" | sha256sum -c
|
||||
CMD ["python3", "run_inference.py", "-m", "Llama3-8B-1.58-100B-tokens-TQ2_0.gguf", "-p", "The sky is blue due to a phenomenon called"]
|
4
deno-playwright/README.md
Normal file
4
deno-playwright/README.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
```
|
||||
$ deno -A npm:playwright install
|
||||
$ deno -A main.ts
|
||||
```
|
5
deno-playwright/deno.json
Normal file
5
deno-playwright/deno.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"imports": {
|
||||
"playwright": "npm:playwright@^1.48.2"
|
||||
}
|
||||
}
|
27
deno-playwright/deno.lock
generated
Normal file
27
deno-playwright/deno.lock
generated
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"version": "4",
|
||||
"specifiers": {
|
||||
"npm:playwright@*": "1.48.2",
|
||||
"npm:playwright@^1.48.2": "1.48.2"
|
||||
},
|
||||
"npm": {
|
||||
"fsevents@2.3.2": {
|
||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
|
||||
},
|
||||
"playwright-core@1.48.2": {
|
||||
"integrity": "sha512-sjjw+qrLFlriJo64du+EK0kJgZzoQPsabGF4lBvsid+3CNIZIYLgnMj9V6JY5VhM2Peh20DJWIVpVljLLnlawA=="
|
||||
},
|
||||
"playwright@1.48.2": {
|
||||
"integrity": "sha512-NjYvYgp4BPmiwfe31j4gHLa3J7bD2WiBz8Lk2RoSsmX38SVIARZ18VYjxLjAcDsAhA+F4iSEXTSGgjua0rrlgQ==",
|
||||
"dependencies": [
|
||||
"fsevents",
|
||||
"playwright-core"
|
||||
]
|
||||
}
|
||||
},
|
||||
"workspace": {
|
||||
"dependencies": [
|
||||
"npm:playwright@^1.48.2"
|
||||
]
|
||||
}
|
||||
}
|
8
deno-playwright/main.ts
Normal file
8
deno-playwright/main.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { chromium } from "npm:playwright";
|
||||
|
||||
const browser = await chromium.launch({ headless: false });
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.goto("https://example.com");
|
||||
await new Promise((r) => setTimeout(r, 10_000));
|
||||
await browser.close();
|
13
deno/deno.json
Normal file
13
deno/deno.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"tasks": {
|
||||
"dev": "deno run --watch main.ts"
|
||||
},
|
||||
"deploy": {
|
||||
"project": "d7ff4021-31bb-4663-b015-12a9e7b9bb64",
|
||||
"exclude": [
|
||||
"**/node_modules"
|
||||
],
|
||||
"include": [],
|
||||
"entrypoint": "main.ts"
|
||||
}
|
||||
}
|
8
deno/main.ts
Normal file
8
deno/main.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
const now = new Date();
|
||||
|
||||
if (import.meta.main) {
|
||||
Deno.serve(() => new Response(`${now}: Hello World!`));
|
||||
}
|
||||
|
||||
// $ curl https://great-crow-36.deno.dev/
|
||||
// Mon Apr 22 2024 03:13:21 GMT+0000 (Coordinated Universal Time): Hello World!
|
|
@ -1,26 +0,0 @@
|
|||
# デスクトップ環境で Docker イメージを使って Playwright のブラウザーを起動してみる
|
||||
|
||||
WebKit の環境が必要だったので構築してみた。
|
||||
|
||||
Ubuntu ならば Playwright が公式にサポートしているためホントは不要だが、環境を汚さないので便利かもしれないと思った。
|
||||
|
||||
## 前提
|
||||
|
||||
- Docker
|
||||
- X11 の UNIX ドメインソケットが/tmp/.X11-unix に存在すること
|
||||
|
||||
## やり方
|
||||
|
||||
```sh
|
||||
docker run --rm -it -u $(id -u):$(id -g) -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix mcr.microsoft.com/playwright npx playwright wk example.com
|
||||
```
|
||||
|
||||
Digest: `sha256:310e3ca5bb884f4b9a4a8452dbabda4a35ac62a0d6f46eee953558e8d7d4cfb0`
|
||||
|
||||
### Docker Compose の場合
|
||||
|
||||
```bash
|
||||
echo UID=$(id -u) >> .env
|
||||
echo GID=$(id -g) >> .env
|
||||
docker-compose up
|
||||
```
|
|
@ -1,8 +0,0 @@
|
|||
version: "3"
|
||||
services:
|
||||
playwright:
|
||||
image: mcr.microsoft.com/playwright
|
||||
user: "${UID}:${GID}"
|
||||
environment: [DISPLAY]
|
||||
volumes: ["/tmp/.X11-unix:/tmp/.X11-unix"]
|
||||
command: npx playwright wk example.com
|
29
docmost/compose.yml
Normal file
29
docmost/compose.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
services:
|
||||
docmost:
|
||||
image: docmost/docmost:latest
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
environment:
|
||||
APP_URL: http://localhost:3000
|
||||
APP_SECRET: "${APP_SECRET}"
|
||||
DATABASE_URL: postgresql://docmost:${POSTGRES_PASSWORD}@db:5432/docmost?schema=public
|
||||
REDIS_URL: redis://redis:6379
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./docmost:/app/data/storage
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
POSTGRES_DB: docmost
|
||||
POSTGRES_USER: docmost
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./db_data:/var/lib/postgresql/data
|
||||
redis:
|
||||
image: redis:7.2-alpine
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./redis_data:/data
|
28
eslint-plugin-tailwindcss/.eslintrc.cjs
Normal file
28
eslint-plugin-tailwindcss/.eslintrc.cjs
Normal file
|
@ -0,0 +1,28 @@
|
|||
module.exports = {
|
||||
root: true,
|
||||
env: { browser: true, es2020: true },
|
||||
extends: [
|
||||
"eslint:recommended",
|
||||
"plugin:react/recommended",
|
||||
"plugin:react/jsx-runtime",
|
||||
"plugin:react-hooks/recommended",
|
||||
"plugin:tailwindcss/recommended",
|
||||
],
|
||||
ignorePatterns: ["dist", ".eslintrc.cjs"],
|
||||
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
|
||||
settings: { react: { version: "18.2" } },
|
||||
plugins: ["react-refresh"],
|
||||
rules: {
|
||||
"react/jsx-no-target-blank": "off",
|
||||
"react-refresh/only-export-components": [
|
||||
"warn",
|
||||
{ allowConstantExport: true },
|
||||
],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ["*.ts", "*.tsx", "*.js"],
|
||||
parser: "@typescript-eslint/parser",
|
||||
},
|
||||
],
|
||||
};
|
24
eslint-plugin-tailwindcss/.gitignore
vendored
Normal file
24
eslint-plugin-tailwindcss/.gitignore
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
8
eslint-plugin-tailwindcss/README.md
Normal file
8
eslint-plugin-tailwindcss/README.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# React + Vite
|
||||
|
||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||
|
||||
Currently, two official plugins are available:
|
||||
|
||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
13
eslint-plugin-tailwindcss/index.html
Normal file
13
eslint-plugin-tailwindcss/index.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + React</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
</body>
|
||||
</html>
|
5498
eslint-plugin-tailwindcss/package-lock.json
generated
Normal file
5498
eslint-plugin-tailwindcss/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
28
eslint-plugin-tailwindcss/package.json
Normal file
28
eslint-plugin-tailwindcss/package.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "my-project",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.2.64",
|
||||
"@types/react-dom": "^18.2.21",
|
||||
"@typescript-eslint/parser": "^7.2.0",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-react": "^7.34.0",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.5",
|
||||
"eslint-plugin-tailwindcss": "^3.15.1",
|
||||
"vite": "^5.1.6"
|
||||
}
|
||||
}
|
1
eslint-plugin-tailwindcss/public/vite.svg
Normal file
1
eslint-plugin-tailwindcss/public/vite.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
After (image error) Size: 1.5 KiB |
42
eslint-plugin-tailwindcss/src/App.css
Normal file
42
eslint-plugin-tailwindcss/src/App.css
Normal file
|
@ -0,0 +1,42 @@
|
|||
#root {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
transition: filter 300ms;
|
||||
}
|
||||
.logo:hover {
|
||||
filter: drop-shadow(0 0 2em #646cffaa);
|
||||
}
|
||||
.logo.react:hover {
|
||||
filter: drop-shadow(0 0 2em #61dafbaa);
|
||||
}
|
||||
|
||||
@keyframes logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
a:nth-of-type(2) .logo {
|
||||
animation: logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
}
|
19
eslint-plugin-tailwindcss/src/App.jsx
Normal file
19
eslint-plugin-tailwindcss/src/App.jsx
Normal file
|
@ -0,0 +1,19 @@
|
|||
import "./App.css";
|
||||
|
||||
function Text(props) {
|
||||
// eslint-disable-next-line react/prop-types
|
||||
return <div className={`w-1 ${props.className}`}>red text</div>;
|
||||
}
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<>
|
||||
{/* eslint-disable-next-line tailwindcss/no-contradicting-classname */}
|
||||
<Text className="container w-2 w-3" />
|
||||
{/* これはパス */}
|
||||
<Text className="container w-2" />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
1
eslint-plugin-tailwindcss/src/assets/react.svg
Normal file
1
eslint-plugin-tailwindcss/src/assets/react.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
After (image error) Size: 4 KiB |
68
eslint-plugin-tailwindcss/src/index.css
Normal file
68
eslint-plugin-tailwindcss/src/index.css
Normal file
|
@ -0,0 +1,68 @@
|
|||
:root {
|
||||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||
line-height: 1.5;
|
||||
font-weight: 400;
|
||||
|
||||
color-scheme: light dark;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
background-color: #242424;
|
||||
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #646cff;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
a:hover {
|
||||
color: #535bf2;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
place-items: center;
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3.2em;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 8px;
|
||||
border: 1px solid transparent;
|
||||
padding: 0.6em 1.2em;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
background-color: #1a1a1a;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.25s;
|
||||
}
|
||||
button:hover {
|
||||
border-color: #646cff;
|
||||
}
|
||||
button:focus,
|
||||
button:focus-visible {
|
||||
outline: 4px auto -webkit-focus-ring-color;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color: #213547;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
a:hover {
|
||||
color: #747bff;
|
||||
}
|
||||
button {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
}
|
10
eslint-plugin-tailwindcss/src/main.jsx
Normal file
10
eslint-plugin-tailwindcss/src/main.jsx
Normal file
|
@ -0,0 +1,10 @@
|
|||
import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import App from './App.jsx'
|
||||
import './index.css'
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
)
|
8
eslint-plugin-tailwindcss/tailwind.config.js
Normal file
8
eslint-plugin-tailwindcss/tailwind.config.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: [],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
};
|
7
eslint-plugin-tailwindcss/vite.config.js
Normal file
7
eslint-plugin-tailwindcss/vite.config.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
});
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"fastify": "^4.22.2"
|
||||
}
|
||||
}
|
393
fastify-validation/pnpm-lock.yaml
generated
393
fastify-validation/pnpm-lock.yaml
generated
|
@ -1,393 +0,0 @@
|
|||
lockfileVersion: '6.0'
|
||||
|
||||
devDependencies:
|
||||
fastify:
|
||||
specifier: ^4.22.2
|
||||
version: 4.22.2
|
||||
|
||||
packages:
|
||||
|
||||
/@fastify/ajv-compiler@3.5.0:
|
||||
resolution: {integrity: sha512-ebbEtlI7dxXF5ziNdr05mOY8NnDiPB1XvAlLHctRt/Rc+C3LCOVW5imUVX+mhvUhnNzmPBHewUkOFgGlCxgdAA==}
|
||||
dependencies:
|
||||
ajv: 8.12.0
|
||||
ajv-formats: 2.1.1(ajv@8.12.0)
|
||||
fast-uri: 2.2.0
|
||||
dev: true
|
||||
|
||||
/@fastify/deepmerge@1.3.0:
|
||||
resolution: {integrity: sha512-J8TOSBq3SoZbDhM9+R/u77hP93gz/rajSA+K2kGyijPpORPWUXHUpTaleoj+92As0S9uPRP7Oi8IqMf0u+ro6A==}
|
||||
dev: true
|
||||
|
||||
/@fastify/error@3.3.0:
|
||||
resolution: {integrity: sha512-dj7vjIn1Ar8sVXj2yAXiMNCJDmS9MQ9XMlIecX2dIzzhjSHCyKo4DdXjXMs7wKW2kj6yvVRSpuQjOZ3YLrh56w==}
|
||||
dev: true
|
||||
|
||||
/@fastify/fast-json-stringify-compiler@4.3.0:
|
||||
resolution: {integrity: sha512-aZAXGYo6m22Fk1zZzEUKBvut/CIIQe/BapEORnxiD5Qr0kPHqqI69NtEMCme74h+at72sPhbkb4ZrLd1W3KRLA==}
|
||||
dependencies:
|
||||
fast-json-stringify: 5.8.0
|
||||
dev: true
|
||||
|
||||
/abort-controller@3.0.0:
|
||||
resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==}
|
||||
engines: {node: '>=6.5'}
|
||||
dependencies:
|
||||
event-target-shim: 5.0.1
|
||||
dev: true
|
||||
|
||||
/abstract-logging@2.0.1:
|
||||
resolution: {integrity: sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==}
|
||||
dev: true
|
||||
|
||||
/ajv-formats@2.1.1(ajv@8.12.0):
|
||||
resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}
|
||||
peerDependencies:
|
||||
ajv: ^8.0.0
|
||||
peerDependenciesMeta:
|
||||
ajv:
|
||||
optional: true
|
||||
dependencies:
|
||||
ajv: 8.12.0
|
||||
dev: true
|
||||
|
||||
/ajv@8.12.0:
|
||||
resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==}
|
||||
dependencies:
|
||||
fast-deep-equal: 3.1.3
|
||||
json-schema-traverse: 1.0.0
|
||||
require-from-string: 2.0.2
|
||||
uri-js: 4.4.1
|
||||
dev: true
|
||||
|
||||
/archy@1.0.0:
|
||||
resolution: {integrity: sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==}
|
||||
dev: true
|
||||
|
||||
/atomic-sleep@1.0.0:
|
||||
resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
dev: true
|
||||
|
||||
/avvio@8.2.1:
|
||||
resolution: {integrity: sha512-TAlMYvOuwGyLK3PfBb5WKBXZmXz2fVCgv23d6zZFdle/q3gPjmxBaeuC0pY0Dzs5PWMSgfqqEZkrye19GlDTgw==}
|
||||
dependencies:
|
||||
archy: 1.0.0
|
||||
debug: 4.3.4
|
||||
fastq: 1.15.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/base64-js@1.5.1:
|
||||
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
||||
dev: true
|
||||
|
||||
/buffer@6.0.3:
|
||||
resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
|
||||
dependencies:
|
||||
base64-js: 1.5.1
|
||||
ieee754: 1.2.1
|
||||
dev: true
|
||||
|
||||
/cookie@0.5.0:
|
||||
resolution: {integrity: sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
dev: true
|
||||
|
||||
/debug@4.3.4:
|
||||
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
|
||||
engines: {node: '>=6.0'}
|
||||
peerDependencies:
|
||||
supports-color: '*'
|
||||
peerDependenciesMeta:
|
||||
supports-color:
|
||||
optional: true
|
||||
dependencies:
|
||||
ms: 2.1.2
|
||||
dev: true
|
||||
|
||||
/event-target-shim@5.0.1:
|
||||
resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/events@3.3.0:
|
||||
resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==}
|
||||
engines: {node: '>=0.8.x'}
|
||||
dev: true
|
||||
|
||||
/fast-content-type-parse@1.0.0:
|
||||
resolution: {integrity: sha512-Xbc4XcysUXcsP5aHUU7Nq3OwvHq97C+WnbkeIefpeYLX+ryzFJlU6OStFJhs6Ol0LkUGpcK+wL0JwfM+FCU5IA==}
|
||||
dev: true
|
||||
|
||||
/fast-decode-uri-component@1.0.1:
|
||||
resolution: {integrity: sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==}
|
||||
dev: true
|
||||
|
||||
/fast-deep-equal@3.1.3:
|
||||
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
||||
dev: true
|
||||
|
||||
/fast-json-stringify@5.8.0:
|
||||
resolution: {integrity: sha512-VVwK8CFMSALIvt14U8AvrSzQAwN/0vaVRiFFUVlpnXSnDGrSkOAO5MtzyN8oQNjLd5AqTW5OZRgyjoNuAuR3jQ==}
|
||||
dependencies:
|
||||
'@fastify/deepmerge': 1.3.0
|
||||
ajv: 8.12.0
|
||||
ajv-formats: 2.1.1(ajv@8.12.0)
|
||||
fast-deep-equal: 3.1.3
|
||||
fast-uri: 2.2.0
|
||||
rfdc: 1.3.0
|
||||
dev: true
|
||||
|
||||
/fast-querystring@1.1.2:
|
||||
resolution: {integrity: sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg==}
|
||||
dependencies:
|
||||
fast-decode-uri-component: 1.0.1
|
||||
dev: true
|
||||
|
||||
/fast-redact@3.3.0:
|
||||
resolution: {integrity: sha512-6T5V1QK1u4oF+ATxs1lWUmlEk6P2T9HqJG3e2DnHOdVgZy2rFJBoEnrIedcTXlkAHU/zKC+7KETJ+KGGKwxgMQ==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/fast-uri@2.2.0:
|
||||
resolution: {integrity: sha512-cIusKBIt/R/oI6z/1nyfe2FvGKVTohVRfvkOhvx0nCEW+xf5NoCXjAHcWp93uOUBchzYcsvPlrapAdX1uW+YGg==}
|
||||
dev: true
|
||||
|
||||
/fastify@4.22.2:
|
||||
resolution: {integrity: sha512-rK8mF/1mZJHH6H/L22OhmilTgrp5XMkk3RHcSy03LC+TJ6+wLhbq+4U62bjns15VzIbBNgxTqAForBqtGAa0NQ==}
|
||||
dependencies:
|
||||
'@fastify/ajv-compiler': 3.5.0
|
||||
'@fastify/error': 3.3.0
|
||||
'@fastify/fast-json-stringify-compiler': 4.3.0
|
||||
abstract-logging: 2.0.1
|
||||
avvio: 8.2.1
|
||||
fast-content-type-parse: 1.0.0
|
||||
fast-json-stringify: 5.8.0
|
||||
find-my-way: 7.6.2
|
||||
light-my-request: 5.10.0
|
||||
pino: 8.15.1
|
||||
process-warning: 2.2.0
|
||||
proxy-addr: 2.0.7
|
||||
rfdc: 1.3.0
|
||||
secure-json-parse: 2.7.0
|
||||
semver: 7.5.4
|
||||
tiny-lru: 11.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/fastq@1.15.0:
|
||||
resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==}
|
||||
dependencies:
|
||||
reusify: 1.0.4
|
||||
dev: true
|
||||
|
||||
/find-my-way@7.6.2:
|
||||
resolution: {integrity: sha512-0OjHn1b1nCX3eVbm9ByeEHiscPYiHLfhei1wOUU9qffQkk98wE0Lo8VrVYfSGMgnSnDh86DxedduAnBf4nwUEw==}
|
||||
engines: {node: '>=14'}
|
||||
dependencies:
|
||||
fast-deep-equal: 3.1.3
|
||||
fast-querystring: 1.1.2
|
||||
safe-regex2: 2.0.0
|
||||
dev: true
|
||||
|
||||
/forwarded@0.2.0:
|
||||
resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
|
||||
engines: {node: '>= 0.6'}
|
||||
dev: true
|
||||
|
||||
/ieee754@1.2.1:
|
||||
resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
|
||||
dev: true
|
||||
|
||||
/ipaddr.js@1.9.1:
|
||||
resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}
|
||||
engines: {node: '>= 0.10'}
|
||||
dev: true
|
||||
|
||||
/json-schema-traverse@1.0.0:
|
||||
resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==}
|
||||
dev: true
|
||||
|
||||
/light-my-request@5.10.0:
|
||||
resolution: {integrity: sha512-ZU2D9GmAcOUculTTdH9/zryej6n8TzT+fNGdNtm6SDp5MMMpHrJJkvAdE3c6d8d2chE9i+a//dS9CWZtisknqA==}
|
||||
dependencies:
|
||||
cookie: 0.5.0
|
||||
process-warning: 2.2.0
|
||||
set-cookie-parser: 2.6.0
|
||||
dev: true
|
||||
|
||||
/lru-cache@6.0.0:
|
||||
resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
|
||||
engines: {node: '>=10'}
|
||||
dependencies:
|
||||
yallist: 4.0.0
|
||||
dev: true
|
||||
|
||||
/ms@2.1.2:
|
||||
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
||||
dev: true
|
||||
|
||||
/on-exit-leak-free@2.1.0:
|
||||
resolution: {integrity: sha512-VuCaZZAjReZ3vUwgOB8LxAosIurDiAW0s13rI1YwmaP++jvcxP77AWoQvenZebpCA2m8WC1/EosPYPMjnRAp/w==}
|
||||
dev: true
|
||||
|
||||
/pino-abstract-transport@1.1.0:
|
||||
resolution: {integrity: sha512-lsleG3/2a/JIWUtf9Q5gUNErBqwIu1tUKTT3dUzaf5DySw9ra1wcqKjJjLX1VTY64Wk1eEOYsVGSaGfCK85ekA==}
|
||||
dependencies:
|
||||
readable-stream: 4.4.2
|
||||
split2: 4.2.0
|
||||
dev: true
|
||||
|
||||
/pino-std-serializers@6.2.2:
|
||||
resolution: {integrity: sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA==}
|
||||
dev: true
|
||||
|
||||
/pino@8.15.1:
|
||||
resolution: {integrity: sha512-Cp4QzUQrvWCRJaQ8Lzv0mJzXVk4z2jlq8JNKMGaixC2Pz5L4l2p95TkuRvYbrEbe85NQsDKrAd4zalf7Ml6WiA==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
atomic-sleep: 1.0.0
|
||||
fast-redact: 3.3.0
|
||||
on-exit-leak-free: 2.1.0
|
||||
pino-abstract-transport: 1.1.0
|
||||
pino-std-serializers: 6.2.2
|
||||
process-warning: 2.2.0
|
||||
quick-format-unescaped: 4.0.4
|
||||
real-require: 0.2.0
|
||||
safe-stable-stringify: 2.4.3
|
||||
sonic-boom: 3.3.0
|
||||
thread-stream: 2.4.0
|
||||
dev: true
|
||||
|
||||
/process-warning@2.2.0:
|
||||
resolution: {integrity: sha512-/1WZ8+VQjR6avWOgHeEPd7SDQmFQ1B5mC1eRXsCm5TarlNmx/wCsa5GEaxGm05BORRtyG/Ex/3xq3TuRvq57qg==}
|
||||
dev: true
|
||||
|
||||
/process@0.11.10:
|
||||
resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==}
|
||||
engines: {node: '>= 0.6.0'}
|
||||
dev: true
|
||||
|
||||
/proxy-addr@2.0.7:
|
||||
resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==}
|
||||
engines: {node: '>= 0.10'}
|
||||
dependencies:
|
||||
forwarded: 0.2.0
|
||||
ipaddr.js: 1.9.1
|
||||
dev: true
|
||||
|
||||
/punycode@2.3.0:
|
||||
resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/quick-format-unescaped@4.0.4:
|
||||
resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==}
|
||||
dev: true
|
||||
|
||||
/readable-stream@4.4.2:
|
||||
resolution: {integrity: sha512-Lk/fICSyIhodxy1IDK2HazkeGjSmezAWX2egdtJnYhtzKEsBPJowlI6F6LPb5tqIQILrMbx22S5o3GuJavPusA==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
dependencies:
|
||||
abort-controller: 3.0.0
|
||||
buffer: 6.0.3
|
||||
events: 3.3.0
|
||||
process: 0.11.10
|
||||
string_decoder: 1.3.0
|
||||
dev: true
|
||||
|
||||
/real-require@0.2.0:
|
||||
resolution: {integrity: sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==}
|
||||
engines: {node: '>= 12.13.0'}
|
||||
dev: true
|
||||
|
||||
/require-from-string@2.0.2:
|
||||
resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/ret@0.2.2:
|
||||
resolution: {integrity: sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/reusify@1.0.4:
|
||||
resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
|
||||
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/rfdc@1.3.0:
|
||||
resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==}
|
||||
dev: true
|
||||
|
||||
/safe-buffer@5.2.1:
|
||||
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
|
||||
dev: true
|
||||
|
||||
/safe-regex2@2.0.0:
|
||||
resolution: {integrity: sha512-PaUSFsUaNNuKwkBijoAPHAK6/eM6VirvyPWlZ7BAQy4D+hCvh4B6lIG+nPdhbFfIbP+gTGBcrdsOaUs0F+ZBOQ==}
|
||||
dependencies:
|
||||
ret: 0.2.2
|
||||
dev: true
|
||||
|
||||
/safe-stable-stringify@2.4.3:
|
||||
resolution: {integrity: sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==}
|
||||
engines: {node: '>=10'}
|
||||
dev: true
|
||||
|
||||
/secure-json-parse@2.7.0:
|
||||
resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==}
|
||||
dev: true
|
||||
|
||||
/semver@7.5.4:
|
||||
resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
lru-cache: 6.0.0
|
||||
dev: true
|
||||
|
||||
/set-cookie-parser@2.6.0:
|
||||
resolution: {integrity: sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==}
|
||||
dev: true
|
||||
|
||||
/sonic-boom@3.3.0:
|
||||
resolution: {integrity: sha512-LYxp34KlZ1a2Jb8ZQgFCK3niIHzibdwtwNUWKg0qQRzsDoJ3Gfgkf8KdBTFU3SkejDEIlWwnSnpVdOZIhFMl/g==}
|
||||
dependencies:
|
||||
atomic-sleep: 1.0.0
|
||||
dev: true
|
||||
|
||||
/split2@4.2.0:
|
||||
resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==}
|
||||
engines: {node: '>= 10.x'}
|
||||
dev: true
|
||||
|
||||
/string_decoder@1.3.0:
|
||||
resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}
|
||||
dependencies:
|
||||
safe-buffer: 5.2.1
|
||||
dev: true
|
||||
|
||||
/thread-stream@2.4.0:
|
||||
resolution: {integrity: sha512-xZYtOtmnA63zj04Q+F9bdEay5r47bvpo1CaNqsKi7TpoJHcotUez8Fkfo2RJWpW91lnnaApdpRbVwCWsy+ifcw==}
|
||||
dependencies:
|
||||
real-require: 0.2.0
|
||||
dev: true
|
||||
|
||||
/tiny-lru@11.0.1:
|
||||
resolution: {integrity: sha512-iNgFugVuQgBKrqeO/mpiTTgmBsTP0WL6yeuLfLs/Ctf0pI/ixGqIRm8sDCwMcXGe9WWvt2sGXI5mNqZbValmJg==}
|
||||
engines: {node: '>=12'}
|
||||
dev: true
|
||||
|
||||
/uri-js@4.4.1:
|
||||
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
||||
dependencies:
|
||||
punycode: 2.3.0
|
||||
dev: true
|
||||
|
||||
/yallist@4.0.0:
|
||||
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
|
||||
dev: true
|
|
@ -1,25 +0,0 @@
|
|||
import fastify from "fastify";
|
||||
|
||||
const server = fastify({ logger: true });
|
||||
|
||||
server.get("/", {
|
||||
schema: {
|
||||
querystring: {
|
||||
type: "object",
|
||||
properties: { dateTime: { type: "string", format: "date-time" } },
|
||||
required: ["dateTime"],
|
||||
},
|
||||
},
|
||||
handler() {
|
||||
return "ok";
|
||||
},
|
||||
});
|
||||
|
||||
// valid
|
||||
await server.inject("/?dateTime=2021-09-10T15:30:00Z");
|
||||
|
||||
// valid
|
||||
await server.inject("/?dateTime=2021-09-10T15:30:00");
|
||||
|
||||
// invalid: querystring/dateTime must match format "date-time"
|
||||
await server.inject("/?dateTime=2021-09-10");
|
106
fastify-validation/server.ts
Executable file
106
fastify-validation/server.ts
Executable file
|
@ -0,0 +1,106 @@
|
|||
#!/usr/bin/env -S deno run -A
|
||||
import fastify from "npm:fastify";
|
||||
// import { parse as jsonParse } from "npm:secure-json-parse";
|
||||
|
||||
const server = fastify({ logger: true });
|
||||
|
||||
server.get("/anyOf", {
|
||||
schema: {
|
||||
querystring: {
|
||||
type: "object",
|
||||
properties: {
|
||||
array: {
|
||||
anyOf: [
|
||||
{ type: "array", items: { type: "string" } },
|
||||
{ type: "string" },
|
||||
],
|
||||
},
|
||||
},
|
||||
required: ["array"],
|
||||
},
|
||||
},
|
||||
handler({ query }) {
|
||||
console.log({ ...query });
|
||||
return "ok";
|
||||
},
|
||||
});
|
||||
|
||||
server.get("/oneOf", {
|
||||
schema: {
|
||||
querystring: {
|
||||
type: "object",
|
||||
properties: {
|
||||
array: {
|
||||
oneOf: [
|
||||
{ type: "array", items: { type: "string" } },
|
||||
{ type: "string" },
|
||||
],
|
||||
},
|
||||
},
|
||||
required: ["array"],
|
||||
},
|
||||
},
|
||||
handler({ query }) {
|
||||
console.log({ ...query });
|
||||
return "ok";
|
||||
},
|
||||
});
|
||||
|
||||
// valid
|
||||
await server.inject(`/anyOf?array=a`);
|
||||
|
||||
// invalid: querystring/array must match exactly one schema in oneOf
|
||||
await server.inject(`/oneOf?array=a`);
|
||||
|
||||
/*
|
||||
server.get("/array", {
|
||||
schema: {
|
||||
querystring: {
|
||||
type: "object",
|
||||
properties: { array: { type: "array", items: { type: "string" } } },
|
||||
required: ["array"],
|
||||
},
|
||||
},
|
||||
async preValidation(req) {
|
||||
req.query.array = [req.query.array].flat().flatMap((s) => {
|
||||
try {
|
||||
const parsed = jsonParse(s);
|
||||
return Array.isArray(parsed) ? parsed : [s];
|
||||
} catch {
|
||||
return [s];
|
||||
}
|
||||
});
|
||||
},
|
||||
handler({ query }) {
|
||||
console.log({ ...query });
|
||||
return "ok";
|
||||
},
|
||||
});
|
||||
|
||||
// valid
|
||||
await server.inject(`/array?array=["123",4]`);
|
||||
*/
|
||||
|
||||
/*
|
||||
server.get("/dateTime", {
|
||||
schema: {
|
||||
querystring: {
|
||||
type: "object",
|
||||
properties: { dateTime: { type: "string", format: "date-time" } },
|
||||
required: ["dateTime"],
|
||||
},
|
||||
},
|
||||
handler() {
|
||||
return "ok";
|
||||
},
|
||||
});
|
||||
|
||||
// valid
|
||||
await server.inject("/dateTime?dateTime=2021-09-10T15:30:00Z");
|
||||
|
||||
// valid: fasitfy@4.22.2, invalid fastify@5.1.0: querystring/dateTime must match format "date-time"
|
||||
await server.inject("/dateTime?dateTime=2021-09-10T15:30:00");
|
||||
|
||||
// invalid: querystring/dateTime must match format "date-time"
|
||||
await server.inject("/dateTime?dateTime=2021-09-10");
|
||||
*/
|
5
goose/README.md
Normal file
5
goose/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
https://block.github.io/goose/docs/quickstart/
|
||||
|
||||
```
|
||||
$ goose/hello.goose
|
||||
```
|
3
goose/hello.goose
Executable file
3
goose/hello.goose
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env -S goose run -i
|
||||
|
||||
ファイルtest.txtに「こんにちは」と書き込んでください
|
3
groq/README.md
Normal file
3
groq/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
```
|
||||
$ uv run main.py
|
||||
```
|
30
groq/main.py
Normal file
30
groq/main.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
# /// script
|
||||
# requires-python = ">=3.12"
|
||||
# dependencies = [
|
||||
# "groq",
|
||||
# ]
|
||||
# ///
|
||||
from groq import Groq
|
||||
|
||||
IMAGE_DATA_URL = "..."
|
||||
|
||||
client = Groq()
|
||||
completion = client.chat.completions.create(
|
||||
model="llama-3.2-90b-vision-preview",
|
||||
messages=[
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "text", "text": "これは何?"},
|
||||
{"type": "image_url", "image_url": {"url": IMAGE_DATA_URL}},
|
||||
],
|
||||
}
|
||||
],
|
||||
temperature=1,
|
||||
max_tokens=1024,
|
||||
top_p=1,
|
||||
stream=False,
|
||||
stop=None,
|
||||
)
|
||||
|
||||
print(completion.choices[0].message)
|
|
@ -1 +0,0 @@
|
|||
HISTFILESIZE=16777215
|
|
@ -1,22 +0,0 @@
|
|||
# Bash `HISTFILESIZE` の限界
|
||||
|
||||
```console
|
||||
$ seq 0 $((0x7fffffff)) > .bash_history
|
||||
$ wc -l .bash_history
|
||||
2147483648 .bash_history
|
||||
$ echo $((0x7fffffff))
|
||||
2147483647
|
||||
$ docker compose run --rm bash
|
||||
root@ff1161946537:/# 225859065
|
||||
$ wc -l .bash_history
|
||||
16777215 .bash_history
|
||||
```
|
||||
|
||||
- 225859066 行 (< 0x7fffffff bytes) まで読み込まれた
|
||||
- `HISTFILESIZE=$((0x7fffffff))` 以上にするのは意味がない
|
||||
- `HISTFILESIZE=$((0x7fffff))` 行に切り落とせる
|
||||
- `HISTFILESIZE=$((0xffffff))` 行に切り落とせる
|
||||
- `HISTFILESIZE=$((0x7fffffff))` では .bash_history が大きいとハングすることがあった
|
||||
- このあたりが限界だろう
|
||||
- 0xffffff 行くらいまでならおそらく OK だろう
|
||||
- ちなみに `HISTFILESIZE=-1` はどうかというと、これも .bash_history が大きいとハングした
|
|
@ -1,5 +0,0 @@
|
|||
services:
|
||||
bash:
|
||||
image: ubuntu:jammy
|
||||
volumes:
|
||||
- "./:/root"
|
3
hoarder/.gitignore
vendored
Normal file
3
hoarder/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
data
|
||||
meilisearch
|
||||
redis
|
58
hoarder/compose.yml
Normal file
58
hoarder/compose.yml
Normal file
|
@ -0,0 +1,58 @@
|
|||
# https://raw.githubusercontent.com/hoarder-app/hoarder/main/docker/docker-compose.yml
|
||||
services:
|
||||
web:
|
||||
image: ghcr.io/hoarder-app/hoarder-web:0.15.0
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./data:/data
|
||||
ports:
|
||||
- 3000:3000
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
REDIS_HOST: redis
|
||||
MEILI_ADDR: http://meilisearch:7700
|
||||
DATA_DIR: /data
|
||||
redis:
|
||||
image: redis:7.2-alpine
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./redis:/data
|
||||
chromium:
|
||||
image: gcr.io/zenika-hub/alpine-chrome:latest
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- --no-sandbox
|
||||
- --disable-dev-shm-usage
|
||||
- --hide-scrollbars
|
||||
- --remote-debugging-address=0.0.0.0
|
||||
- --remote-debugging-port=9222
|
||||
meilisearch:
|
||||
image: getmeili/meilisearch:v1.6
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
MEILI_NO_ANALYTICS: "true"
|
||||
volumes:
|
||||
- ./meilisearch:/meili_data
|
||||
workers:
|
||||
image: ghcr.io/hoarder-app/hoarder-workers:0.15.0
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./data:/data
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
REDIS_HOST: redis
|
||||
MEILI_ADDR: http://meilisearch:7700
|
||||
BROWSER_WEB_URL: http://chromium:9222
|
||||
DATA_DIR: /data
|
||||
depends_on:
|
||||
web:
|
||||
condition: service_started
|
||||
#
|
||||
# .env
|
||||
# NEXTAUTH_SECRET=$(openssl rand -base64 36)
|
||||
# MEILI_MASTER_KEY=$(openssl rand -base64 36)
|
||||
# NEXTAUTH_URL=http://localhost:3000
|
8
hono/README.md
Normal file
8
hono/README.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
```
|
||||
deno run -A main.ts
|
||||
# or deno install -n hello-hono https://raw.githubusercontent.com/kou029w/_/main/hono/main.ts && hello-hono
|
||||
```
|
||||
|
||||
```
|
||||
open http://localhost:3000
|
||||
```
|
5
hono/deno.json
Normal file
5
hono/deno.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"imports": {
|
||||
"hono": "npm:hono@^4.2.6"
|
||||
}
|
||||
}
|
21
hono/deno.lock
generated
Normal file
21
hono/deno.lock
generated
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"version": "3",
|
||||
"packages": {
|
||||
"specifiers": {
|
||||
"npm:hono": "npm:hono@4.2.6",
|
||||
"npm:hono@^4.2.6": "npm:hono@4.2.6"
|
||||
},
|
||||
"npm": {
|
||||
"hono@4.2.6": {
|
||||
"integrity": "sha512-AtbHZJYWsm+uFHLz0C6xltX7hjOV44a55gSEGBfoQOJ00KSxEUOoiIkmd+NXfapNX0j2GCKhqMmYeegBdHRwcQ==",
|
||||
"dependencies": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"remote": {},
|
||||
"workspace": {
|
||||
"dependencies": [
|
||||
"npm:hono@^4.2.6"
|
||||
]
|
||||
}
|
||||
}
|
14
hono/foo.tsx
Normal file
14
hono/foo.tsx
Normal file
|
@ -0,0 +1,14 @@
|
|||
/** @jsxImportSource npm:hono/jsx */
|
||||
|
||||
export function Foo(props: { messages: string[] }) {
|
||||
return (
|
||||
<>
|
||||
<h1>Hello Hono!</h1>
|
||||
<ul>
|
||||
{props.messages.map((message) => (
|
||||
<li>{message}!</li>
|
||||
))}
|
||||
</ul>
|
||||
</>
|
||||
);
|
||||
}
|
27
hono/main.ts
Normal file
27
hono/main.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { Hono } from "npm:hono";
|
||||
import { showRoutes } from "npm:hono/dev";
|
||||
import { html } from "npm:hono/html";
|
||||
import { Foo } from "./foo.tsx";
|
||||
|
||||
const app = new Hono();
|
||||
|
||||
const Html = html`<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Hello</title>
|
||||
</head>
|
||||
<body>
|
||||
${Foo({
|
||||
messages: ["bar", "baz"],
|
||||
})}
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
app.get("/", (c) => {
|
||||
return c.html(Html);
|
||||
});
|
||||
|
||||
const port = 3000;
|
||||
|
||||
Deno.serve({ port }, app.fetch);
|
||||
showRoutes(app);
|
5
jose/deno.json
Normal file
5
jose/deno.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"imports": {
|
||||
"jose": "npm:jose@^5.9.6"
|
||||
}
|
||||
}
|
17
jose/deno.lock
generated
Normal file
17
jose/deno.lock
generated
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"version": "4",
|
||||
"specifiers": {
|
||||
"npm:jose@*": "5.9.6",
|
||||
"npm:jose@^5.9.6": "5.9.6"
|
||||
},
|
||||
"npm": {
|
||||
"jose@5.9.6": {
|
||||
"integrity": "sha512-AMlnetc9+CV9asI19zHmrgS/WYsWUwCn2R7RzlbJWD7F9eWYUTGyBmU9o6PxngtLGOiDGPRu+Uc4fhKzbpteZQ=="
|
||||
}
|
||||
},
|
||||
"workspace": {
|
||||
"dependencies": [
|
||||
"npm:jose@^5.9.6"
|
||||
]
|
||||
}
|
||||
}
|
38
jose/jwe.ts
Normal file
38
jose/jwe.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
import {
|
||||
exportJWK,
|
||||
flattenedDecrypt,
|
||||
FlattenedEncrypt,
|
||||
generateKeyPair,
|
||||
importJWK,
|
||||
} from "npm:jose";
|
||||
|
||||
/*
|
||||
* JWE_SECRET=$(openssl rand -base64 32) deno run -A jwe.ts
|
||||
*/
|
||||
|
||||
const encryptionKey = await importJWK({
|
||||
kty: "oct",
|
||||
k: Deno.env.get("JWE_SECRET"),
|
||||
});
|
||||
|
||||
const keyToEncrypt = await generateKeyPair("ES256", { extractable: true });
|
||||
const privateKeyJWK = await exportJWK(keyToEncrypt.privateKey);
|
||||
|
||||
// encrypt
|
||||
const jwe = await new FlattenedEncrypt(
|
||||
new TextEncoder().encode(JSON.stringify(privateKeyJWK)),
|
||||
)
|
||||
.setProtectedHeader({
|
||||
alg: "dir",
|
||||
enc: "A256GCM",
|
||||
})
|
||||
.encrypt(encryptionKey);
|
||||
|
||||
// decrypt
|
||||
const res = await flattenedDecrypt(jwe, encryptionKey);
|
||||
const jwk = JSON.parse(new TextDecoder().decode(res.plaintext));
|
||||
|
||||
console.log({
|
||||
jwe,
|
||||
jwk,
|
||||
});
|
1
kamal/.gitignore
vendored
Normal file
1
kamal/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.env
|
1
kamal/Dockerfile
Normal file
1
kamal/Dockerfile
Normal file
|
@ -0,0 +1 @@
|
|||
FROM caddy
|
19
kamal/README.md
Normal file
19
kamal/README.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
```
|
||||
alias kamal='docker run -it --rm -v "${PWD}:/workdir" -v "${SSH_AUTH_SOCK}:/ssh-agent" -v /var/run/docker.sock:/var/run/docker.sock -e "SSH_AUTH_SOCK=/ssh-agent" ghcr.io/basecamp/kamal:latest'
|
||||
```
|
||||
|
||||
```.env
|
||||
KAMAL_REGISTRY_PASSWORD=*
|
||||
```
|
||||
|
||||
```
|
||||
$ kamal setup
|
||||
```
|
||||
|
||||
```
|
||||
ubuntu@gamma:~$ mkdir -p .kamal/env/roles
|
||||
ubuntu@gamma:~$ touch .kamal/env/roles/web-web.env
|
||||
ubuntu@gamma:~$ chmod 600 .kamal/env/roles/web-web.env
|
||||
```
|
||||
|
||||
- Docker レジストリどうするか => Docker Hub などパブリックなものを使用するのが簡単
|
13
kamal/config/deploy.yml
Normal file
13
kamal/config/deploy.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kjellberg/mrsk/validate-with-json-schema/lib/mrsk/configuration/schema.yaml
|
||||
service: web
|
||||
image: fogtype/caddy
|
||||
servers:
|
||||
- ubuntu@gamma.fogtype.com
|
||||
registry:
|
||||
username: fogtype
|
||||
password:
|
||||
- KAMAL_REGISTRY_PASSWORD
|
||||
logging:
|
||||
driver: journald
|
||||
healthcheck:
|
||||
cmd: /bin/true
|
72
kita/README.md
Normal file
72
kita/README.md
Normal file
|
@ -0,0 +1,72 @@
|
|||
# kita
|
||||
|
||||
## Installing the project
|
||||
|
||||
Run the following command to install the project:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
## Running in development mode
|
||||
|
||||
Run the following command to start the server in development mode:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
You can now open your browser and navigate to [`http://localhost:1227`](http://localhost:1227).
|
||||
|
||||
## Building for production
|
||||
|
||||
Run the following command to build the project:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
Run the following command to start the server in production mode:
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
You can now open your browser and navigate to [`http://localhost:1227`](http://localhost:1227).
|
||||
|
||||
## Running tests
|
||||
|
||||
You can run the tests using the following command:
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
## Environment variables
|
||||
|
||||
Environment variables are loaded from a [`.env`](./.env) file in the root of the project. These are the available
|
||||
variables:
|
||||
|
||||
```bash
|
||||
# Port and host for the server
|
||||
PORT=1227
|
||||
HOST=0.0.0.0
|
||||
```
|
||||
|
||||
## Linting and Formatting
|
||||
|
||||
You can run the following commands to lint and format your code:
|
||||
|
||||
```bash
|
||||
# Formats your code
|
||||
npm run format
|
||||
|
||||
# Lints your code
|
||||
npm run lint
|
||||
|
||||
# Lints and fixes your code
|
||||
npm run lint:fix
|
||||
|
||||
# Lints your code in CI mode
|
||||
npm run lint:ci
|
||||
```
|
25
kita/biome.json
Normal file
25
kita/biome.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.6.3/schema.json",
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true
|
||||
}
|
||||
},
|
||||
"formatter": {
|
||||
"lineWidth": 100,
|
||||
"indentStyle": "space"
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"quoteStyle": "single",
|
||||
"trailingComma": "none"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
"ignore": ["node_modules", "dist", "coverage"]
|
||||
}
|
||||
}
|
44
kita/package.json
Normal file
44
kita/package.json
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"name": "kita",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "kita build && tsc -p tsconfig.build.json",
|
||||
"dev": "concurrently --raw --restart-tries 0 \"npm:dev:*\"",
|
||||
"dev:kita": "kita watch",
|
||||
"dev:server": "node --env-file=.env --enable-source-maps -r @swc-node/register --watch src/index.ts",
|
||||
"dev:tsc": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
|
||||
"format": "biome format --write .",
|
||||
"lint": "biome check .",
|
||||
"lint:ci": "biome ci .",
|
||||
"lint:fix": "biome check --apply-unsafe .",
|
||||
"start": "node --env-file=.env --enable-source-maps dist/index.js",
|
||||
"test": "kita build && node --env-file=.env --enable-source-maps -r @swc-node/register --test test/**/*.test.ts",
|
||||
"test:types": "kita build --dry-run && tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fastify/helmet": "^11.1.1",
|
||||
"@fastify/multipart": "^8.2.0",
|
||||
"@fastify/sensible": "^5.5.0",
|
||||
"@fastify/under-pressure": "^8.3.0",
|
||||
"@kitajs/runtime": "^1.1.17",
|
||||
"close-with-grace": "^1.3.0",
|
||||
"fastify": "^4.26.2",
|
||||
"fastify-plugin": "^4.5.1",
|
||||
"pino": "^8.19.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.6.3",
|
||||
"@kitajs/cli": "1.1.34",
|
||||
"@swc-node/register": "^1.9.0",
|
||||
"@swc/helpers": "^0.5.8",
|
||||
"@types/node": "^20.12.2",
|
||||
"concurrently": "^8.2.2",
|
||||
"pino-pretty": "^11.0.0",
|
||||
"typescript": "^5.4.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
}
|
2427
kita/pnpm-lock.yaml
generated
Normal file
2427
kita/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load diff
31
kita/src/index.ts
Normal file
31
kita/src/index.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { ajvFilePlugin } from '@fastify/multipart';
|
||||
import fastify from 'fastify';
|
||||
import { isMainThread } from 'node:worker_threads';
|
||||
import backendPlugin from './plugin';
|
||||
|
||||
// Ensures this file is not executed in test context
|
||||
if (process.env.NODE_TEST_CONTEXT) {
|
||||
throw new Error('This file should not be executed in test context');
|
||||
}
|
||||
|
||||
// Ensures this file is not executed in worker context
|
||||
if (!isMainThread) {
|
||||
throw new Error('This file should not be executed in worker context');
|
||||
}
|
||||
|
||||
// Ensures PORT are set
|
||||
if (!process.env.PORT) {
|
||||
throw new Error('PORT must be set');
|
||||
}
|
||||
|
||||
fastify({
|
||||
logger: { transport: { target: 'pino-pretty' } },
|
||||
ajv: { plugins: [ajvFilePlugin] }
|
||||
})
|
||||
// Registers our backend
|
||||
.register(backendPlugin)
|
||||
// Starts the server
|
||||
.listen({
|
||||
port: +process.env.PORT,
|
||||
host: process.env.HOST || ''
|
||||
});
|
43
kita/src/plugin.ts
Normal file
43
kita/src/plugin.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import './prelude';
|
||||
|
||||
import fastifyHelmet from '@fastify/helmet';
|
||||
import fastifyUnderPressure from '@fastify/under-pressure';
|
||||
import { Kita } from '@kitajs/runtime';
|
||||
import closeWithGrace from 'close-with-grace';
|
||||
import fp from 'fastify-plugin';
|
||||
|
||||
export default fp(async (app) => {
|
||||
// Registers the generated kita plugin
|
||||
app.register(Kita);
|
||||
|
||||
// Measures process load with automatic handling of "Service Unavailable"
|
||||
app.register(fastifyUnderPressure, {
|
||||
maxEventLoopDelay: 1000,
|
||||
maxHeapUsedBytes: 1000000000,
|
||||
maxRssBytes: 1000000000,
|
||||
maxEventLoopUtilization: 0.98
|
||||
});
|
||||
|
||||
// Important security headers for Fastify
|
||||
app.register(fastifyHelmet, {
|
||||
global: true
|
||||
});
|
||||
|
||||
// Add your custom stuff here
|
||||
// app.register(myPlugin)
|
||||
// ...
|
||||
|
||||
// Delay is the number of milliseconds for the graceful close to finish
|
||||
const closeListeners = closeWithGrace({ delay: 500 }, async ({ err }) => {
|
||||
if (err) {
|
||||
app.log.error(err);
|
||||
}
|
||||
|
||||
await app.close();
|
||||
});
|
||||
|
||||
// Cancelling the close listeners
|
||||
app.addHook('onClose', async () => {
|
||||
closeListeners.uninstall();
|
||||
});
|
||||
});
|
2
kita/src/prelude.ts
Normal file
2
kita/src/prelude.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
// This tells kita where to find the root of your project
|
||||
globalThis.KITA_PROJECT_ROOT ??= __dirname;
|
13
kita/src/routes/index.ts
Normal file
13
kita/src/routes/index.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import type { Query } from '@kitajs/runtime';
|
||||
|
||||
/**
|
||||
* @tag Hello
|
||||
* @operationId getHello
|
||||
* @summary Get a hello message with date
|
||||
*/
|
||||
export function get(name: Query = 'World') {
|
||||
return {
|
||||
name,
|
||||
message: `Hello ${name}!`
|
||||
};
|
||||
}
|
39
kita/test/index.test.ts
Normal file
39
kita/test/index.test.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import fastify from 'fastify';
|
||||
import assert from 'node:assert';
|
||||
import test, { describe } from 'node:test';
|
||||
import backendPlugin from '../src/plugin';
|
||||
|
||||
describe('Creates route', () => {
|
||||
test('GET /', async () => {
|
||||
await using app = fastify();
|
||||
app.register(backendPlugin);
|
||||
|
||||
const response = await app.inject({
|
||||
method: 'GET',
|
||||
url: '/'
|
||||
});
|
||||
|
||||
assert.strictEqual(response.statusCode, 200);
|
||||
assert.deepStrictEqual(response.json(), {
|
||||
name: 'World',
|
||||
message: 'Hello World!'
|
||||
});
|
||||
});
|
||||
|
||||
test('GET /?name=Kita', async () => {
|
||||
await using app = fastify();
|
||||
app.register(backendPlugin);
|
||||
|
||||
const response = await app.inject({
|
||||
method: 'GET',
|
||||
url: '/',
|
||||
query: { name: 'Kita' }
|
||||
});
|
||||
|
||||
assert.strictEqual(response.statusCode, 200);
|
||||
assert.deepStrictEqual(response.json(), {
|
||||
name: 'Kita',
|
||||
message: 'Hello Kita!'
|
||||
});
|
||||
});
|
||||
});
|
4
kita/tsconfig.build.json
Normal file
4
kita/tsconfig.build.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["src"]
|
||||
}
|
112
kita/tsconfig.json
Normal file
112
kita/tsconfig.json
Normal file
|
@ -0,0 +1,112 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"compilerOptions": {
|
||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||
|
||||
/* Projects */
|
||||
"incremental": true,
|
||||
// "composite": true,
|
||||
// "tsBuildInfoFile": "./.tsbuildinfo",
|
||||
// "disableSourceOfProjectReferenceRedirect": true,
|
||||
// "disableSolutionSearching": true,
|
||||
// "disableReferencedProjectLoad": true,
|
||||
|
||||
/* Language and Environment */
|
||||
"target": "ESNext",
|
||||
// "lib": [],
|
||||
// "jsx": "preserve",
|
||||
// "experimentalDecorators": true,
|
||||
// "emitDecoratorMetadata": true,
|
||||
// "jsxFactory": "",
|
||||
// "jsxFragmentFactory": "",
|
||||
// "jsxImportSource": "",
|
||||
// "reactNamespace": "",
|
||||
// "noLib": true,
|
||||
// "useDefineForClassFields": true,
|
||||
// "moduleDetection": "auto", ,
|
||||
"preserveWatchOutput": true,
|
||||
|
||||
/* Modules */
|
||||
"module": "CommonJS",
|
||||
// "rootDir": "./",
|
||||
"moduleResolution": "Node10",
|
||||
// "baseUrl": "./",
|
||||
// "paths": {},
|
||||
// "rootDirs": [],
|
||||
// "typeRoots": [],
|
||||
// "types": [],
|
||||
// "allowUmdGlobalAccess": true,
|
||||
// "moduleSuffixes": [],
|
||||
// "allowImportingTsExtensions": true,
|
||||
// "resolvePackageJsonExports": true,
|
||||
// "resolvePackageJsonImports": true,
|
||||
// "customConditions": [],
|
||||
// "resolveJsonModule": true,
|
||||
// "allowArbitraryExtensions": true,
|
||||
// "noResolve": true,
|
||||
|
||||
/* JavaScript Support */
|
||||
// "allowJs": true,
|
||||
// "checkJs": true,
|
||||
// "maxNodeModuleJsDepth": 1,
|
||||
|
||||
/* Emit */
|
||||
// "declaration": true,
|
||||
// "declarationMap": true,
|
||||
// "emitDeclarationOnly": true,
|
||||
"sourceMap": true,
|
||||
// "inlineSourceMap": true,
|
||||
// "outFile": "./",
|
||||
"outDir": "./dist",
|
||||
// "removeComments": true,
|
||||
// "noEmit": true,
|
||||
"importHelpers": true,
|
||||
// "importsNotUsedAsValues": "remove",
|
||||
// "downlevelIteration": true,
|
||||
// "sourceRoot": "",
|
||||
// "mapRoot": "",
|
||||
// "inlineSources": true,
|
||||
// "emitBOM": true,
|
||||
// "newLine": "crlf",
|
||||
// "stripInternal": true,
|
||||
// "noEmitHelpers": true,
|
||||
// "noEmitOnError": true,
|
||||
// "preserveConstEnums": true,
|
||||
// "declarationDir": "./",
|
||||
// "preserveValueImports": true,
|
||||
|
||||
/* Interop Constraints */
|
||||
"isolatedModules": true,
|
||||
"verbatimModuleSyntax": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"preserveSymlinks": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
|
||||
/* Type Checking */
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictBindCallApply": true,
|
||||
"strictPropertyInitialization": true,
|
||||
"noImplicitThis": true,
|
||||
"useUnknownInCatchVariables": true,
|
||||
"alwaysStrict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"exactOptionalPropertyTypes": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
// "noPropertyAccessFromIndexSignature": true,
|
||||
// "allowUnusedLabels": true,
|
||||
// "allowUnreachableCode": true,
|
||||
|
||||
/* Completeness */
|
||||
"skipDefaultLibCheck": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src", "test"]
|
||||
}
|
13
metube/compose.yml
Normal file
13
metube/compose.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
services:
|
||||
metube:
|
||||
image: ghcr.io/alexta69/metube
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8081:8081"
|
||||
volumes:
|
||||
- ./config:/etc/metube
|
||||
- ./downloads:/downloads
|
||||
environment:
|
||||
YTDL_OPTIONS_FILE: /etc/metube/ytdl_options.json
|
||||
DOWNLOAD_DIR: /downloads/Music
|
||||
OUTPUT_TEMPLATE: "%(artist,uploader|Unknown)s,%(album,artist,uploader)s,%(title)s [%(id)s].%(ext)s"
|
9
metube/config/ytdl_options.json
Normal file
9
metube/config/ytdl_options.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"format": "bestaudio/best",
|
||||
"writethumbnail": true,
|
||||
"postprocessors": [
|
||||
{ "key": "FFmpegExtractAudio" },
|
||||
{ "key": "FFmpegMetadata" },
|
||||
{ "key": "EmbedThumbnail" }
|
||||
]
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
test("1 + 2 = 3", () => {
|
||||
assert.equal(1 + 2, 3);
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
export default "hello!";
|
|
@ -1,7 +0,0 @@
|
|||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import message from "./hello.js";
|
||||
|
||||
test("say hello", () => {
|
||||
assert.equal(message, "hello!");
|
||||
});
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "node --test"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.7.0"
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
test("parse json", () => {
|
||||
const json = `{"name": "太郎", "age": 42}`;
|
||||
const obj = JSON.parse(json);
|
||||
assert.deepEqual(obj, { name: "太郎", age: 42 });
|
||||
});
|
1
playwright-screenshot/.gitignore
vendored
1
playwright-screenshot/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
/screenshot/
|
|
@ -1,29 +0,0 @@
|
|||
const { chromium } = require("playwright");
|
||||
|
||||
async function main() {
|
||||
const browser = await chromium.launch({
|
||||
headless: false,
|
||||
});
|
||||
const context = await browser.newContext({
|
||||
screen: { width: 1280, height: 720 },
|
||||
});
|
||||
const page = await context.newPage();
|
||||
await page.goto("about:blank");
|
||||
for (let i = 0 /* NOP */; ; i++) {
|
||||
try {
|
||||
const seq = i.toString().padStart(6, "0");
|
||||
const title = await page.title();
|
||||
const date = new Date().toISOString().split("T")[0];
|
||||
const path = `screenshot/${date}/${seq}-${title}.png`;
|
||||
await page.screenshot({ path });
|
||||
await page.waitForTimeout(1_000);
|
||||
} catch {
|
||||
// NOP
|
||||
}
|
||||
}
|
||||
await page.close();
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
main();
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"playwright": "latest"
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
playwright-core@1.31.2:
|
||||
version "1.31.2"
|
||||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.31.2.tgz#debf4b215d14cb619adb7e511c164d068075b2ed"
|
||||
integrity sha512-a1dFgCNQw4vCsG7bnojZjDnPewZcw7tZUNFN0ZkcLYKj+mPmXvg4MpaaKZ5SgqPsOmqIf2YsVRkgqiRDxD+fDQ==
|
||||
|
||||
playwright@latest:
|
||||
version "1.31.2"
|
||||
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.31.2.tgz#4252280586c596746122cd1fdf9f8ff6a63fa852"
|
||||
integrity sha512-jpC47n2PKQNtzB7clmBuWh6ftBRS/Bt5EGLigJ9k2QAKcNeYXZkEaDH5gmvb6+AbcE0DO6GnXdbl9ogG6Eh+og==
|
||||
dependencies:
|
||||
playwright-core "1.31.2"
|
21
playwright/inner-text.test.ts
Normal file
21
playwright/inner-text.test.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("first", async ({ page }) => {
|
||||
// @ts-ignore
|
||||
await page.goto(`file:///${__dirname}/test.html`);
|
||||
|
||||
// playwright test --browser=chromium : pass
|
||||
// playwright test --browser=firefox : pass
|
||||
// playwright test --browser=webkit : fail (return `1\n`)
|
||||
expect(await page.innerText("first-test")).toBe(`1`);
|
||||
});
|
||||
|
||||
test("second", async ({ page }) => {
|
||||
// @ts-ignore
|
||||
await page.goto(`file:///${__dirname}/test.html`);
|
||||
|
||||
// playwright test --browser=chromium : pass
|
||||
// playwright test --browser=firefox : pass
|
||||
// playwright test --browser=webkit : fail (return `2\n`)
|
||||
expect(await page.innerText("second-test")).toBe(`2`);
|
||||
});
|
75
playwright/package-lock.json
generated
Normal file
75
playwright/package-lock.json
generated
Normal file
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"name": "playwright",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.48.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@playwright/test": {
|
||||
"version": "1.48.1",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.48.1.tgz",
|
||||
"integrity": "sha512-s9RtWoxkOLmRJdw3oFvhFbs9OJS0BzrLUc8Hf6l2UdCNd1rqeEyD4BhCJkvzeEoD1FsK4mirsWwGerhVmYKtZg==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"playwright": "1.48.1"
|
||||
},
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/playwright": {
|
||||
"version": "1.48.1",
|
||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.48.1.tgz",
|
||||
"integrity": "sha512-j8CiHW/V6HxmbntOfyB4+T/uk08tBy6ph0MpBXwuoofkSnLmlfdYNNkFTYD6ofzzlSqLA1fwH4vwvVFvJgLN0w==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"playwright-core": "1.48.1"
|
||||
},
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/playwright-core": {
|
||||
"version": "1.48.1",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.48.1.tgz",
|
||||
"integrity": "sha512-Yw/t4VAFX/bBr1OzwCuOMZkY1Cnb4z/doAFSwf4huqAGWmf9eMNjmK7NiOljCdLmxeRYcGPPmcDgU0zOlzP0YA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"playwright-core": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
8
playwright/package.json
Normal file
8
playwright/package.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"scripts": {
|
||||
"test": "playwright test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.48.1"
|
||||
}
|
||||
}
|
18
playwright/playwright.config.ts
Normal file
18
playwright/playwright.config.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { defineConfig, devices } from "@playwright/test";
|
||||
|
||||
export default defineConfig({
|
||||
projects: [
|
||||
{
|
||||
name: "chromium",
|
||||
use: devices["Desktop Chrome"],
|
||||
},
|
||||
{
|
||||
name: "firefox",
|
||||
use: devices["Desktop Firefox"],
|
||||
},
|
||||
{
|
||||
name: "webkit",
|
||||
use: devices["Desktop Safari"],
|
||||
},
|
||||
],
|
||||
});
|
15
playwright/test.html
Normal file
15
playwright/test.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<first-test><div>1</div></first-test>
|
||||
<second-test>
|
||||
<div>2</div>
|
||||
<div></div>
|
||||
</second-test>
|
||||
</body>
|
||||
</html>
|
1
poppler-rs/.gitignore
vendored
Normal file
1
poppler-rs/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/target
|
1573
poppler-rs/Cargo.lock
generated
Normal file
1573
poppler-rs/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
11
poppler-rs/Cargo.toml
Normal file
11
poppler-rs/Cargo.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
edition = "2021"
|
||||
name = "poppler-rs"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
cairo-rs = {version = "0.20.1"}
|
||||
clap = {version = "4.5.16", features = ["derive", "env"]}
|
||||
image = "0.25.2"
|
||||
poppler-rs = "0.24.1"
|
||||
url = "2.5.2"
|
55
poppler-rs/src/main.rs
Normal file
55
poppler-rs/src/main.rs
Normal file
|
@ -0,0 +1,55 @@
|
|||
use cairo::{Context, Format, ImageSurface};
|
||||
use clap::Parser;
|
||||
use image::codecs::webp::WebPEncoder;
|
||||
use image::ExtendedColorType;
|
||||
use poppler::Document;
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version)]
|
||||
struct Args {
|
||||
#[arg(short, long, env, default_value = "target/note/note.pdf", value_parser = canonicalize)]
|
||||
input: String,
|
||||
|
||||
#[arg(short, long, env, default_value = "target/output")]
|
||||
output: String,
|
||||
}
|
||||
|
||||
fn canonicalize(arg: &str) -> Result<String, std::io::Error> {
|
||||
let path = fs::canonicalize(arg)?.to_string_lossy().into_owned();
|
||||
Ok(path)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Args::parse();
|
||||
let input = args.input;
|
||||
let output = args.output;
|
||||
let input_uri = Url::parse(format!("file://{input}").as_str())
|
||||
.unwrap()
|
||||
.to_string();
|
||||
|
||||
let document = Document::from_file(&input_uri, None).unwrap();
|
||||
|
||||
for i in 0..document.n_pages() {
|
||||
let page = document.page(i).unwrap();
|
||||
let (width, height) = page.size();
|
||||
let output_file = File::create(format!("{output}-{i}.webp")).unwrap();
|
||||
let surface = ImageSurface::create(Format::Rgb24, width as i32, height as i32).unwrap();
|
||||
let context = Context::new(&surface).unwrap();
|
||||
|
||||
context.set_source_rgb(1., 1., 1.);
|
||||
context.paint().unwrap();
|
||||
page.render(&context);
|
||||
|
||||
drop(context);
|
||||
|
||||
let data = surface.take_data().unwrap();
|
||||
let encoder = WebPEncoder::new_lossless(output_file);
|
||||
|
||||
encoder
|
||||
.encode(&data, width as u32, height as u32, ExtendedColorType::Rgba8)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
5
serialize-error/deno.json
Normal file
5
serialize-error/deno.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"imports": {
|
||||
"serialize-error": "npm:serialize-error@^12.0.0"
|
||||
}
|
||||
}
|
32
serialize-error/deno.lock
generated
Normal file
32
serialize-error/deno.lock
generated
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"version": "4",
|
||||
"specifiers": {
|
||||
"npm:@types/node@*": "22.5.4",
|
||||
"npm:serialize-error@*": "12.0.0"
|
||||
},
|
||||
"npm": {
|
||||
"@types/node@22.5.4": {
|
||||
"integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==",
|
||||
"dependencies": [
|
||||
"undici-types"
|
||||
]
|
||||
},
|
||||
"serialize-error@12.0.0": {
|
||||
"integrity": "sha512-ZYkZLAvKTKQXWuh5XpBw7CdbSzagarX39WyZ2H07CDLC5/KfsRGlIXV8d4+tfqX1M7916mRqR1QfNHSij+c9Pw==",
|
||||
"dependencies": [
|
||||
"type-fest"
|
||||
]
|
||||
},
|
||||
"type-fest@4.33.0": {
|
||||
"integrity": "sha512-s6zVrxuyKbbAsSAD5ZPTB77q4YIdRctkTbJ2/Dqlinwz+8ooH2gd+YA7VA6Pa93KML9GockVvoxjZ2vHP+mu8g=="
|
||||
},
|
||||
"undici-types@6.19.8": {
|
||||
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="
|
||||
}
|
||||
},
|
||||
"workspace": {
|
||||
"dependencies": [
|
||||
"npm:serialize-error@12"
|
||||
]
|
||||
}
|
||||
}
|
7
serialize-error/main.ts
Normal file
7
serialize-error/main.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { addKnownErrorConstructor } from "npm:serialize-error";
|
||||
|
||||
export class E extends Error {
|
||||
code = "ERR";
|
||||
}
|
||||
|
||||
addKnownErrorConstructor(E);
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue