Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Neofetchライクな自己紹介ツールyuyufetchを作った / Created yuyu...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Hiroya-W / yuyukun
November 25, 2022
Technology
380
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Neofetchライクな自己紹介ツールyuyufetchを作った / Created yuyufetch, a Neofetch-like self-introduction tool
Hiroya-W / yuyukun
November 25, 2022
More Decks by Hiroya-W / yuyukun
See All by Hiroya-W / yuyukun
PHPカンファレンス振り返りと プロポーザルについて話します / PHP Tech Talk Night ~ after phpcon 2026
hyuyukun
0
44
PSRにのっかってバックエンドサーバを書く / Write a backend server using PSR
hyuyukun
0
100
phina.jsで弾幕シューティングを作る / Creating a bullet-hell shooter with phina.js
hyuyukun
0
320
ピアノ経験ゼロからピアノを練習して弾いてみた / I practiced and played the piano from zero piano experience.
hyuyukun
1
170
Blenderに入門しました / I started to use Blender
hyuyukun
0
170
気軽にパソコンを吹き飛ばせるようにするために / To initialize your computer easily
hyuyukun
0
120
僕っぽいことを喋るBotをマストドンで育てています / I'm growing a bot on mastodon that talks like me.
hyuyukun
0
160
4年と半年かけてようやくフロントエンドを書けるようになった / It took me 4 years and 6 months to be able to write the frontend
hyuyukun
0
360
世界観を考察するのが好き?Sound Horizonはいいぞ / Introduction to Sound Horizon
hyuyukun
0
1.1k
Other Decks in Technology
See All in Technology
なぜ「決定性」が 決定的に重要なのか? Durable Execution 基盤の数理的理解 #serverlessjp / ServerlessDays Tokyo 2026
ytaka23
3
1.2k
絵ではじめるKubernetesセキュリティ
aoi1
4
700
作って終わりじゃないサーバーレス 〜9年運用する大規模EC物流API基盤の設計・運用のリアル〜
zozotech
PRO
0
470
AI 時代のスタートアップエコシステ厶から考究する技術的負債との向き合い方
m3m0r7
PRO
3
2.6k
AIエージェントの自己改善をどう設計するか / How to Design Self-Improvement for AI Agents
22mi
26
17k
開発投資の期待値を上げるプロダクトロードマップづくり ~プロダクトエンジニアが越境して事業を伸ばす~
kekekenta
1
240
aws-iot-platform-architecture-use-cases.pdf
ma2shita
0
530
30座EKS, 180次升級淬煉的EKS Upgrade Skill 的歷程
eric8230
0
210
データ_AIの事業の勝敗をわけるもの
nek0128
1
480
負債のメタファと2026年 / Debt Metaphor in Agentic Engineering Age 202609 Edition
twada
PRO
11
6.2k
Claude Codeを「使うほど育つ」AI秘書にするノウハウ
minorun365
PRO
33
31k
AIで社員の自主発信に広報目線を組み込む
_mossann_t
0
140
Featured
See All Featured
[SF Ruby Conf 2025] Rails X
palkan
3
1.4k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
940
How to make the Groovebox
asonas
2
2.4k
Crafting Experiences
bethany
1
350
Game over? The fight for quality and originality in the time of robots
wayneb77
1
290
Deep Space Network (abreviated)
tonyrice
0
320
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
480
Making Projects Easy
brettharned
120
6.8k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
The Curious Case for Waylosing
cassininazir
1
520
Agile that works and the tools we love
rasmusluckow
331
22k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Transcript
/FPGFUDIϥΠΫͳ ࣗݾհπʔϧͷ ZVZVGFUDIΛ࡞ͬͨ ゆゆ君(@Hyuyu_kun) in あくあたん工房 2022/11/25
とつぜんですが 2
自己紹介どうやってますか 3
LTなら1枚スライドを挟めばいいですが 4
5
名刺を渡す 6
自分のホームページを見せる 7
僕は 8
バイナリを渡します 9
デモします 10
yuyufetch 11 n GitHub • https://github.com/Hiroya-W/yuyufetch n 使い方 • インストールして
• $ go install github.com/Hiroya- W/yuyufetch/cmd/yuyufetch@latest • 実行 • $ yuyufetch n きっかけ • Twitterでやっている人を見て作りたくなって作った
yuyufetch 12 n 好きポイント n Shell: Japanese n Uptime: 199244h1m0s
Neofetch 13 n システム情報を表示するツール n GitHub • https://github.com/dylanaraps/neofetch • 1つのBashスクリプトで書かれている
n パソコン何使っているん?って 聞かれたら、とりあえずこれ見て って言えばOK
(余談) NiTch 14 n 他にも同じようなツールはある (の1例) n GitHub • https://github.com/unxsh/nitch
• Nimを使って書かれている • Neofetch同様カスタマイズが可能
jp2a: JPEG/PNG to ASCII converter 15 n 画像をAAに変換するツール n GitHub
• https://github.com/Talinx/jp2a • JPEGだけじゃなくてPNGにも対応している
jp2aの使い方 n ソースビルドするかDockerを使う方法(Dockerが楽だと思う) • $ docker run -t --rm -e
COLORTERM="$COLORTERM" -v "$(pwd)":/app talinx/jp2a n オプション • --colors • 色付きで出力する。 • --size=WxH • 出力サイズ(幅は1文字が半角なのでW=2Hにするといい感じ)。 • --chars=… • AAに使う文字の組み合わせ。左側が黒に近い色、右側が白に近い色で使う。 • --background=dark, --background=light • 文字色の色味が変わる。背景色が暗いか明るいかで使い分けると良いと思う。 16
自動生成出来るようにしたいなと思ったり 17
自動生成出来るようにしたいなと思ったり 18 Neofetchはテキスト埋め込んでいるので別にいいかと思ったり
GoのCLIツールのリポジトリ構成(バイナリ配布) ! . ├── & bin │ └── , yuyufetch
├── 4 go.mod ├── 9 lib │ ├── ; informations.go # package yuyufetch │ ├── ; version.go # package yuyufetch │ └── ; yuyufetch.go # package yuyufetch ├── , LICENSE ├── ; main.go # package main ├── I Makefile └── K README.md 19
GoのCLIツールのリポジトリ構成(ライブラリ配布) ! . ├── & bin │ └── , yuyufetch
├── ! cmd │ └── ! yuyufetch │ └── 6 main.go # package main ├── = go.mod ├── 6 informations.go # package yuyufetch ├── , LICENSE ├── F Makefile ├── I README.md ├── 6 version.go # package yuyufetch └── 6 yuyufetch.go # package yuyufetch 20
CLI構造体で出力先と入力元を制御 21 // 定義 type CLI struct { Stdout io.Writer
Stderr io.Writer Stdin io.Reader } func (cli *CLI) Run(args []string) error { // something } // メインプログラムで使う時 cli := &mytool.CLI{ Stdout: os.Stdout, Stderr: os.Stderr, Stdin: os.Stdin, } fmt.Fprintln(cli.Stdout, ”Hello") // テストで使う時 s := “-input=hoge –output=fuga” input := “piyo” want := “correct” var got bytes.Buffer cli := &mytool.CLI{ // 置き換える Stdout: &got, Stderr: &got, Stdin: strings.NewReader(input), } args := strings.Split(s, " ") err := cli.Run(args) if got := got.String(); got != want { fmt.Printfln("want %q, but got %q", want, got) }
flagパッケージ: CLIのオプションを作る 22 var showVersion bool fs := flag.NewFlagSet(args[0], flag.ContinueOnError)
fs.BoolVar(&showVersion, "v", false, "show version") fs.BoolVar(&showVersion, "version", false, "show version") fs.Usage = func() { fmt.Printf("yuyufetch %s¥n¥n", version) fmt.Printf("Usage:¥n %s [Options]¥n¥n", "yuyufetch") fmt.Println("Options:") fs.PrintDefaults() fmt.Println("") } if err := fs.Parse(args[1:]); err != nil { return err } if showVersion { fmt.Fprintln(cli.Stdout, "yuyufetch", version) return nil }
ロゴの埋め込み 23 n jp2aの出力をそのままベタ書き… n エスケープシーケンスの扱い • ヒアドキュメント(``で囲む文字列)は、そのまま 表示される •
¥nや¥tは、改行やタブにならずそのまま • jp2aの出力をコピペした場合は、見えない文字で 挿入されている • エスケープコードを ¥x1b と書く場合は “” で 囲む文字列として書く
やりたいこと n このロゴを埋め込んでいるところをなんとかしたい • 自動生成したい n ターミナルサイズに応じてサイズ調整 • 文字列の折返しをしないようにして、ロゴが崩れないように n
色付け部分 • エスケープシーケンスをくっつけた文字列を生成する関数? 24
yuyufetchを作った話でした 25
ありがとうございました
参考文献 n みんなのGo言語 現場で使える実践テクニック n Hiroya-W/yuyufetch • https://github.com/Hiroya-W/yuyufetch n Goで書くテスタブルなCLIツールの作り方
• https://gihyo.jp/article/2022/11/tsukinami-go-03 27