Upgrade to Pro — share decks privately, control downloads, hide ads and more …

最近作ったもの

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

 最近作ったもの

最近作ったものを紹介

Avatar for onozaty

onozaty

April 08, 2021
Tweet

More Decks by onozaty

Other Decks in Programming

Transcript

  1. filist • ファイルパス以外にも、ファイルサイズ、更新日時、ハッシュな どの情報を一緒に出力できる $ filist -h Usage: filist [options]

    directory ... options -r, --rel Print relative path (If neither 'rel' nor 'abs' is specified, 'rel' will be printed first column.) -a, --abs Print absolute path -s, --size Print file size -m, --mtime Print modification time -M, --md5 Print MD5 hash -S, --sha1 Print SHA-1 hash --sha256 Print SHA-256 hash -h, --help Help
  2. filist • オプションで指定した順に情報が並ぶので、各項目の表示順は自 由自在 $ filist -r -M . a.txt

    3d3a42d900823afcfdfeb6de338bcec1 b/1.txt ae23e0b40e773ac132f477f661e89b86 b/2.txt 494ba81d0d828ff9a244da627b5ece47 $ filist -M -r . 3d3a42d900823afcfdfeb6de338bcec1 a.txt ae23e0b40e773ac132f477f661e89b86 b/1.txt 494ba81d0d828ff9a244da627b5ece47 b/2.txt
  3. file-collector ファイル収集のための雑多なツール類を整理していこうと思って作り 始めたプロジェクト。 • file-collector-download • URL一覧を元に、ファイルを並列でダウンロードするJavaのCLIツール • file-collector-github •

    GitHubでコード検索してヒットしたファイルをダウンロードするJavaの CLIツール URL https://github.com/onozaty/file-collector 作成時期 2021年3月 言語等 Java、Selenium
  4. file-collector-github • 検索クエリと出力先を指定して実行 • Chromeが立ち上がり、GitHubのログインページで一旦停止するので、そこ で手動でログイン情報を入力する必要がある • ログインしないとコード検索自体出来ないのでやもえず $ java

    -jar build/libs/file-collector-github-all.jar -q "extension:pdf filename:test5" -o output 23:59:40.552 [main] INFO GitHubFileCollector - Search started. The number of queries is 1. 23:59:42.286 [main] INFO GitHubWebSearcher - (1/1) [extension:pdf filename:test5] Started. 00:01:36.162 [main] INFO GitHubWebSearcher - (1/1) Finished. The number of URLs was 423. 00:01:36.820 [main] INFO GitHubFileCollector - Search finished. The number of total URLs is 393. 00:01:36.830 [main] INFO GitHubFileCollector - Download started. 00:02:10.120 [main] INFO GitHubFileCollector - Download finished. The number of files successfully downloaded was 393.
  5. mvndl インターネット上のMavenリポジトリから、Mavenリポジトリのフォ ルダ構造のままファイルをダウンロードするCLIツール。 URL https://github.com/onozaty/mvndl 作成時期 2021年2月 言語等 Go $

    mvndl -r jcenter -g com.github.onozaty -a postgresql-copy-helper -v 1.0.0 -d local-repo https://jcenter.bintray.com/com/github/onozaty/postgresql-copy-helper/1.0.0/postgresql-copy-helper-1.0.0.pom -> saved https://jcenter.bintray.com/com/github/onozaty/postgresql-copy-helper/1.0.0/postgresql-copy-helper-1.0.0.jar -> saved https://jcenter.bintray.com/com/github/onozaty/postgresql-copy-helper/1.0.0/postgresql-copy-helper-1.0.0-sources.jar -> saved https://jcenter.bintray.com/com/github/onozaty/postgresql-copy-helper/1.0.0/postgresql-copy-helper-1.0.0-javadoc.jar -> saved $ mvndl –h Usage of mvndl: -r, --repository string Maven repository ("jcenter" or "central" or Specify by url) -g, --group string Group ID -a, --artifact string Artifact ID -v, --version string Version -d, --dest string Destination directory for download files -h, --help Help ※Mavenリポジトリは、Javaのライブラリが登録されたリポジトリ。ビルドツールにおけるライブラリの取得と依存関係の解決に利用される。
  6. createfile 指定サイズのファイルを作成するCLIツール。 • テキストかバイナリで中身のパターンを指定できる • 大きなファイル作りたい時とかに URL https://github.com/onozaty/createfile 作成時期 2020年12月

    言語等 Go $ createfile -t abc -s 1GB -o 1gb.txt $ createfile -b 616263 -s 1GB -o 1gb.txt $ createfile -h Usage of createfile: -t, --text string text pattern -b, --binary string binary pattern -s, --size string size -o, --output string output file path -h, --help Help
  7. createfile ◆0x00で埋められた1GBのファイルを作る ◆0-9の数字の繰り返しで16バイトのテキストファイルを作る $ createfile -b 00 -s 1GB -o

    null.dat $ ls -lh null.dat -rw-r--r--. 1 root root 1.0G Apr 1 14:50 null.dat $ hexdump null.dat 0000000 0000 0000 0000 0000 0000 0000 0000 0000 * $ createfile -t 0123456789 -s 16 -o 16.txt $ ls -lh 16.txt -rw-r--r--. 1 root root 16 Apr 1 15:04 16.txt $ cat 16.txt 0123456789012345
  8. Redmine issue assign notice plugin • チケットの担当者が変わった時に、下記のような内容の投稿をして くれる • 1行目:

    担当者変更に関する情報 • 2行目: プロジェクト名、トラッカー、チケット番号、題名、ステータス • トラッカー+チケット番号はリンクになっている • 3行目: チケット新規作成時は説明、チケット変更時は注記(先頭200文字ま で)
  9. Redmine issue assign notice plugin • メンションも飛ばせる • 自分自身を担当にした際にはメンションは飛ばないようにしている •

    自分で変更したということは、既に知っていることなので • TeamsはIncoming Webhookでメンションに対応していないのでメンショ ンできない • メンション用のIDはユーザのカスタム フィールドとして設定
  10. Redmine issue assign notice plugin • RedmineのIssueが作成/変更されたら通知するようなプラグインは 他にもあるが、担当者が変更になった時だけわかれば十分 • 他の情報も流れると、情報量が多くなりすぎて逆に埋もれてしまいかねな

    い • そのチャンネルからの通知はメンションのみにしておけば、自分が 担当になった時だけ通知が来るようになる • チケットの担当者を切り替えながら進めていくようなプロジェクト においては、とても役に立つプラグイン
  11. xml2csv XMLをCSVへ変換するCLIツール。 • マッピング情報をJSONで定義しておいて、その情報に基づいて XMLからCSVへ変換を行う URL https://github.com/onozaty/xml2csv 作成時期 2020年9月 言語等

    Go $ xml2csv -i input.xml -m mapping.json -o output.csv $ xml2csv –h Usage of xml2csv: -i, --input string XML input file path or directory or url -m, --mapping string XML to CSV mapping file path or url -o, --output string CSV output file path -b, --bom CSV with BOM -h, --help Help
  12. xml2csv • マッピングはXPathで記載(以下はRSSを変換する定義) • rowsPath で行として取得するXPathを記載 • columns で各列のヘッダ名と、値を取得するXPathを記載 {

    "rowsPath": "//item", "columns": [ { "header": "title", "valuePath": "/title“ }, { "header": "link", "valuePath": "/link“ }, { "header": "description", "valuePath": "/description“ } ] }
  13. xml2csv <?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0"> <channel> <title>W3Schools Home

    Page</title> <link>https://www.w3schools.com</link> <description>Free web building tutorials</description> <item> <title>RSS Tutorial</title> <link>https://www.w3schools.com/xml/xml_rss.asp</link> <description>New RSS tutorial on W3Schools</description> </item> <item> <title>XML Tutorial</title> <link>https://www.w3schools.com/xml</link> <description>New XML tutorial on W3Schools</description> </item> </channel> title,link,description RSS Tutorial,https://www.w3schools.com/xml/xml_rss.asp,New RSS tutorial on W3Schools XML Tutorial,https://www.w3schools.com/xml,New XML tutorial on W3Schools xml2csv -i rss.xml -m rss.json -o rss.csv
  14. 新しいバージョンをリリースしたもの • Redmine view customize plugin https://github.com/onozaty/redmine-view-customize • Redmineの画面をJavaScript、CSSでカスタマイズするプラグイン •

    過去1年間で3回の機能リリース、1回のバグフィックスを実施 • Redmine issue loader https://github.com/onozaty/redmine-issue-loader • CSVファイルに記載された情報を読み込んで、Redmineにチケットとして登 録、更新するツール • 2020年5月に機能リリース