43 ポイント 投稿者 xguru 2022-08-30 | 6件のコメント | WhatsAppで共有

自分だけが使っているスクリプトを教えてほしいという HN の質問への回答いろいろ

  • 接続するすべてのサーバーで同じ環境を構成する .ssh/config
    → サーバーに初めて接続する際に必要な dotfile を自動で rsync し、その後の接続では自動更新
  • command help (ch) スクリプト
    → ヘルプと man ページからコマンドライン部分だけを抽出して表示
  • MISC (Manually Installed or Source Compiled)
    → 手動インストールまたはソースからコンパイルしたパッケージだけを管理するスクリプト
  • git-co-commit
    → ペアプログラミング時にコミットメッセージの末尾へ Co-authored-by: ... を追加
    git-co-commit として path に追加すると、git は自動的に git co-commit サブコマンドとして認識
  • Caps Lock+マウスクリックで毎秒 50 回クリックしてくれる AutoHotkey スクリプト
  • rerun
    → ディレクトリ内のファイルが変更されるとコマンドを自動で再実行するスクリプト
  • git recent
    → 最近作業したブランチを表示
  • ccd
    → ディレクトリを作成してそのディレクトリへ移動
  • git-move
    → リポジトリ間でファイルを移動し、履歴を保持

6件のコメント

 
tribela 2022-08-30

alias df='df -h -x tmpfs -x devtmpfs -x squashfs'
alias xc='xclip -sel clipboard'
alias ttfb='curl -so /dev/null -w "HTTP %{http_version} %{http_code} Remote IP: %{remote_ip}\nConnect: %{time_connect}\nTTFB: %{time_starttransfer}\nTotal time: %{time_total}\nDownload speed: %{speed_download}bps\nBytes: %{size_download}\n"'

ap() {
https $@ Accept:application/activity+json
}

shodan() {
xdg-open https://shodan.io/domain/$1
dig +short $1 | xargs -i xdg-open https://shodan.io/host/{}
}

check_mtu() {
local target=$1
shift
local lower=0
local upper=1500
until [[ $((lower + 1)) -eq $upper ]]; do
current=$(((lower + upper) / 2))
echo -n "lower: $lower, upper: $upper, testing: $current -- "
if ping -M do -s $current -c 2 -i 0.2 $target $@ &> /dev/null; then
echo "ok"
lower=$current
else
echo "fail"
upper=$current
fi
done

echo "max packet size: $lower, mtu: $((lower + 28))"  

}
私が使っているのはこの程度ですね

 
alstjr7375 2022-08-30
  • GIF -> Video
    → ffmpeg -v warning -i "入力.gif" -y "出力.mp4" -pix_fmt yuv420p -c:v libx264 -movflags +faststart -filter:v "crop=floor(iw/2)*2:floor(ih/2)*2"
  • Video -> GIF
    → ffmpeg -v warning -i "入力.mp4" -y "出力.gif" -filter_complex "[0:v] fps=15, split [1:v] [2:v]; [1:v] palettegen [p]; [2:v] fifo [3:v]; [3:v] [p] paletteuse" -loop 0
 
alstjr7375 2022-08-30

参考までに、gifの一般的な最大FPSは50程度と考えてください。
https://wunkolo.github.io/post/2020/02/buttery-smooth-10fps/

エミュレート可能だという話はありましたが、試していないのでよく分かりません。
https://superuser.com/questions/1449366/…

 
bbulbum 2022-08-30

tmux セッションを開いて、3つのプロジェクトコード(api、front、admin)を3つのウィンドウで立ち上げるスクリプトを書いています。
tmux new-session -d ; new-window ; send-key "nvim ~" C-m ; attach;
前の会社では出退勤を会社サイトに直接ログインして打刻する方式だったので、puppeteer で自動化して使ったりも...

 
cr543l 2022-08-30

git log --pretty="%ad [%ae] %s" --author E_MAIL_ADDRESS
→ git リビジョンで指定したコミッターだけをフィルタして表示