2020/12/09更新
大学4年目にして、Gatsby.jsとnetlifyで個人ブログを始めることができました。自分が得た技術的な知見を、今後このブログにまとめていきたいと考えています。
これからよろしくお願い致します。
Gatsby + Contentful + Netlifyが最高らしいので、これで個人ブログ開設しようと思う
— hibi221b (@hibi221b) October 10, 2020
目次
product
自作コマンドラインツールの紹介です。
git-spy
git-spyは特定のgithubのリポジトリを効率よく取得するスクレイピングツールです。プログラミング言語、リポジトリのスター数、トピックなどを指定して目的のリポジトリを取得します。(Linux, Macで動作します。)
スクレイピングの結果を、~/Downloads/git-spy-result/
以下のjsonファイルに保存します。jsonファイルにはgithubリポジトリ名、url、スター数、リポジトリの説明、キーワードがあります。
このjsonファイルを~/Downloads/git-spy-result/index.html
で読み込むことでスクレイピングの結果を表示させます。
urlをクリックするとリポジトリに飛べます。
How to install
cargoがない場合はRustのホームページからダウンロードすることができます。(Using rustup)
git-spyは次のコマンドを実行すると~/.cargo/bin/git-spy
以下にダウンロードされます。また、which git-spy
でパスの確認をすることができます。
recommend
hibi221b@hibi221b-2 ~ % cargo install --git https://github.com/hibi221b/git-spy.git
NOT recommend
hibi221b@hibi221b-2 ~ % cargo install git-spy
How to use
git-spy -h
でこのコマンドの情報を見ることができます。
hibi221b@hibi221b-2 ~ % git-spy -h
git-spy VERSION
hibi221b
command-line tool to efficiently collect github repository
USAGE:
git-spy
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
今回の例では以下の指定を行っています。
- 言語: rust
- スターの数の範囲の下限: 1000
- スターの数の範囲の上限: *
- トピック: なし
Rustのgithubリポジトリのスターが1000以上のリポジトリをスクレイピングするという意味です。
Rust以外の言語も指定できます。大文字小文字の区別はありません。
▼ language
rust
スターの範囲は上限が必ず大きい値にする必要があります。もしくは*
を上限に指定すると下限の値以上のスターの範囲を指定します。
▼ lower bound of github star.
1000
▼ upper bound of github star. (number or *)
*
トピックは今回は指定していないため、Rustのスター数が高い順にリポジトリを取得しています。トピックにcli
やgui
などを指定すると、githubリポジトリのtopicとマッチしたものだけを取得できます。
▼ topic words.(cli, web, gui, terminal, etc...) If you don't need, press enter.
Run
hibi221b@hibi221b-2 ~ % git-spy
_______ __ .___________. _______. .______ ____ ____
/ _____| | | | | / | | _ \ \ \ / /
| | __ | | `---| |----`______ | (----` | |_) | \ \/ /
| | |_ | | | | | |______| \ \ | ___/ \_ _/
| |__| | | | | | .----) | | | | |
\______| |__| |__| |_______/ |__| |__|
https://github.com/hibi221b/git-spy
▼ language
rust
▼ lower bound of github star.
1000
▼ upper bound of github star. (number or *)
*
▼ topic words.(cli, web, gui, terminal, etc...) If you don't need, press enter.
headless mode: false
search query: language:rust stars:1000..*
info: 346 repository results (The maximum number of repositories git-spy can get is 100)
info: hit 10 repositories
info: page 1/10
get: https://github.com/996icu/996.ICU
get: https://github.com/rust-lang/rust
get: https://github.com/alacritty/alacritty
get: https://github.com/sharkdp/bat
get: https://github.com/BurntSushi/ripgrep
get: https://github.com/xi-editor/xi-editor
get: https://github.com/servo/servo
get: https://github.com/rust-unofficial/awesome-rust
get: https://github.com/libra/libra
get: https://github.com/sharkdp/fd
info: go to the next page
info: hit 10 repositories
info: page 2/10
get: https://github.com/yewstack/yew
get: https://github.com/firecracker-microvm/firecracker
get: https://github.com/rust-lang/rustlings
get: https://github.com/SergioBenitez/Rocket
get: https://github.com/ogham/exa
get: https://github.com/starship/starship
get: https://github.com/actix/actix-web
get: https://github.com/tokio-rs/tokio
get: https://github.com/valeriansaliou/sonic
get: https://github.com/meilisearch/MeiliSearch
info: go to the next page
info: hit 10 repositories
info: page 3/10
get: https://github.com/swc-project/swc
get: https://github.com/nushell/nushell
get: https://github.com/atom-archive/xray
get: https://github.com/tikv/tikv
get: https://github.com/denisidoro/navi
get: https://github.com/analysis-tools-dev/static-analysis
get: https://github.com/hecrj/iced
get: https://github.com/hyperium/hyper
get: https://github.com/tauri-apps/tauri
get: https://github.com/Rigellute/spotify-tui
info: go to the next page
info: hit 10 repositories
info: page 4/10
get: https://github.com/wasmerio/wasmer
get: https://github.com/BurntSushi/xsv
get: https://github.com/openethereum/openethereum
get: https://github.com/amethyst/amethyst
get: https://github.com/uutils/coreutils
get: https://github.com/citybound/citybound
get: https://github.com/sharkdp/hyperfine
get: https://github.com/rust-lang/cargo
get: https://github.com/RustPython/RustPython
get: https://github.com/diesel-rs/diesel
info: go to the next page
info: hit 10 repositories
info: page 5/10
get: https://github.com/benfred/py-spy
get: https://github.com/rust-lang/book
get: https://github.com/imsnif/bandwhich
get: https://github.com/iron/iron
get: https://github.com/actix/actix
get: https://github.com/sharkdp/hexyl
get: https://github.com/autumnai/leaf
get: https://github.com/timberio/vector
get: https://github.com/dandavison/delta
get: https://github.com/rust-lang/rust-clippy
info: go to the next page
info: hit 10 repositories
info: page 6/10
get: https://github.com/rust-lang/mdBook
get: https://github.com/timvisee/ffsend
get: https://github.com/pingcap/talent-plan
get: https://github.com/dabreegster/abstreet
get: https://github.com/clap-rs/clap
get: https://github.com/bottlerocket-os/bottlerocket
get: https://github.com/neon-bindings/neon
get: https://github.com/mimblewimble/grin
get: https://github.com/Peltoche/lsd
get: https://github.com/Canop/broot
info: go to the next page
info: hit 10 repositories
info: page 7/10
get: https://github.com/rust-analyzer/rust-analyzer
get: https://github.com/Geal/nom
get: https://github.com/rayon-rs/rayon
get: https://github.com/bevyengine/bevy
get: https://github.com/gfx-rs/gfx
get: https://github.com/getzola/zola
get: https://github.com/maps4print/azul
get: https://github.com/svenstaro/genact
get: https://github.com/Spotifyd/spotifyd
get: https://github.com/LemmyNet/lemmy
info: go to the next page
info: hit 10 repositories
info: page 8/10
get: https://github.com/tantivy-search/tantivy
get: https://github.com/spacejam/sled
get: https://github.com/XAMPPRocky/tokei
get: https://github.com/Y2Z/monolith
get: https://github.com/cloudflare/quiche
get: https://github.com/tokio-rs/mio
get: https://github.com/bytecodealliance/wasmtime
get: https://github.com/huggingface/tokenizers
get: https://github.com/rust-lang/rustup
get: https://github.com/fdehau/tui-rs
info: go to the next page
info: hit 10 repositories
info: page 9/10
get: https://github.com/rustwasm/wasm-bindgen
get: https://github.com/anordal/shellharden
get: https://github.com/PistonDevelopers/piston
get: https://github.com/serde-rs/serde
get: https://github.com/rust-lang/futures-rs
get: https://github.com/seanmonstar/warp
get: https://github.com/imazen/imageflow
get: https://github.com/bytecodealliance/lucet
get: https://github.com/rust-lang/rustfmt
get: https://github.com/seanmonstar/reqwest
info: go to the next page
info: hit 10 repositories
info: page 10/10
get: https://github.com/racer-rust/racer
get: https://github.com/crossbeam-rs/crossbeam
get: https://github.com/graphql-rust/juniper
get: https://github.com/tree-sitter/tree-sitter
get: https://github.com/rust-lang/rls
get: https://github.com/ruffle-rs/ruffle
get: https://github.com/autozimu/LanguageClient-neovim
get: https://github.com/koute/stdweb
get: https://github.com/PyO3/pyo3
get: https://github.com/sharkdp/pastel
info: 100 repositories acquired. ($HOME/Downloads/git-spy-result/xxxxx.json)
info: The maximum number of items(100) has been reached.
Result
対話的にリポジトリの情報を指定した結果、346のリポジトリがヒットしました。しかしgit-spyの取得できるリポジトリの上限は100までにしてあるため、346のリポジトリの内、上位100のリポジトリを取得します。
macを使用している場合は自動的に~/Downloads/git-spy-result/index.html
が開かれます(linuxの場合は手動でhtml開く必要があります。)。その後、~/Downloads/git-spy-result
以下にあるjsonファイルを指定して読み込みます。(jsonファイルの名前を変更すると読み込めません。)
[
{
"url": "https://github.com/996icu/996.ICU",
"repo": "996.ICU",
"desc": "Repo for counting stars and contributing. Press F to pay respect to glorious developers.",
"star": "252k",
"keywords": "NOT_FOUND"
},
{
"url": "https://github.com/rust-lang/rust",
"repo": "rust",
"desc": "Empowering everyone to build reliable and efficient software.",
"star": "48.8k",
"keywords": "rust compiler"
},
{
"url": "https://github.com/alacritty/alacritty",
"repo": "alacritty",
"desc": "A cross-platform, GPU-accelerated terminal emulator",
"star": "25.8k",
"keywords": "terminal-emulators macos gpu windows linux rust terminal opengl bsd vte"
},
{
"url": "https://github.com/sharkdp/bat",
"repo": "bat",
"desc": "A cat(1) clone with wings.",
"star": "23.1k",
"keywords": "syntax-highlighting git rust cli terminal command-line tool hacktoberfest"
},
...
...
...
{
"url": "https://github.com/PyO3/pyo3",
"repo": "pyo3",
"desc": "Rust bindings for the Python interpreter",
"star": "3k",
"keywords": "rust python binding ffi python-c-api"
},
{
"url": "https://github.com/sharkdp/pastel",
"repo": "pastel",
"desc": "A command-line tool to generate, analyze, convert and manipulate colors",
"star": "3k",
"keywords": "rust cli terminal command-line tool colors color-converter color-space"
}
]
Example
git-spyによって取得した情報を単一のhtmlファイルにして保存し、github pagesで表示したものです。
修正
2020/12/09
- Rustlangの上位500のリポジトリをまとめたgithub pagesを削除。 こちらに移行
- git-spyの新しいインストール方法を追加