mirror of
https://github.com/kou029w/_.git
synced 2025-01-31 14:28:04 +00:00
Compare commits
20 commits
5298b3e4eb
...
1e9a8f7f74
Author | SHA1 | Date | |
---|---|---|---|
|
1e9a8f7f74 | ||
204673694b | |||
7f458326eb | |||
10d7e8f4c7 | |||
485537101b | |||
c2ea74cf70 | |||
0bda09bafb | |||
75ba18676f | |||
d314e83b18 | |||
ffe2af2621 | |||
876d84fb75 | |||
3ef34e52e2 | |||
2794034e55 | |||
84b0494547 | |||
aa1ba85751 | |||
785fe1a122 | |||
772eb9f5d7 | |||
d39897e834 | |||
fa2e298e62 | |||
0fa1ac35b5 |
49 changed files with 2131 additions and 2947 deletions
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
|
||||
|
|
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"]
|
|
@ -1,19 +0,0 @@
|
|||
# bolt
|
||||
|
||||
## インストール
|
||||
|
||||
Step 1
|
||||
: Slack アプリの作成
|
||||
|
||||
[Create New Slack App](https://api.slack.com/apps?new_app=1) → [Select a workspace] → [Create]
|
||||
|
||||
- ボットユーザーを有効化
|
||||
- `app_mentions:read` `chat:write` スコープ必須
|
||||
|
||||
→ [Install to Workspace]
|
||||
|
||||
Step 2
|
||||
: Deno Deploy
|
||||
|
||||
- `SLACK_BOT_TOKEN` ... [Slack Applications](https://api.slack.com/apps) → 作成した Slack アプリ → Permissions ページにある `xoxb-` から始まるボットトークン
|
||||
- `SLACK_SIGNING_SECRET` ... [Slack Applications](https://api.slack.com/apps) → 作成した Slack アプリ → Basic Information ページにある Signing Secret
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"imports": {
|
||||
"@slack/bolt": "npm:@slack/bolt@^3.17.1"
|
||||
},
|
||||
"deploy": {
|
||||
"project": "b0bd997b-0b41-4348-9657-73a44c2bc25a",
|
||||
"exclude": [
|
||||
"**/node_modules"
|
||||
],
|
||||
"include": [],
|
||||
"entrypoint": "main.ts"
|
||||
}
|
||||
}
|
1295
bolt/deno.lock
generated
1295
bolt/deno.lock
generated
File diff suppressed because it is too large
Load diff
14
bolt/main.ts
14
bolt/main.ts
|
@ -1,14 +0,0 @@
|
|||
import bolt from "npm:@slack/bolt";
|
||||
|
||||
const { SLACK_BOT_TOKEN = "", SLACK_SIGNING_SECRET = "" } = Deno.env.toObject();
|
||||
|
||||
const app = new bolt.App({
|
||||
token: SLACK_BOT_TOKEN,
|
||||
signingSecret: SLACK_SIGNING_SECRET,
|
||||
});
|
||||
|
||||
app.event("app_mention", async (c) => {
|
||||
await c.say(`Pong! ${c.event.text}`);
|
||||
});
|
||||
|
||||
await app.start();
|
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();
|
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
|
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)
|
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
|
1
kamal/.gitignore
vendored
Normal file
1
kamal/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.env
|
|
@ -7,14 +7,13 @@ KAMAL_REGISTRY_PASSWORD=*
|
|||
```
|
||||
|
||||
```
|
||||
$ docker context create --docker=host=ssh://ubuntu@gamma.fogtype.com gamma
|
||||
$ docker context use gamma
|
||||
$ docker run --rm -d -p 127.0.0.1:5000:5000 --name registry registry
|
||||
$ ssh -NL 5000:localhost:5000 ubuntu@gamma.fogtype.com
|
||||
$ docker context use default
|
||||
$ kamal deploy
|
||||
$ kamal setup
|
||||
```
|
||||
|
||||
TODO
|
||||
```
|
||||
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 レジストリどうするか => Docker Hub などパブリックなものを使用するのが簡単
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kjellberg/mrsk/validate-with-json-schema/lib/mrsk/configuration/schema.yaml
|
||||
service: kamal-example
|
||||
image: caddy
|
||||
service: web
|
||||
image: fogtype/caddy
|
||||
servers:
|
||||
- ubuntu@gamma.fogtype.com
|
||||
registry:
|
||||
server: localhost:5000
|
||||
username: _
|
||||
username: fogtype
|
||||
password:
|
||||
- KAMAL_REGISTRY_PASSWORD
|
||||
logging:
|
||||
driver: journald
|
||||
healthcheck:
|
||||
cmd: /bin/true
|
||||
|
|
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();
|
||||
}
|
||||
}
|
1
radicle
1
radicle
|
@ -1 +0,0 @@
|
|||
Subproject commit de052ec6833940620c931715bbf4d1cd1a4867b9
|
1
ts/.gitignore
vendored
1
ts/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
dist/
|
37
ts/README.md
37
ts/README.md
|
@ -1,37 +0,0 @@
|
|||
# TypeScript で書いたサーバーをワンライナーで構築してみよう
|
||||
|
||||
tsx
|
||||
|
||||
```
|
||||
npx tsx main.ts
|
||||
```
|
||||
|
||||
tsx + watch
|
||||
|
||||
```
|
||||
npx tsx --watch main.ts
|
||||
```
|
||||
|
||||
esbuild (esbuild-register)
|
||||
|
||||
```
|
||||
node -r esbuild-register main.ts
|
||||
```
|
||||
|
||||
esbuild (esbuild-register) + watch
|
||||
|
||||
```
|
||||
node -r esbuild-register --watch main.ts
|
||||
```
|
||||
|
||||
tsup
|
||||
|
||||
```
|
||||
npx tsup main.ts --clean --onSuccess 'node dist/main.js'
|
||||
```
|
||||
|
||||
tsup + watch
|
||||
|
||||
```
|
||||
npx tsup main.ts --clean --watch --onSuccess 'node dist/main.js'
|
||||
```
|
17
ts/main.ts
17
ts/main.ts
|
@ -1,17 +0,0 @@
|
|||
import express from "express";
|
||||
|
||||
const app = express();
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.send("OK");
|
||||
});
|
||||
|
||||
const address = app.listen(3000).address();
|
||||
|
||||
console.log(address);
|
||||
|
||||
(async () => {
|
||||
const res = await fetch(`http://127.0.0.1:${address?.port}/`);
|
||||
console.log(res.url, res.status, res.statusText);
|
||||
console.log(await res.text());
|
||||
})();
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"name": "ts",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/node": "^20.10.5",
|
||||
"esbuild": "^0.18.20",
|
||||
"esbuild-register": "^3.5.0",
|
||||
"express": "^4.18.2",
|
||||
"tsup": "^7.2.0",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
1428
ts/pnpm-lock.yaml
generated
1428
ts/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
1
writefreely/.gitignore
vendored
Normal file
1
writefreely/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
data
|
12
writefreely/compose.yml
Normal file
12
writefreely/compose.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
services:
|
||||
web:
|
||||
image: "writeas/writefreely:latest"
|
||||
volumes:
|
||||
- "./config.ini:/go/config.ini"
|
||||
- "./data:/data" # sudo chown 2:2 data
|
||||
ports:
|
||||
- "8080:8080"
|
||||
# セットアップに必要なコマンド:
|
||||
# $ cmd/writefreely/writefreely -init-db
|
||||
# $ cmd/writefreely/writefreely -create-admin $USERNAME:$PASSWORD
|
||||
# $ cmd/writefreely/writefreely -gen-keys
|
102
writefreely/config.ini
Normal file
102
writefreely/config.ini
Normal file
|
@ -0,0 +1,102 @@
|
|||
[server]
|
||||
hidden_host =
|
||||
port = 8080
|
||||
bind = 0.0.0.0
|
||||
tls_cert_path =
|
||||
tls_key_path =
|
||||
autocert = false
|
||||
templates_parent_dir = /go
|
||||
static_parent_dir =
|
||||
pages_parent_dir = /go
|
||||
keys_parent_dir = /data
|
||||
hash_seed =
|
||||
gopher_port = 0
|
||||
|
||||
[database]
|
||||
type = sqlite3
|
||||
filename = /data/writefreely.db
|
||||
username =
|
||||
password =
|
||||
database =
|
||||
host = localhost
|
||||
port = 3306
|
||||
tls = false
|
||||
|
||||
[app]
|
||||
site_name = WriteFreely
|
||||
site_description = A place to write freely.
|
||||
host = http://localhost:8080
|
||||
theme = write
|
||||
editor =
|
||||
disable_js = false
|
||||
webfonts = true
|
||||
landing =
|
||||
simple_nav = false
|
||||
wf_modesty = false
|
||||
chorus = false
|
||||
forest = false
|
||||
disable_drafts = false
|
||||
single_user = true
|
||||
open_registration = false
|
||||
open_deletion = false
|
||||
min_username_len = 3
|
||||
max_blogs = 1
|
||||
federation = true
|
||||
public_stats = false
|
||||
monetization = false
|
||||
notes_only = false
|
||||
private = false
|
||||
local_timeline = false
|
||||
user_invites =
|
||||
default_visibility =
|
||||
update_checks = false
|
||||
disable_password_auth = false
|
||||
|
||||
[oauth.slack]
|
||||
client_id =
|
||||
client_secret =
|
||||
team_id =
|
||||
callback_proxy =
|
||||
callback_proxy_api =
|
||||
|
||||
[oauth.writeas]
|
||||
client_id =
|
||||
client_secret =
|
||||
auth_location =
|
||||
token_location =
|
||||
inspect_location =
|
||||
callback_proxy =
|
||||
callback_proxy_api =
|
||||
|
||||
[oauth.gitlab]
|
||||
client_id =
|
||||
client_secret =
|
||||
host =
|
||||
display_name =
|
||||
callback_proxy =
|
||||
callback_proxy_api =
|
||||
|
||||
[oauth.gitea]
|
||||
client_id =
|
||||
client_secret =
|
||||
host =
|
||||
display_name =
|
||||
callback_proxy =
|
||||
callback_proxy_api =
|
||||
|
||||
[oauth.generic]
|
||||
client_id =
|
||||
client_secret =
|
||||
host =
|
||||
display_name =
|
||||
callback_proxy =
|
||||
callback_proxy_api =
|
||||
token_endpoint =
|
||||
inspect_endpoint =
|
||||
auth_endpoint =
|
||||
scope =
|
||||
allow_disconnect = false
|
||||
map_user_id =
|
||||
map_username =
|
||||
map_display_name =
|
||||
map_email =
|
Loading…
Add table
Reference in a new issue