雑多な内容のメモ
コマンドなど個別にページを作るまでもない分量の雑多な備忘録。
同じ内容で3回ググったら記録するくらいが目安にとりあえず記録していく。
それぞれの内容が増えたらページを独立させる。
ffmpeg
Section titled “ffmpeg”m2ts→mp4
Section titled “m2ts→mp4”- x256で10ビットエンコード
- 音声はそのままコピー
- インターレース解除して960pにリサイズ
- 音ズレをなるべく防止
ffmpeg -i "%%f" -pix_fmt yuv420p10le -vf "bwdif,scale=-2:960:flags=lanczos+accurate_rnd" -c:a copy -c:v libx265 -crf 28 -x265-params profile=main10 -async 1 -sn -bsf:a aac_adtstoasc "%~dp0out\%%~nf.mp4"tarコマンドメモ
Section titled “tarコマンドメモ”形式は自動判別。vを入れると処理したファイル名が表示されるてマトリックスみたいになる。
tar -xf ファイル.tar.gzGmailの検索クエリ
Section titled “Gmailの検索クエリ”スマホのアプリでも効くが250件前後までしか処理できない。PC版ブラウザは1万件前後まで処理できるので何度か根気よくやる必要がある。
- is:unread category:promotions older_than:1y
未読で広告扱いで1年以上前のメールを探す。 - is:unread category:social older_than:6m
未読でソーシャルメディアからの通知扱いで6か月以上前のメールを探す。 - -is:important has:nouserlabels
重要なメールを除外しラベルがついていないメールのみマッチ - before:yyyy/mm/dd
重要なメールを除外しラベルがついていないメールのみマッチ
個人的リンク集
Section titled “個人的リンク集”- BIOSイメージ抽出ツール等
SUPERMICR🔴のIPMI関連ソフトウエア SUPERMICROのTOPから行くとフリーではないメールアドレスを求められるので直リンふさがれたので除去- Panasonic Source Code Distribution Service Android搭載 TOUGHPAD FZ-B2やFZ-X1のGPLソースコードの配布サイト。FZ-N1やFZ-L1のソースコードは載ってないが何処だろう?
VMWare ESXi
Section titled “VMWare ESXi”公式のオンラインリポジトリから更新する
Section titled “公式のオンラインリポジトリから更新する”コマンドラインを使ったVMware ESXiの更新方法。
たまにしかやらないからやり方忘れる。。。
再起動すればアップデートが適用される
esxcli network firewall ruleset set -e true -r httpClientesxcli software profile update -p "ESXi-6.5.0-20180304001-standard" -d "https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml" --no-hardware-warningesxcli network firewall ruleset set -e false -r httpClientESXi-6.5.0-20180304001-standardの部分は VMware ESXi 6.5.0 Patch History で調べることが出来る。
エラーが出る場合の対処法
Section titled “エラーが出る場合の対処法”Got no data from process: LANG=en_US.UTF-8 /usr/lib/vmware/esxcli-software profile.update -d "https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml" -p "ESXi-7.0U3g-20328353-standard"上記のようなエラーが出る場合は、/usr/lib/vmware/esxcli-software を直接実行すればエラーの内容がわかる。
# /usr/lib/vmware/esxcli-software profile.update -d "https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml" -p "ESXi-7.0U3g-20328353-standard"ERROR: [HardwareError]ERROR: Hardware precheck of profile ESXi-7.0U3g-20328353-standard failed with warnings: <CPU_SUPPORT WARNING: The CPU in this host may not be supported in future ESXi releases. Please plan accordingly.>ERROR:ERROR: Apply --no-hardware-warning option to ignore the warnings and proceed with the transaction.ERROR: Please refer to the log file for more details.CPUが古いせいなのでesxcli に–no-hardware-warningをつけてあげるとよし
うちはそれでも通らなかったので
/usr/lib/vmware/esxcli-software profile.update -d "https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml" -p "ESXi-7.0U3g-20328353-standard" --nohwwarningを使用した。
[Errno 28] No space left on device がでて失敗するとき
Section titled “[Errno 28] No space left on device がでて失敗するとき”サイズが大きいVMware_locker_toolsの更新がが原因で失敗するので、/tmpに落としてから手動でインストールする。
cd /tmpwget http://hostupdate.vmware.com/software/VUM/PRODUCTION/main/esx/vmw/vib20/tools-light/VMware_locker_tools-light_6.5.0-1.47.8285314.vibesxcli software vib install -f -v file:/tmp/VMware_locker_tools-light_6.5.0-1.47.8285314.vibvibのURLは上記サイトで調べることが出来る。 ESXiのwgetはBusyBoxなのでSSLを使えないようです。
cronにで定期的にコマンドを実行する
Section titled “cronにで定期的にコマンドを実行する”/etc/rc.local.d/local.shのexit 0の前に書く。古いバージョンにあったbusyboxコマンドは無いので要注意
/bin/echo "* * * * * 実行したいコマンド" >> /var/spool/cron/crontabs/root/bin/kill $(cat /var/run/crond.pid)/bin/crondipmiのwatchdogを使用する
Section titled “ipmiのwatchdogを使用する”http://mmurayama.blogspot.jp/2016/01/ipmitool-on-vmware-esxi.html のパッケージがESXi6.5でそのまま使える。
インストールされるバイナリは/opt/ipmitool/bin/ipmitool
下記を/etc/rc.local.d/local.shに仕込むと良い。
watchdogの初期設定と初期化(600秒で電源OFF→電源ONする)
Section titled “watchdogの初期設定と初期化(600秒で電源OFF→電源ONする)”/opt/ipmitool/bin/ipmitool raw 0x6 0x24 0x4 0x23 0xa 0x3e 0x70 0x17再起動するかipmitool mc watcdog offを行うと設定は初期化されるっぽい。
コマンドの意味は
NECのマニュアルですがipmitoolを使ったwatchdogの初期設定のやり方は他のメーカーのサーバーでも共通して使えます。
(うちの鯖はsupermicr● X9SCL-Fです)
cronで5分(300秒)おきにタイマーをリセット
Section titled “cronで5分(300秒)おきにタイマーをリセット”/bin/echo "*/5 * * * * /opt/ipmitool/bin/ipmitool mc watchdog reset" >> /var/spool/cron/crontabs/root- ESXi 6.5には python3.5が入っている。何かに使えるかもしれない
OpenSSL コマンドメモ
Section titled “OpenSSL コマンドメモ”いろんな場面でよく使うコマンド集
Chromeに対応した証明書をリクエストする
Section titled “Chromeに対応した証明書をリクエストする”openssl 1.1.1以降はワンライナーで可能
バッチファイルに書いているので%1にはホストのFQDNが入る。
openssl req -new -newkey rsa:2048 -keyout %1.key -sha256 -nodes -extensions v3_req -subj "/C=JP/ST=Tokyo/L=Takagaya-shi/O=Hoge Corp./OU=Hoge/CN=%1" -out %1.csr -addext "subjectAltName = DNS:%1"-x509 -days 365を追加すると直ちにオレオレ証明書が出来る
Shim.efiで使用するオレオレ証明書を作成
Section titled “Shim.efiで使用するオレオレ証明書を作成”PFXへの変換コマンドがDER形式だと通らないのでいったんPEM形式で作成する。
openssl req -newkey rsa:2048 -nodes -keyout MOK.key -new -x509 -sha256 -days 3650 -subj "/CN=Peace Electric Machine Owner Key/" -out MOK_PEM.crt証明書をPEM形式からDER形式に変更
Section titled “証明書をPEM形式からDER形式に変更”MokManagerがDER形式のみ認識するのでDERに変換する。
openssl x509 -in MOK_PEM.crt -inform PEM -out Mok_DER.cer -outform DER証明書をPEM形式からPFX形式に変更
Section titled “証明書をPEM形式からPFX形式に変更”signtool.exeがPFXのみ認識するのでPFXに変換する。
openssl pkcs12 -export -inkey Mok.key -in Mok.crt -out Mok.pfxシステム更新コマンド
Section titled “システム更新コマンド”いろいろ動いてるからド忘れするんだわ
OpenIndiana
Section titled “OpenIndiana”pfexec pkg image-updateMincraftメモ
Section titled “Mincraftメモ”DankStorageでinventorysorterが効かないようにする
Section titled “DankStorageでinventorysorterが効かないようにする”1.18用。アイテムがロストする原因になり得るのでALL Off Fabricなどで設定必須
{ // Inventories that should not be sorted "doNotSortList": [ "dankstorage:portable_dank_5", "dankstorage:dank_2", "dankstorage:portable_dank_4", "dankstorage:dank_3", "dankstorage:portable_dank_3", "dankstorage:dank_1", "dankstorage:portable_dank_2", "dankstorage:portable_dank_7", "dankstorage:portable_dank_6", "dankstorage:portable_dank_1", "dankstorage:dank_6", "dankstorage:dank_7", "dankstorage:dank_4", "dankstorage:dank_5" ], // Inventories that should not display any sort buttons "hideSortBtnsList": []}UEFIでBIOSとかMEとかを更新する
Section titled “UEFIでBIOSとかMEとかを更新する”LinuxやESXiをインストールしたシステムのBIOSを更新する手順。
メーカー系マザーボードだとWindows用しか用意されていないのでメモ。
UEFIに更新機能があるならそっちを使ったほうがいい。
AMI Aptio UEFI 向け。
BIOS抽出
Section titled “BIOS抽出”書き換えツールとBIOSが自己解凍形式になっていて普通に解答できない場合。
ただし取り出したROMファイルが使い物になるかどうかは別の話
https://github.com/platomav/BIOSUtilities
BIOS更新
Section titled “BIOS更新”普通にやる場合AfuEfix64.efi ファイル名 /p /b /nSupermicro系(ほぼ全部書き換え)AfuEfix64.efi ファイル名 /P /B /N /K /R書き換えようとしているMEのバージョンとツールのバージョンをそろえないと通らないので適切なものを選ぶ
- MEInfo, Firmware Update Utility
- Intel (Converged Security) Management Engine: Drivers, Firmware and Tools (2-15) 詳しい説明がや汎用のME更新ファイルが掲載されているが、頭痛がするほど長い。
FWUpdLcl.efi -f ファイル名エラーが出る場合は電源切ってから電源入れなおすか、書き換えを許可するためのジャンパーがどっかにないか探す。
個人的な waifu2x-converter-cpp 用スクリプト
Section titled “個人的な waifu2x-converter-cpp 用スクリプト”- 電子書籍のデータをターゲットにし、画像の高さを統一する
- Python 3.9向け
- あくまで個人用
from PIL import Imageimport osimport globimport shutilimport subprocess
maxheight = 2000w2xcpp = './waifu2x-converter/waifu2x-converter-cpp.exe'outformat = 'jpg'outquality = 80
for infile in glob.glob('./in/**', recursive=True): if os.path.isdir(infile): continue try: outdir = os.path.join("./out/", os.path.basename(os.path.dirname(infile))) os.makedirs(outdir, exist_ok=True)
# 外部に渡すため絶対パスに変換 infile = os.path.abspath(infile) outfile = os.path.abspath(os.path.join(outdir, os.path.splitext(os.path.basename(infile))[0]+'.'+outformat))
# 出力先が存在する場合は処理しない if os.path.exists(outfile): print("FILE EXISTS!", outfile) continue
img = Image.open(infile)
# double型のまま処理できるので丸めるのやめた scale = maxheight / img.height
# 丸めたスケールが1倍以下の時とサイズが最大以上の時は処理せずコピーする if scale <= 1.0 or img.height >= maxheight: print("SIZE OVER!", outfile) print("height:", img.height) print("scale:", scale)
if os.path.splitext(os.path.basename(infile))[1] == os.path.splitext(os.path.basename(outfile))[1] : shutil.copy2(infile, outfile) else : # 画像形式を統一する print("Convert to:", outformat) img = img.convert('RGB') img.save(outfile, quality=outquality) continue
# スケールが2以上の場合は2とし、3倍以上の拡大を行わない if scale >= 2.0: scale = 2.0
w2xcpp = os.path.abspath(w2xcpp)
subprocess.run(f'{w2xcpp} --scale-ratio {scale} -f {outformat} -q {outquality} -j 4 -p 0 -i "{infile}" -o "{outfile}"', shell = True) except OSError as e: pass