command snippet

Windows

Windows/command snippet

disk free

df -h

'-h' は 61917736 を 60G とかになおしてくれる。

parted

パーティションの一覧表示

parted -l

未使用スペースを含めて表示

parted
(parted) print free

tar+gzip

ディレクトリの圧縮

tar -cvzf tgzFILE DIRCompressTo

ディレクトリの展開

tar -xvzf tgzFILE

git

force pushed branch の pull

git pull --rebase

直前の commit の author の修正

git commit --amend --author="mgmn <mgmnjp@example.com>" --no-edit

直前の amend commit を取り消す (変更を維持)

git reset --soft HEAD@{1}

`git reflog` した結果の `{n}` こ前に HEAD を移動している。

https://stackoverflow.com/questions/1459150/how-to-undo-git-commit-amend-done-instead-of-git-commit

ssh

固まったセッションの強制終了

(Enter)
~.

certbot

証明書の取得

certbot --non-interactive certonly --webroot -w /var/www/html -m "mgmnjp@example.com" --agree-tos -d "example.com" 

証明書の取得 (staging server)

certbot --non-interactive certonly --webroot -w /var/www/html -m "mgmnjp@example.com" --agree-tos -d "example.com" --test-cert

staging server は production server よりも証明書の重複取得の回数制限がかなり緩和されている。

ストアしている証明書の一覧

certbot certificates

ストアしている証明書を削除する

sudo certbot delete --cert-name example.com

取得済みの証明書が「Certificate not yet due for renewal」で再取得できない場合はこれで設定を消すと通るようになる。

openssl

自己証明書の作成

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3650

RSA 鍵からパスワードを削除する

openssl rsa -in key.pem -out key.pem

openssl rsa - Mister PKI
https://www.misterpki.com/openssl-rsa/

curl

NTLM 認証をする

curl --ntlm -u user:password https://...

dig

ルートサーバからの反復問い合わせとその応答をすべて表示する

dig @1.1.1.1 mgmn.jp +trace

Mastodon

依存関係の更新

bundle && yarn --frozen-lockfile

DB のバックアップ

pg_dump -Fc mastodon_development -f ~/donbak/pg_backup.dump

DB のマイグレーション

RAILS_ENV=development bundle exec rails db:migrate

アセットのリビルド

rm -rf public/packs && RAILS_ENV=development bundle exec rails assets:precompile

web と sidekiq の再起動

sudo systemctl daemon-reload && sudo systemctl reload mastodon-web && sudo systemctl restart mastodon-sidekiq
# サービス稼働状態の確認
sudo systemctl | grep mastodon

ユーザの追加

RAILS_ENV=development bin/tootctl accounts create --email EMAIL --confirmed USERNAME

オーナユーザの追加

RAILS_ENV=development bin/tootctl accounts create --role Owner --email EMAIL --confirmed USERNAME

既存ユーザをオーナにする

RAILS_ENV=development bin/tootctl accounts modify --role Owner USERNAME

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS