98 lines
2.2 KiB
Markdown
98 lines
2.2 KiB
Markdown
# cheatsheet
|
||
|
||
quick commands for daily use.
|
||
|
||
## rebuild
|
||
|
||
```bash
|
||
# poppy (macbook)
|
||
darwin-rebuild switch --flake .#poppy
|
||
|
||
# muscari (server)
|
||
sudo nixos-rebuild switch --flake .#muscari
|
||
```
|
||
|
||
## update
|
||
|
||
```bash
|
||
# update flakes then rebuild
|
||
nix flake update && darwin-rebuild switch --flake .#poppy
|
||
```
|
||
|
||
## check
|
||
|
||
```bash
|
||
# validate before applying
|
||
nix flake check
|
||
|
||
# dry run (see what would change)
|
||
darwin-rebuild switch --flake .#poppy --dry-run
|
||
```
|
||
|
||
## cleanup
|
||
|
||
```bash
|
||
# remove old generations
|
||
nix-collect-garbage -d
|
||
|
||
# or with sudo on nixos
|
||
sudo nix-collect-garbage -d
|
||
```
|
||
|
||
## shell
|
||
|
||
```bash
|
||
ll # detailed list with icons
|
||
cd <dir> # actually zoxide - remembers frequent paths
|
||
ff # fastfetch system info
|
||
```
|
||
|
||
## navigation
|
||
|
||
```bash
|
||
cd <partial> # zoxide - jump to frequent dir
|
||
cd .. # parent directory
|
||
ctrl+r # fzf history search
|
||
ctrl+t # fzf file finder
|
||
```
|
||
|
||
## save websites
|
||
|
||
```bash
|
||
# одна страница в single html (с CSS+JS)
|
||
monolith https://example.com -o page.html
|
||
|
||
# рекурсивно целый сайт
|
||
wget -r -p -k --no-clobber example.com
|
||
|
||
# GUI для рекурсивного скачивания
|
||
httrack "https://example.com" -O ./out "+*.example.com/*"
|
||
```
|
||
|
||
примеры:
|
||
- nixos options: `monolith https://search.nixos.org/options -o options.html`
|
||
- сохранить доки: `wget -r -p -k nix-darwin.github.io/nix-darwin/manual/`
|
||
- monolith и httrack ставятся через `brew install monolith httrack`
|
||
|
||
## default apps (duti)
|
||
|
||
настраиваются через `~/.config/duti/config` (управляется в `home/duti.nix`):
|
||
- `com.google.Chrome` — html, url
|
||
- `VSCodium` — txt (см. ⚠️ ниже)
|
||
- `MarkEdit` — markdown
|
||
- `kitty` — shell scripts
|
||
- `com.apple.Preview` — pdf
|
||
- `com.apple.Mail` — mail
|
||
|
||
проверить текущие defaults:
|
||
```bash
|
||
duti -x html
|
||
duti -x md
|
||
duti -x txt
|
||
```
|
||
|
||
⚠️ **для `.txt` файлов** на macOS Sonoma+ Apple блокирует настройку через CLI.
|
||
настроить вручную:
|
||
1. правый клик на .txt файл → **Get Info**
|
||
2. раздел **"Open with:"** → выбрать **VSCodium**
|
||
3. нажать **"Change All..."** → подтвердить
|