ディスク増設したあと、Cドライブを拡張する方法
こんにちは、ナナオです。 最近、128GB -> 500GBにディスクを増設したのですが、ディスククローンまではいつもこれを使っていて問題なかったのですが、Cドライブの拡張にちょっと手こずったので備忘録として残しておきます。 なんで手こずった Cドライブの拡張にはwindowsでは「ディスクの管理」というユーティリティがあるので、ここからディスクの拡張などはできるはずなのですが、図のようになっていました。 図のように、Cドライブの隣の隣に拡張された未割当の領域があります。 「なんだ、拡張できそうじゃん」となりますが、未割当領域はCドライブに隣接していないと拡張できないのです。。 「じゃあ隣まで持って来ればいいじゃん!」となりますが、このユーティリティからだとその操作ができないんですよね。なんでやねん。 じゃあどうするか ということで、diskpartコマンドを使って解決します。 管理者権限でコマンドプロンプトを開き、以下のコマンドを実行します。 diskpart 実行するとdiskpartツールが実行されます。 ここでlist diskを実行して、ディスクを選択します。 私の場合ディスクは一つしかないので、0を選択します。 DISKPART> list disk ディスク 状態 サイズ 空き ダイナ GPT ### ミック ------------ ------------- ------- ------- --- --- ディスク 0 オンライン 476 GB 357 GB * DISKPART> select disk 0 ディスク 0 が選択されました。 次にlist partitionでパーティションの一覧を見ます。 DISKPART> list partition Partition ### Type Size Offset ------------- ------------------ ------- ------- Partition 1 システム 200 MB 1024 KB Partition 2 予約済み 16 MB 201 MB Partition 3 プライマリ 118 GB 217 MB Partition 4 回復 783 MB 118 GB 大体さきほどのディスクの管理の画面で見た情報と変わらないですね。 ...
ryeからuvに乗り換える
こんにちは、ナナオです。 よく使っているノートPCでは完全にuvしか使っていないのですが、デスクトップではまだryeを使っていたのでもうuvに乗り換えてしまおうと思います。 (将来的に置き換えられるらしいからね。。) Rye and uv · astral-sh/rye · Discussion #1342 · GitHub ryeのアンインストール rye自身がアンインストールコマンドを用意しています。 rye self uninstall コマンドを実行後、Don't forget to remove the sourcing of $HOME/.rye/env from your shell config.と言われるので、言われるがままにこのディレクトリも削除します。 rm -rf ~/.rye また、.zshrcなどに定義したryeの設定も削除します。 # 以下の行を削除 source "$HOME/.rye/env" これでアンインストールは完了です! uvのインストール 続けてuvをインストールしましょう。 せっかくなので前回入れたmiseを使ってインストールします。 ❯ mise install uv mise uv@0.9.25 ❯ mise use -g uv mise ~/.config/mise/config.toml tools: uv@0.9.25 インストールできました。 ryeを使っていたプロジェクトではどうするか uv syncを実行してください。 ❯ uv sync Using CPython 3.10.6 interpreter at: /home/nanao/.local/share/mise/installs/python/3.10.6/bin/python3.10 Creating virtual environment at: .venv Resolved 1 package in 2ms Built python-playground @ file:///home/nanao/Project/study/python-playground Prepared 1 package in 597ms Installed 1 package in 1ms + python-playground==0.1.0 (from file:///home/nanao/Project/study/python-playground) これで今まで通り問題なく動くはずです。 ...
znapからantidote + starshipに乗り換える
こんにちは、ナナオです。 最近は寒いし乾燥するしで風邪が流行っていますね。気を引き締めていきましょう。 前回はznapのコミットが減ってきて大分下火になってしまった。。ということが分かりました。 ということで今回は新たにzshプラグインマネージャーのantidoteと、プロンプトのstarshipを使っていきましょう。 antidote Starship znapのアンインストールとantidoteの導入 まずはznapをアンインストールしていきます。 znapを導入した際とは逆の手順を踏めばいいです。 .zshrcに定義したznap関連のコマンドをコメントアウトします。 # znapの設定 # https://neer-engineer.com/525df03075fc272fc364d71a58b9f5a6/ # source ~/.znap/znap.zsh # リポジトリの設定 # これがないとホームディレクトリ上にプラグインなどのリポジトリフォルダが出来上がってしまう # zstyle ':znap:*' repos-dir ~/.znap/repos # プロンプトの設定 # ohmyzshのテーマを使いたい場合は以下のように実装する # znap prompt ohmyzsh/ohmyzsh random # znap prompt sindresorhus/pure # ohmyzsh関連の設定 # プラグインの設定 # znap source zsh-users/zsh-completions # znap source marlonrichert/zsh-autocomplete # znap source zsh-users/zsh-autosuggestions # znap source zsh-users/zsh-syntax-highlighting # znap source hlissner/zsh-autopair # znap source marlonrichert/zsh-edit そしたらznapを入れていたディレクトリを削除しましょう。 ...
znapでinstallが使えなくなった
こんにちは、ナナオです。 小ネタです。 最近、chezmoiを導入したことで.zshrcを普段開発に使っているデスクトップとノートで共有して使えるようになったのですが、ノートの方で以下のような問題が発生しました。 znap: unknown command: install znapのinstallコマンドが見つからない?? なんだこれ?と思ってznapコマンドを叩いてみたのですが、確かにinstallコマンドがない!! ❯ znap Usage: znap <command> [ <argument> ... ] Commands: clean remove outdated .zwc binaries clone download repos in parallel compile compile zsh scripts and functions eval cache & eval output of command fpath install command output as a function function create a set of lazy-loading functions help print help text for command ignore add local exclude patterns to repo multi run tasks in parallel prompt instant prompt from repo pull update repos in parallel restart (DEPRECATED) validate dotfiles & safely restart Zsh source load plugins status fetch updates & show git status For more info on a command, type `znap help <command>`. 調べてみると、現在のコミットからはごっそりインストールコマンドが抜けていました。 ...
streamlitのdataframeで特定の行のスタイルを変更したいとき
こんにちは、ナナオです。 今回は小ネタです。 実装 streamlitでも、pandasのDataFrameのスタイルが証できるのでこれを使って以下のように実装します。 実装では特定のカラム(target)の値が10より大きい場合に赤い太字で表示するようにしています。 import pandas as pd import streamlit as st def highlight_overdue(row): # int64をpythonのint型に変換 target = row["target"].item() # targetが10より大きい場合に赤の太字で表示する if isinstance(target, int) and target > 10: return ["color: red; font-weight: bold"] * len(row) else: return [""] * len(row) df = pd.DataFrame([ {"target": 1}, {"target": 2}, {"target": 4}, {"target": 8}, {"target": 16}, {"target": 32}, ]) df = df.style.apply(highlight_overdue, axis=1) st.dataframe(df, width="stretch") 実行すると以下のようになります。 感想 streamlitでスタイルも楽々変更できました。
chezmoiでdotfileの管理を楽にする
こんにちは、ナナオです。 今回はchezmoiというツールでdotfileを管理する基盤を作っていこうと思います。 chezmoiとは WSLとかlinuxとかMacとか触ってると、.sshとか.zshrcとかいろいろ出来上がると思います。 chezmoiはそんなdotfileたちを管理するためのツールです。 chezmoi - chezmoi インストール&ファイルを管理対象に含める miseを使ってインストールします。 mise use -g chezmoi brewでもインストールできます。 brew install chezmoi インストールはこれで完了です。 コマンドを確認してみましょう。 ❯ chezmoi Manage your dotfiles across multiple diverse machines, securely Usage: chezmoi [command] Documentation commands: doctor Check your system for potential problems help Print help about a command license Print license Daily commands: add Add an existing file, directory, or symlink to the source state apply Update the destination directory to match the target state chattr Change the attributes of a target in the source state diff Print the diff between the target state and the destination state edit Edit the source state of a target forget Remove a target from the source state init Setup the source directory and update the destination directory to match the target state merge Perform a three-way merge between the destination state, the source state, and the target state merge-all Perform a three-way merge for each modified file re-add Re-add modified files status Show the status of targets update Pull and apply any changes Template commands: cat Print the target contents of a file, script, or symlink data Print the template data execute-template Execute the given template(s) Advanced commands: cd Launch a shell in the source directory edit-config Edit the configuration file edit-config-template Edit the configuration file template generate Generate a file for use with chezmoi git Run git in the source directory ignored Print ignored targets managed List the managed entries in the destination directory unmanaged List the unmanaged files in the destination directory verify Exit with success if the destination state matches the target state, fail otherwise Encryption commands: age Interact with age age-keygen Generate an age identity or convert an age identity to an age recipient decrypt Decrypt file or standard input edit-encrypted Edit an encrypted file encrypt Encrypt file or standard input Remote commands: docker Use your dotfiles in a Docker container ssh SSH to a host and initialize dotfiles Migration commands: archive Generate a tar archive of the target state destroy Permanently delete an entry from the source state, the destination directory, and the state import Import an archive into the source state purge Purge chezmoi's configuration and data upgrade Upgrade chezmoi to the latest released version Internal commands: cat-config Print the configuration file completion Generate shell completion code dump Generate a dump of the target state dump-config Dump the configuration values secret Interact with a secret manager source-path Print the source path of a target state Manipulate the persistent state target-path Print the target path of a source path Flags: --age-recipient string Override age recipient --age-recipient-file string Override age recipient --cache path Set cache directory (default /home/banan/.cache/chezmoi) --color bool|auto Colorize output (default auto) -c, --config path Set config file --config-format <none>|json|toml|yaml Set config file format --debug Include debug information in output -D, --destination path Set destination directory (default /home/banan) -n, --dry-run Do not make any modifications to the destination directory --force Make all changes without prompting -h, --help help for chezmoi --interactive Prompt for all changes -k, --keep-going Keep going as far as possible after an error --less-interactive Prompt for changed or pre-existing targets --mode file|symlink Mode (default file) --no-pager Do not use the pager --no-tty Do not attempt to get a TTY for prompts -o, --output path Write output to path instead of stdout --override-data string Override data --override-data-file path Override data with file --persistent-state path Set persistent state file --progress bool|auto Display progress bars (default auto) -R, --refresh-externals always|auto|never[=always] Refresh external cache (default auto) -S, --source path Set source directory (default /home/banan/.local/share/chezmoi) --source-path Specify targets by source path --use-builtin-age bool|auto Use builtin age (default auto) --use-builtin-diff Use builtin diff --use-builtin-git bool|auto Use builtin git (default auto) -v, --verbose Make output more verbose --version version for chezmoi -W, --working-tree path Set working tree directory Use "chezmoi [command] --help" for more information about a command. なにやらいろいろ出力されました。 ...
busyboxベースのNAS(N-RAID 5800M)にtailscale入れてみた
こんにちは、ナナオです。 前回tailscaleを入れてみてかなり良かったので、今回は自宅のNASにも入れていこうと思います。 自宅のNASはbusyboxがベースとなっており、aptなどのパッケージマネージャーがいないので、バイナリインストールをしていこうと思います。 使用しているNASはN-RAID 5800Mになります。 ���m�̔��������� �|NAS RAID�^RAID 6�Ή��^N-RAID 5800M�V���[�Y�s�G�k�E���C�h�t���i�T�v�E���ȓ����| インストール まずはNASのアーキテクチャを確認します。 NASにはSSHでログインしておいてください。 > uname -m x86_64 ということでamd64のバイナリを以下からダウンロードします。 https://pkgs.tailscale.com/stable/#static 以下のコマンドを実行します。 wget --no-check-certificate https://pkgs.tailscale.com/stable/tailscale_1.92.5_amd64.tgz ダウンロードしたアーカイブを解凍します。 > tar xvf tailscale_1.92.5_amd64.tgz tailscale_1.92.5_amd64/ tailscale_1.92.5_amd64/tailscaled tar: tailscale_1.92.5_amd64/tailscaled: Wrote only 3072 of 10240 bytes tailscale_1.92.5_amd64/tailscale tar: tailscale_1.92.5_amd64/tailscale: Cannot write: No space left on device tailscale_1.92.5_amd64/systemd/ tailscale_1.92.5_amd64/systemd/tailscaled.service tailscale_1.92.5_amd64/systemd/tailscaled.defaults tar: tailscale_1.92.5_amd64/systemd/tailscaled.defaults: Cannot write: No space left on device tar: Exiting with failure status due to previous errors ん?なんかエラーが出てますね。。 ...
Neonで無料のPostgresを使う
こんにちは、ナナオです。 前回、KoyebでDiscord botを構築してみました。 今回はこれに無料で使えると話題のNeonを組み合わせてみようと思います。 Neonとは Neonはサーバーレスで動くPostgresのサービスです。 Neon Serverless Postgres — Ship faster DBのブランチ戦略やオートスケーリングに長けており、なにより無料で使えるプランがあるのが個人開発者には魅力的な点です。 アカウント登録 ~ プロジェクト作成 まずはNeonにサインアップします。 サインアップしたらプロジェクトの作成画面に遷移します。 プロジェクト名を入力し、リージョンは日本がないので、とりあえずデフォルトのN. Virginiaにしておきます。 プロジェクトが作成されました。 NeonのDBに接続してみます。 Webコンソール上からアクセスしてみましょう。 左側のタブからTablesを選択します。 neondbというDBがあるのと、publicスキーマがあるだけで、テーブルは何もありません。 マイグレーション管理(alembic)の導入 discord botの実装にはpythonを使用しているので、マイグレーションにもpythonを使用します。 まずはプロジェクトにSQLAlchemyとalembicを導入します。 uv add SQLAlchemy alembic psycopg2 alembicでマイグレーション用のディレクトリを作成します。 uv run alembic init migrations 作成されたalembic.iniのデータベースURLの設定を、環境変数を参照するように書き換えます。 # database URL. This is consumed by the user-maintained env.py script only. # other means of configuring database URLs may be customized within the env.py # file. sqlalchemy.url = %(DATABASE_URL)s .envにはDATABASE_URL環境変数を設定します。 ...
Zedで最速で最高の開発環境を手に入れる
こんにちは、ナナオです。 今回はRust製のめちゃ早エディター「Zed」を触っていきたいと思います。 初期設定 インストールはwingetから行えます。 winget install -e --id ZedIndustries.Zed インストール後、zedコマンドで起動できます。 起動直後のzedはこんな感じです。 VSCodeとの比較ですが、私個人的にはまぁ早いかなくらいでした。 普段WSLを使うのですが、設定とかは特に必要なくwsl上からzedコマンドが使用できました。 感想 拍子抜けするくらい簡単でした。 今後使っていく中でまた何かあったら追記していこうと思います。 参考 VSCodeをやめてZedにするぞ! - Chienomi ZedのWindows Beta版、WSLでうごくっぽいぞ! #VSCode - Qiita RUST製エディター「Zed」とは #Rust - Qiita
OpenCode + Ollamaで、Tool callがうまくいくモデルを模索している
こんにちは、ナナオです。 突然ですが、ローカルLLM使っていますか? 私は使いたいのですが、デスクトップもメモリもよわよわすぎて、なかなか使うのに奮闘しています。 今回は私が使ってきたモデルの一覧を紹介しようと思います。 使っているPCのスペックは以下の通り。 CPU: AMD Ryzen 9 3900 メモリ: 24GB GPU: GeForce GTX 1660 SUPER 使ったプロンプトは、opencodeの/initコマンドを実行した際の以下の一文(一部改変しています) Please analyze this codebase and create an AGENTS.md file containing: 1. Build/lint/test commands - especially for running a single test 2. Code style guidelines including imports, formatting, types, naming conventions, error handling, etc. The file you create will be given to agentic coding agents (such as yourself) that operate in this repository. Make it about 150 lines long. If there are Cursor rules (in .cursor/rules/ or .cursorrules) or Copilot rules (in .github/copilot-instructions.md), make sure to include them. If there's already an AGENTS.md, improve it if it's located in <プロジェクトディレクトリ> Pythonプロジェクト上で/initコマンドを実行し、プロジェクトディレクトリを読んでそれに合ったAGENTS.mdを出力するか検証しています。 ...