Skip to content

Linux

ripgrep-all を使って CLI で PDF を検索する

以前に Ubuntu に ripgrep をインストールする というメモを書きました。 ripgrep (rg) は [Rust] 製のツールで grep と同じように検索が行えます。 ripgrep がインストールされている前提ですが、rga を使うとテキストファイルだけで無く、様々なファイルを検索出来るようになります。 ripgrep-all の GitHub ページには以下の説明がされています。

rga is a line-oriented search tool that allows you to look for a regex in a multitude of file types. rga wraps the awesome ripgrep and enables it to search in pdf, docx, sqlite, jpg, movie subtitles (mkv, mp4), etc.

ripgrep も ripgrep-all も macOS であれば Homebrew から、Ubuntu であれば Rust Tools apt repo から、いずれにしても簡単にインストールすることが出来ます。 Rust Tools apt repo のインストール方法は Ubuntu に「Rust Tools apt repo」をインストールする にメモしました。 今回は ripgrep-all を使って PDF ファイルを検索する方法をメモしておきます。

Ubuntu 22 上で作成した Ubuntu 24 のカスタム qcow2 イメージを CML で起動する

以前に以下のメモを書きました。

この過去メモに記載した init-os リポジトリへ新たに Ubuntu 24 の qemu イメージをカスタマイズする為の init-qemu-ubuntu24.sh というスクリプトを追加しました。 今回はこのスクリプトを使って作成した Ubuntu 24 イメージを CML 上で動作させる手順をメモしておきます。

CLI の HTTP クライアントである xh の基本的な使い方

以前に HTTPie のインストールと基本的な使い方 というメモを書きました。 HTTPie は CLI の HTTP / HTTPS クライアントです。 これを Rust で書き直したものが xh です。 xh は HTTPie とオプションがほぼ互換である為、HTTPie の利用経験があれば xh も利用出来るはずです。 HTTPie と xh の比較については How xh compares to HTTPie に以下の記載があります。

Advantages
  • Improved startup speed.
  • Available as a single statically linked binary that's easy to install and carry around.
  • HTTP/2 support.
  • Builtin translation to curl commands with the --curl flag.
  • Short, cheatsheet-style output from --help. (For longer output, pass help.)
Disadvantages
  • Not all of HTTPie's features are implemented. (#4)
  • No plugin system.
  • General immaturity. HTTPie is old and well-tested.
  • Worse documentation.

今回は xh の基本的な使い方をメモしておきます。

Ubuntu に「Rust Tools apt repo」をインストールする

昨今、様々なツールが Rust で提供されています。 一例ですが、下記などです。

余談ですが、Rustで進化するPayPayのスケーラビリティ によると PayPay も「Java + NodeJS」から「Rust」へ移行しているそうです。

Rust Tools apt repo (GitHub リポジトリはこちら) を利用すると、Debian / Ubuntu へ apt を利用して幾つかの Rust 製ツールをインストール出来ます。 Rust 製ツールであれば Cargo で管理出来ますが、OS のパッケージも Rust 製ツールも全てを apt で扱えれば管理が楽になります。 今回はこの Rust Tools apt repo を Ubuntu で利用出来るようにする手順をメモしておきます。

Python を mise でインストールし、uv の venv で仮装環境を管理する

asdf と似たバージョンマネージャに mise があります。 about には mise の特徴として 3 点、挙げられています。

Its functionality is grouped into 3 categories described below.

mise installs and manages dev tools/runtimes like node, python, or terraform both simplifying installing these tools and allowing you to specify which version of these tools to use in different projects. mise supports hundreds of dev tools.

mise manages environment variables letting you specify configuration like AWS_ACCESS_KEY_ID that may differ between projects. It can also be used to automatically activate a Python virtualenv when entering projects too.

mise is a task runner that can be used to share common tasks within a project among developers and make things like running tasks on file changes easy.

今回は mise を使って Python をインストールし、更に mise と uv を連携させ、uv で作成した venv 環境を利用する手順をメモしておきます。 尚、公式サイトには mise と Python を組み合わせて利用する際の設定例が記載された Mise + Python Cookbook というページもあります。

MariaDB で mysql_secure_installation は必要か?

MySQLMariaDB をインストールした後は mysql_secure_installation を実行する、という手順をよく見かけます。 ですが、その mysql_secure_installation 本当に必要ですか? という記事があり、「果たして必ずしも mysql_secure_installation は必要なのか?」という点に触れています。 この記事の観点・内容が非常に面白かったので、実際に手元の環境でも試してみました。 この記事を公開してくださった @hato_poppo さんに感謝です!