Categorygithub.com/e10ulen/sandbox
module
0.0.0-20210525015209-9cebf9f5eb6b
Repository: https://github.com/e10ulen/sandbox.git
Documentation: pkg.go.dev

# README

これなに

e10ulenの習作プログラム集です。
各フォルダで使ってるライブラリが違ったり、手動テストしてたり、後は自作プログラムのライブラリだったりします。

以下は各フォルダについての説明です。

blackjackフォルダ

現在プログラミング入門者からの卒業試験は『ブラックジャック』を開発すべしを読み、golangで実装できないかとしています
(items以下のURLが長いので直打ちするの怖い(pushするときだけテザリングでネット繋いでる))

kingpinフォルダ

todoアプリの前段階、色々とテストした場所。
yamlを読んでみたり、jsonを読んでみたりした。
結局todoは標準ライブラリを使ってファイル読み書きすることにした。

tuiフォルダ

marcusolsson/tui-goを使ってテキストユーザインタフェースの実装をしてみたかった

mdフォルダ

以上二点を使ったテスト、blackfridayの方はlibフォルダにてMarkdown4html関数に使っています。

servフォルダ

特筆すべきことはないが、net/httpのサーバ立ち上げについてのテスト。
lib.MiniServe関数に組み込まれているのはこれ

termフォルダ

mattn/go-isatty

scrapフォルダ

以上二点の使い方テスト?を行ったフォルダ

scanフォルダ

特筆すべきことはないが、bufioとかの使い方をテストしたかっただけ、
lib.ScanLineに組み込まれているので必要なし。

testフォルダ

libの関数追加や、libの関数をすぐ使いたい時に

homedirフォルダ

mitchellh/go-homedirを使ってmattn/todoの処理だとバグる
os.Getwd()の代わりに使用するためのテスト
なんかググってもまともに情報出てこないし、
とりあえず、valueがいくつひつようなのかとかのテストしたフォルダ

rot13フォルダ

なんとなく、kingpin使って、暗号化と復号化が実装できたらなと挑戦した。
バグってます。

libフォルダ

lib.xxxxという形でライブラリとし、

  • 簡易サーバ
  • Markdownをhtml化
  • 標準入力の簡素化
  • スライスの生成
  • スライスシャッフル
  • スライスの削除

以上六点を提供する自作ライブラリである。

todoフォルダ

以上二点を参考にkingpinで作成したtodoアプリである。
済:現状はまだバグっているので対処する。
e10ulen/todoに移動しました。

msdフォルダ

  • e10ulen/sandbox
  • alecthomas/kingpin
  • mattn/go-mastodon
    自作アプリ、todoのソースを見ながらkingpinを使い、mastodonに接続するツールです。
    現在、タイムライン(ローカルタイムライン)とトゥートに対応しています。
    時期にローカルタイムラインとホームタイムラインをコマンドで分け実装します。
    なおかつ、ローカルタイムラインはストリームに対応します。
    一応すでに使える状態であります。 msdフォルダにあるexample.yamlを書き換えてHOME直下に.mastodon.yamlとして置いてください。
    e10ulen/msdに移動しました。

msd2

自作アプリ、e10ulen/msd を元にmattnさんのgo-gtkでGUIを付加したものになります。
現在、ローカルタイムラインを描画します(20件)。
e10ulen/msdと同じ設定ファイルを使用するようになってます。

以下のdisplayname内に disp = strings.Replace(disp, "FooBarBaz", "FooBaz", -1) を記載すれば置換されます。
表示名そのままを描画すると長すぎるのに全部描画しようとするので自らの調整が必要になります。

さらにその下にあるcontentはTootを取得した際、

タグや
タグを処理するための箇所です。
お好みで書き換えてくださいますよう

``

func func displayname(t *m.Status) string { disp := t.Account.DisplayName

return disp

}

``

discordフォルダ

example.config.jsonをconfig.jsonにリネームして、

  • Discord/Developer ここでBotアカウントを作成しDiscordサーバーに招待して、アクセストークンを取得します。 詳細は下記を参照してください。
  • Discord Botアカウント初期設定ガイド for Developer 適宜example.config.jsonを書き換え、実行すると、全チャンネルのテキストを取得します。それだけのbotです(改修予定)

fakeStatusChangeフォルダ

upageフォルダ

  • PuerkitoBio/goquery goqueryを使い、「VIPでテキストサイトしようぜ」避難所からスクレイピングしようとしています。 現状、txtfile化は成功。Markdownかなにかで吐き出して別のプログラムからアクセスし、Linkとして整形しようと思います。

ggフォルダ

  • alecthomas/kingpin.v2
    git commit を適宣楽にしようとして作ってるgolang書き始めた時から色々書き換えたりしてるツールです。
    e10ulen/ggに移動しました。

よく使うライブラリ

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author