Skip to content

Instantly share code, notes, and snippets.

View ka2n's full-sized avatar

Katsuma Ito ka2n

View GitHub Profile
@ka2n
ka2n / index.js
Created January 20, 2023 02:30
Read streaming response with fetch
const http = require('http')
const express = require('express')
const app = express()
app.get('/', (req, res) => {
res.setHeader('Content-Type', 'text/html')
res.setHeader('Transfer-Encoding', 'chunked');
res.send(`<html><body><h1>Hello World</h1>
<ul id="list"></ul>
<script>
@ka2n
ka2n / main.go
Created March 9, 2023 20:50
echo server
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func main() {
@ka2n
ka2n / convert
Created July 8, 2024 01:28
convert no warn shim
#!/bin/env bash
exec -a "magic" magick convert "$@"
@ka2n
ka2n / gen-ast-grep-manifest.ts
Created August 20, 2024 05:52
remove pathpida 50%
import {pagesPath} from './lib/$path.ts'
type Rule = {
pattern: string
fix: string
id: string
}
const rulesForLevel = (paths: any, parent: string[] = []) => {
let rules: Rule[] = []
@ka2n
ka2n / after-compose-up.sh
Created June 10, 2025 01:54
docker compose: Create tmp files to retrieve external port from container
# Create port mapping files for each service/port combination
docker compose ps --format=json | jq -r '
.Service as $service |
.Publishers[]? |
select(.PublishedPort > 0) |
"/tmp/compose_\($service)_\(.TargetPort)_\(.Protocol) \(.PublishedPort)"
' | while read -r filepath port; do
echo "$port" | docker compose exec -T <target> tee "$filepath" >/dev/null
done
  • ./buildlog.txt: paru -S fcitx5-git fcitx5-cskk-git cskk-git
  • ./envrionments.txt : About then environment information of the system.
  • ./fcitx5-log1.txt : The log of fcitx5 when it is running. Adding Cskk as active input method, then switching to Cskk input method. Then, shutdown the fcitx5 daemon.
  • ./fcitx5-log2.txt : The log of fcitx5 when it is running. Open fcitx5-config-qt, go to Addons tab, then Click 'Configure' button of Cskk iput method for Fcitx5, then click 'OK' button to close the dialog. Then, shutdown the fcitx5 daemon.