Skip to content

Commit

Permalink
refactor: Update blogtool structure and add stripexif command
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayao0819 committed Jan 21, 2025
1 parent 3a81021 commit fc3ecfe
Show file tree
Hide file tree
Showing 19 changed files with 275 additions and 58 deletions.
2 changes: 1 addition & 1 deletion blogtool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if ! type go 2> /dev/null 1>&2; then
fi

script_path=$(cd "$(dirname "$0")" || exit 1; pwd)
go run -- "$script_path/." "$@"
go run -- "$script_path/tools/." "$@"
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ go 1.22

require (
github.com/Hayao0819/nahi v0.0.3
github.com/disintegration/imaging v1.6.2
github.com/spf13/cobra v1.8.1
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 // indirect
)
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
github.com/Hayao0819/nahi v0.0.3 h1:sdXZO523hZJYLe9wSvEhAQEzkxfCyKer3gpKNeba7i4=
github.com/Hayao0819/nahi v0.0.3/go.mod h1:6y4OH/3jDW6HX3L2LoaE+GvNlqAzUG0hrpba9U1b2XA=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 h1:hVwzHzIUGRjiF7EcUjqNxk3NCfkPxbDKRdnNE1Rpg0U=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
29 changes: 29 additions & 0 deletions posts/20250117/nunupc/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: ジャンクPCと二郎ラーメンのオタク活動日誌
description: ""
date: 2025-01-17T22:29:04.688621314+09:00
categories:
- プライベート
draft: true
publish: true
---

今日は私と大学の先輩2人で[NUNU PC](https://www.nunupc.com/)様の工房にお邪魔してきました。

## NUNU PCとは

VRChat向けのPCを販売している通販サイトが[NUNU PC](https://www.nunupc.com/)です。

今回、特別な縁によって実際にPCの整備を行っている工房にお邪魔してきました。

とあるDiscordサーバーでNUNU PCさんから「うちの工房にあるジャンクなもの買わない?(要約)」と誘われたのがきっかけです。

## 工房の様子

~~とても私には手が出せないような~~多くの最新型のPCが置かれており、わくわくする環境でした。
安さだけを最重視して組んでしまう私とは違って、ケースやマザーボードのメーカーや配色が統一されたキレイなものが並んでいました。

しかし今回の目的は正規に販売されているものではなく、売り物にならないジャンクな物たちです。
お店では扱えない古い世代の代物を格安で譲っていただきました。

## 譲っていただいたもの
96 changes: 96 additions & 0 deletions posts/20250119/ski/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
title: 大学の仲間と石打丸山スキー場に行った話
description: ""
date: 2025-01-19T11:24:34.166058869+09:00
categories:
- プライベート
tags:
- 旅行
- スキー
draft: true
publish: true
---

某シェアオフィスの面々と石打丸山スキー場に行き、2日間にわたって遊んできました。

今は越後湯沢駅の前の蕎麦屋で順番を待ちながら忘れないうちに書いています。

## 持っていったもの

## 一日目

一日目は主にスキーです。

### スキー場まで

前橋駅から7時8分発の電車へ乗り、高崎へ向かいました。宿及びスキー場の最寄り駅である越後湯沢は新幹線で30分程度で行けるため、車の免許を持っていない交通手段弱者である私には非常にありがたいのです。

私のお財布事情を考慮すると鈍行以外の選択肢はありえないという感じなのですが、私の周りは皆新幹線で行くらしく逸れたり合流したりするのも面倒なため新幹線を選択しました。

駅前では他のスキー場へのバスに並んでいる大勢の人(私は昨年このバスに乗って神立へ行った)を通り越して、宿や出してくれている無料の送迎車に乗車。
ディズニーのファストパスやこういった際の「並んでいる人間を横目に見ながら大幅な時間短縮を行う」という行為の際に感じる優越感を得ると旅行に来たなと実感します。
(時間は金で買えるとはこのことでしょう。)

今回宿泊した場所は[LODGE CANADA](https://www.lodgecanada.com/)さんです。

### スキー

宿に到着したら、早速お部屋に向かいます。今回の私の部屋は4人部屋で、中には金庫とテレビがある和室で真ん中にこたつが置いてありました。(写真撮り忘れました申し訳ない。)

リフト券を宿で取ってもらいお値段なんと約5000円。今回は三山共通のリフト券は使いませんでした。次は使いたいな……
午前中は初めてスキーをやるという方々に講習会。午後はスキー部の先輩とひたすら滑っていました。
この日の天気は滑り始める前までは降雪があり、滑り始めと同時に快晴になるという最高の状態でした。

山頂までリフトで登ると、他のスキー場との接続が見えると同時に下町を一望することができます。
多くのスキー場では眼の前に他の山々がドンドンという感じですが、このスキー場は実際に道路を車や人が歩いているような日常の生活が上から観察できます。
東京タワーのような感じで下町を覗き込みながら滑れるので非常に風景が楽しいスキー場でした。

![ski1](ski1.png)

また、このスキー場の特色として、謎の暖房付きゲーミングリフトがあります。[サンライズエクスプレス](https://ishiuchi.or.jp/winter/facilities/sunrise-express/)とかいう
この謎のゲーミングチェアの如く豪勢なこのリフトは、果たしてどこに需要があるのだろうかという感じではあるものの座り心地はやはり格別でした。
同乗可能人数もリフトで6人、ゴンドラで10人とかなりの人数が並んでいる状況にも関わらず非常に良い回転率を実現しており、結果として多く滑れたような気がします。
~~それにしても暖房機能や妙にふかふかなゲーミングチェアは不要な気がしますが。~~

<!-- ここにリフトの写真 -->

昼食はスキー場の中腹にあるロッジで取りました。20歳になって初めてのスキーなのでスキー場でお酒を飲むのも初めてだったのですが、ここまでビールを美味しく感じたのは初めてでした。
カレーを食べて(写真撮り忘れ2)、そのまま後半はスキー部の先輩とひたすら滑りました。

ずっと独学と見様見真似でスキーをやっているので、パラレルが一切できず非常にカッコ悪い感じの滑り方になってしまいます。
どうにかパラレルをできるようになろうと練習を繰り返しているうちに気がついたら上級者コース(ダイナミックBコース)で思いっきり転倒しました。
板が雪に引っ張られてバランスを崩し、そのまま右足首を大きく捻って全身を強く打ち、板やストックが全部はずれた状態で下方へ3mほど転げ落ちました。

非常に急な坂なので少しでも動くと下に転げ落ちてしまうという状況で、どうしたものかと悩んでいるとめちゃくちゃ上手なスキーヤーの方が助けていただきました。
自分が憧れている将来像の1つが、この「めちゃくちゃスキーが上手い上に助けてくれるイケオジ」になりたいという密かな目標があります。

そんなこんなで16:30まで滑りました。一部のリフトが16:00で終了してしまうことを知らず、板を持って坂道を登ったことが体力を大きく消費する要因となり、
これ以上は足の疲労でコントロールが効かなくなりそうということでナイターを滑ることなく終了してしまいました。

このスキー場は昼間とナイターで具体的な境界がなく、一部のリフトは夜遅くまでやってると言った感じでリフト券も共通であるという珍しい感じです。
家に引きこもってるだけでなく体力をつけないとスポーツを十分に楽しむことはできないと日頃の運動不足を後悔しております。

コースも多い上に雪質も良く、シーズン真っ只中であるにも関わらずリフトに並ぶのは長くても数分と非常に快適なスキー場でした。
三山のリフト券や1度しか行けなかったコースも多いので、是非また行ってみたいスキー場だと思いました。

### 銭湯

当初は別の温泉に行こうとしていたものの「あそこは混んでて入浴を断られるよ」とロッジのおじさんに助言されました。
念の為電話で確認を行うと確かに定員に達しているので難しいという返事をもらった結果、またまたロッジのおじさんに代替案を教えていただきました。

そして向かったのが「ハツカ石温泉 石打ユングパルナス」です。多くのスキーヤー・ボーダーで非常に賑わっていました。
我々は温泉として向かいましたが旅館でもあるようです。ロッジのおじさんに200円割引券を頂いたので(!!)、700円で入浴できました。

お風呂の中は2種類のサウナと多くの種類の温泉があり、非常に楽しめるものでした。

## 二日目

2日目はスキーはせず、観光して午後には帰ります。

### お土産・観光

ロッジの送迎で駅まで送ってもらった後、越後湯沢駅周辺の観光をしました。

駅構内には非常に多くの

### 食事
Binary file added public/posts/20250119/ski/ski1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
<GoogleAnalytics />
</Suspense>
</head>
<body className="overscroll-y-none">
<body className="overscroll-y-none font-gothic">
<ViewTransitions>{children}</ViewTransitions>
</body>
</html>
Expand Down
2 changes: 1 addition & 1 deletion src/components/elements/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default async function Markdown({ content, basepath }: { content: string;
<p
// // @ts-expect-error word-breakでauto-phraseを使うための型定義がない
// style={{ wordBreak: "auto-phrase" }}
className="py-2 leading-6"
className="py-2"
id={id}
>
{children}
Expand Down
4 changes: 2 additions & 2 deletions blogtool.go → tools/blogtool.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package main
import (
"os"

"github.com/Hayao0819/hayao0819.com/tools"
"github.com/Hayao0819/hayao0819.com/tools/cmd"
)

func main() {
cmd := tools.Cmd()
cmd := cmd.Root()
cmd.SetOutput(os.Stdout)
if err := cmd.Execute(); err != nil {
cmd.SetOutput(os.Stderr)
Expand Down
7 changes: 5 additions & 2 deletions tools/cmd/list.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package cmd

import "github.com/Hayao0819/hayao0819.com/tools/cmd/list"
import (
"github.com/Hayao0819/hayao0819.com/tools/cmd/list"
"github.com/Hayao0819/nahi/cobrautils"
)

func init() {
SubCmds = append(SubCmds, list.Cmd())
cobrautils.AddSubCmds(list.Cmd())
}
7 changes: 5 additions & 2 deletions tools/cmd/moveimg.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package cmd

import "github.com/Hayao0819/hayao0819.com/tools/cmd/moveimg"
import (
"github.com/Hayao0819/hayao0819.com/tools/cmd/moveimg"
"github.com/Hayao0819/nahi/cobrautils"
)

func init() {
SubCmds = append(SubCmds, moveimg.Cmd())
cobrautils.AddSubCmds(moveimg.Cmd())
}
8 changes: 4 additions & 4 deletions tools/cmd/moveimg/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import (
func Cmd() *cobra.Command {
var postsDir string
var publicDir string
var currnet_dir string
var currentDir string

cmd := cobra.Command{
Use: "moveimg",
Short: "画像を移動します",
PreRunE: func(cmd *cobra.Command, args []string) error {
// カレントディレクトリを取得
var err error
currnet_dir, err = os.Getwd()
currentDir, err = os.Getwd()
if err != nil {
return err
}
Expand Down Expand Up @@ -97,8 +97,8 @@ func Cmd() *cobra.Command {
},
}
cobrautil.ApplyTemplate(&cmd)
cmd.Flags().StringVarP(&postsDir, "posts-dir", "p", path.Join(currnet_dir, "posts"), "記事のディレクトリ")
cmd.Flags().StringVarP(&publicDir, "public-dir", "P", path.Join(currnet_dir, "public", "posts"), "公開ディレクトリ")
cmd.Flags().StringVarP(&postsDir, "posts-dir", "p", path.Join(currentDir, "posts"), "記事のディレクトリ")
cmd.Flags().StringVarP(&publicDir, "public-dir", "P", path.Join(currentDir, "public", "posts"), "公開ディレクトリ")

return &cmd
}
7 changes: 5 additions & 2 deletions tools/cmd/newpost.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package cmd

import "github.com/Hayao0819/hayao0819.com/tools/cmd/newpost"
import (
"github.com/Hayao0819/hayao0819.com/tools/cmd/newpost"
"github.com/Hayao0819/nahi/cobrautils"
)

func init() {
SubCmds = append(SubCmds, newpost.Cmd())
cobrautils.AddSubCmds(newpost.Cmd())
}
18 changes: 16 additions & 2 deletions tools/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
package cmd

import "github.com/spf13/cobra"
import (
"github.com/Hayao0819/hayao0819.com/tools/utils/cobrautil"
"github.com/Hayao0819/nahi/cobrautils"
"github.com/spf13/cobra"
)

func Root() *cobra.Command {
root := cobra.Command{
Use: "blogtool",
Short: "ブログを管理するためのいい感じなツール",
Long: "ブログの記事の新規作成やその他をよしなにしてくれるものです",
}
cobrautils.BindSubCmds(&root)
cobrautil.ApplyTemplate(&root)
return &root
}

var SubCmds [](*cobra.Command) = [](*cobra.Command){}
10 changes: 10 additions & 0 deletions tools/cmd/stripexif.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package cmd

import (
"github.com/Hayao0819/hayao0819.com/tools/cmd/stripexif"
"github.com/Hayao0819/nahi/cobrautils"
)

func init() {
cobrautils.AddSubCmds(stripexif.Cmd())
}
58 changes: 58 additions & 0 deletions tools/cmd/stripexif/cmd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package stripexif

import (
"errors"
"os"
"path"
"path/filepath"

"github.com/Hayao0819/hayao0819.com/tools/utils/cobrautil"
"github.com/Hayao0819/nahi/flist"
"github.com/spf13/cobra"
)

func Cmd() *cobra.Command {
var publicDir string
var currentDir string
cmd := cobra.Command{
Use: "stripexif",
PreRunE: func(cmd *cobra.Command, args []string) error {
var err error

currentDir, err = os.Getwd()
if err != nil {
return err
}

publicDir, err = filepath.Abs(publicDir)
if err != nil {
return err
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
files, err := flist.Get(publicDir)
if err != nil {
return err
}

errs := []error{}
for _, file := range *files {
err := stripExif(file)
if err != nil {
cmd.PrintErrln(err)
errs = append(errs, err)
}
}

if len(errs) > 0 {
return errors.New("error occurred. see logs")
}

return nil
},
}
cobrautil.ApplyTemplate(&cmd)
cmd.Flags().StringVarP(&publicDir, "public-dir", "P", path.Join(currentDir, "public", "posts"), "公開ディレクトリ")
return &cmd
}
35 changes: 35 additions & 0 deletions tools/cmd/stripexif/strip.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package stripexif

import (
"strings"

"github.com/Hayao0819/nahi/futils"
"github.com/disintegration/imaging"
)

func stripExif(file string) error {

ft, err := futils.DetectFileType(file)
if err != nil {
return err
}

isImage := strings.HasPrefix(ft, "image")

if !isImage {
return nil
}

img, err := imaging.Open(file, imaging.AutoOrientation(true))
if err != nil {
return err

}

// imaging.Save(img, file)
if err := imaging.Save(img, file); err != nil {
return err
}

return nil
}
Loading

0 comments on commit fc3ecfe

Please sign in to comment.