Skip to content

Instantly share code, notes, and snippets.

View hymkor's full-sized avatar

HAYAMA Kaoru hymkor

View GitHub Profile
@hymkor
hymkor / shiftbk.ps1
Last active February 11, 2026 10:55
`jj bookmark move ブックマーク名 -t リビジョン` でブックマーク名の転記が面倒くさいので書いた、自動で直近のものを探して移動させてくれる PowerShell スクリプト(実行前の目視確認あり)
function Step-Exec($cmd) {
While ($true) {
$ans = Read-Host ("`r`n$ {0}`r`n[Y]es: execute, [N]o: skip, [Q]uit ?" -f $cmd)
if ($ans -eq "q" ){
exit 1
}
if ($ans -eq "n" ){
return
}
if ($ans -eq "y" ){
@hymkor
hymkor / ecosystem.md
Created February 9, 2026 09:48
nyaosorg エコシステムの依存関係図
go-ttyadapter
└go-readline-ny (and go-readline-skk)
 ├NYAGOS
 ├Binview
 ├Csvi
 ││
 └─go-multiline-ny
  │├gm
  └┴SQL-Bless
@hymkor
hymkor / new-jj.ps1
Last active February 4, 2026 13:18
if ( -not (Test-Path .jj) ){
jj git init
}
if ( -not (Test-Path .gitattributes) ){
"echo * -text`n" | Out-File -NoNewline -FilePath .gitattributes
jj commit -m "Add .gitattributes as autocrlf=false" .gitattributes
}
foreach ( $i in @("*~","*.o","*.exe","__*","*.zip","dist") ){
@hymkor
hymkor / jj-describe.ps1
Last active February 4, 2026 09:39
`git describe --tags` と同じようなことを jj でやる PowerShell Script
# PowerShell Script for jj which is equivalent to `git describe --tags`
function jj-describe(){
$tag=jj log -r "latest(::@ & tags())" --no-graph --template "self.tags()"
$count=jj log --count -r "$tag..git_head()"
if ( $count -le 0 ){
return $tag
}
$hash=jj log -r "@-" --no-graph --template "commit_id.short(7)"
return "$tag-$count-g$hash"
$argv = $args
$saveEncode = $null
if ([Console]::IsOutputRedirected) {
$saveEncode = [System.Console]::OutputEncoding
[System.Console]::OutputEncoding=[System.Text.Encoding]::UTF8
}
Get-Content "go.mod" |
Where-Object { $_ -like "module*" } |
//go:build orgxwidth
package moji
import (
"unicode"
"golang.org/x/text/width"
)
@hymkor
hymkor / work.cmd
Last active November 4, 2025 19:16
go work で、サブコマンドが init と use に分かれているのが微妙に使いにくいので作った、一括作成と削除をするバッチファイル
@echo off
@setlocal
@set PROMPT=$G$S
if "%~1" == "" goto :clean
@echo on
go1.20.14 work init
go1.20.14 work use %*
@exit /b
@hymkor
hymkor / badges.cmd
Last active October 28, 2025 05:06
<!-- badges.cmd | -->改行<!-- --> という行を README.md に入れておくと、example-into-readme が Go Test のバッジを埋め込んでくれるバッチファイル(要goawk)
@echo off
if exist ".github\workflows\go.yml" goawk "/^module /{ printf '[![Go Test](https://%%s/actions/workflows/go.yml/badge.svg)](https://%%s/actions/workflows/go.yml)\n',$2,$2 }" go.mod
if exist LICENSE findstr "^MIT License" LICENSE >nul 2>&1 && goawk "/^module /{ printf '[![License](https://img.shields.io/badge/License-MIT-red)](https://%%s/blob/master/LICENSE)\n',$2}" go.mod
goawk "/^module /{ printf '[![Go Reference](https://pkg.go.dev/badge/%%s.svg)](https://pkg.go.dev/%%s)\n',$2,$2}" go.mod
rem gist https://gist.github.com/hymkor/af624060b243b74aef5bf563a95a1e96
@hymkor
hymkor / git-new
Last active October 6, 2025 02:25
`git new` すると、`git init`したのち、CRLF/LF 変換を無効にしたり、メアドを登録したり、対象外ファイルを登録したりするスクリプト
#!/bin/sh
EMAIL=$1
if [ -z "$EMAIL" ] ; then
EMAIL=3752189+hymkor@users.noreply.github.com
fi
if [ ! -e .git ] ; then
git init
fi
@hymkor
hymkor / onlylocal.ps1
Last active October 6, 2025 01:38
git にも jj にも登録していないファイルを列挙(.gitignore に含まれているものも表示する)
Set-PSDebug -Strict
$saveEncode = $null
if ([Console]::IsOutputRedirected) {
$saveEncode = [System.Console]::OutputEncoding
[System.Console]::OutputEncoding=[System.Text.Encoding]::UTF8
}
$gitfiles = @{}
git ls-files | ForEach-Object { $gitfiles[ $_ ] = $true }