From 3cccc3eb5be2e457f42ea556084b84ea951ce2fc Mon Sep 17 00:00:00 2001 From: Hau Nguyen <hauvipapro@gmail.com> Date: Sun, 5 Jan 2025 09:56:33 +0700 Subject: [PATCH] more pastebin --- docs/2023-07-01-pastebin.html | 116 +++++++++++++++++++--------------- posts/2023-07-01-pastebin.md | 68 ++++++++++---------- 2 files changed, 97 insertions(+), 87 deletions(-) diff --git a/docs/2023-07-01-pastebin.html b/docs/2023-07-01-pastebin.html index 7c53a04..e6b2dd8 100644 --- a/docs/2023-07-01-pastebin.html +++ b/docs/2023-07-01-pastebin.html @@ -487,27 +487,11 @@ <h2 class="heading-element"> ><span aria-hidden="true" class="octicon octicon-link"></span ></a> </div> - <p>Remove proto options:</p> <div class="highlight highlight-source-shell"> - <pre>sd -F <span class="pl-s"><span class="pl-pds">'</span>import "validate/validate.proto";<span class="pl-pds">'</span></span> <span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span> api/raw/<span class="pl-k">*</span>.proto + <pre><span class="pl-c"><span class="pl-c">#</span> Remove proto option</span> +sd -F <span class="pl-s"><span class="pl-pds">'</span>import "validate/validate.proto";<span class="pl-pds">'</span></span> <span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span> api/raw/<span class="pl-k">*</span>.proto sd -F <span class="pl-s"><span class="pl-pds">'</span>import "marshal-zap.proto";<span class="pl-pds">'</span></span> <span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span> api/raw/<span class="pl-k">*</span>.proto -sd -f s <span class="pl-s"><span class="pl-pds">'</span>\s\[.*?];<span class="pl-pds">'</span></span> <span class="pl-s"><span class="pl-pds">'</span>;<span class="pl-pds">'</span></span> api/raw/<span class="pl-k">*</span>.proto</pre> - </div> - <div class="markdown-heading"> - <h2 class="heading-element"> - <a href="https://github.com/adrianlopezroche/fdupes">fdupes</a> - </h2> - <a - id="user-content-fdupes" - class="anchor" - aria-label="Permalink: fdupes" - href="#fdupes" - ><span aria-hidden="true" class="octicon octicon-link"></span - ></a> - </div> - <p>Remove duplicated files:</p> - <div class="highlight highlight-source-shell"> - <pre>fdupes -rdN <span class="pl-c1">.</span></pre> +sd -f s <span class="pl-s"><span class="pl-pds">'</span>\s\[\s*\(.*?];<span class="pl-pds">'</span></span> <span class="pl-s"><span class="pl-pds">'</span>;<span class="pl-pds">'</span></span> api/raw/<span class="pl-k">*</span>.proto</pre> </div> <div class="markdown-heading"> <h2 class="heading-element"> @@ -549,6 +533,46 @@ <h2 class="heading-element"> in <strong>src</strong>, useful to sync dst with src </li> </ul> + <div class="markdown-heading"> + <h2 class="heading-element"> + <a href="https://github.com/pkolaczk/fclones">fclones</a> + </h2> + <a + id="user-content-fclones" + class="anchor" + aria-label="Permalink: fclones" + href="#fclones" + ><span aria-hidden="true" class="octicon octicon-link"></span + ></a> + </div> + <div class="highlight highlight-source-shell"> + <pre>fclones group <span class="pl-c1">.</span> <span class="pl-k">|</span> fclones remove</pre> + </div> + <div class="markdown-heading"> + <h2 class="heading-element"> + <a href="https://github.com/ayoisaiah/f2">F2</a> + </h2> + <a + id="user-content-f2" + class="anchor" + aria-label="Permalink: F2" + href="#f2" + ><span aria-hidden="true" class="octicon octicon-link"></span + ></a> + </div> + <div class="highlight highlight-source-shell"> + <pre><span class="pl-c"><span class="pl-c">#</span> If dry run, remove --exec</span> +f2 --replace <span class="pl-s"><span class="pl-pds">"</span>{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{hash.md5}{ext}<span class="pl-pds">"</span></span> --exec + +<span class="pl-c"><span class="pl-c">#</span> Include ImageSize (require exiftool)</span> +f2 --replace <span class="pl-s"><span class="pl-pds">"</span>{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{xt.ImageSize}_{hash.md5}{ext}<span class="pl-pds">"</span></span> --exec + +<span class="pl-c"><span class="pl-c">#</span> Not include time</span> +f2 --exclude=<span class="pl-s"><span class="pl-pds">"</span>\d+x\d+_[a-z\d]{32}<span class="pl-pds">"</span></span> --sort=mtime --replace <span class="pl-s"><span class="pl-pds">"</span>{xt.ImageSize}_{hash.md5}{ext}<span class="pl-pds">"</span></span> --exec + +<span class="pl-c"><span class="pl-c">#</span> Remove space in directory</span> +f2 --find <span class="pl-s"><span class="pl-pds">"</span> <span class="pl-pds">"</span></span> --replace <span class="pl-s"><span class="pl-pds">"</span>_<span class="pl-pds">"</span></span> --string-mode --only-dir --exec</pre> + </div> <div class="markdown-heading"> <h2 class="heading-element"> <a href="https://github.com/FFmpeg/FFmpeg">ffmpeg</a> @@ -575,6 +599,21 @@ <h2 class="heading-element"> > </li> </ul> + <div class="markdown-heading"> + <h2 class="heading-element"> + <a href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a> + </h2> + <a + id="user-content-yt-dlp" + class="anchor" + aria-label="Permalink: yt-dlp" + href="#yt-dlp" + ><span aria-hidden="true" class="octicon octicon-link"></span + ></a> + </div> + <div class="highlight highlight-source-shell"> + <pre>yt-dlp -f - <span class="pl-s"><span class="pl-pds">"</span>https://www.youtube.com/watch?v=video_id<span class="pl-pds">"</span></span></pre> + </div> <div class="markdown-heading"> <h2 class="heading-element"> <a href="https://github.com/libvips/libvips">libvips</a> @@ -587,7 +626,6 @@ <h2 class="heading-element"> ><span aria-hidden="true" class="octicon octicon-link"></span ></a> </div> - <p>Convert:</p> <div class="highlight highlight-source-shell"> <pre><span class="pl-c"><span class="pl-c">#</span> Add --vips-progress to show progress</span> vips jxlsave filename.jpg filename.jxl --keep=none @@ -605,45 +643,19 @@ <h2 class="heading-element"> </div> <div class="markdown-heading"> <h2 class="heading-element"> - <a href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a> + <a href="https://github.com/qpdf/qpdf">qpdf</a> </h2> <a - id="user-content-yt-dlp" + id="user-content-qpdf" class="anchor" - aria-label="Permalink: yt-dlp" - href="#yt-dlp" + aria-label="Permalink: qpdf" + href="#qpdf" ><span aria-hidden="true" class="octicon octicon-link"></span ></a> </div> - <p>Download:</p> <div class="highlight highlight-source-shell"> - <pre>yt-dlp -f - <span class="pl-s"><span class="pl-pds">"</span>https://www.youtube.com/watch?v=video_id<span class="pl-pds">"</span></span></pre> - </div> - <div class="markdown-heading"> - <h2 class="heading-element"> - <a href="https://github.com/ayoisaiah/f2">F2</a> - </h2> - <a - id="user-content-f2" - class="anchor" - aria-label="Permalink: F2" - href="#f2" - ><span aria-hidden="true" class="octicon octicon-link"></span - ></a> - </div> - <p>Rename:</p> - <div class="highlight highlight-source-shell"> - <pre><span class="pl-c"><span class="pl-c">#</span> If dry run, remove --exec</span> -f2 --replace <span class="pl-s"><span class="pl-pds">"</span>{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{hash.md5}{ext}<span class="pl-pds">"</span></span> --exec - -<span class="pl-c"><span class="pl-c">#</span> Include ImageSize (require exiftool)</span> -f2 --replace <span class="pl-s"><span class="pl-pds">"</span>{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{xt.ImageSize}_{hash.md5}{ext}<span class="pl-pds">"</span></span> --exec - -<span class="pl-c"><span class="pl-c">#</span> Not include time</span> -f2 --exclude=<span class="pl-s"><span class="pl-pds">"</span>\d+x\d+_[a-z\d]{32}<span class="pl-pds">"</span></span> --sort=mtime --replace <span class="pl-s"><span class="pl-pds">"</span>{xt.ImageSize}_{hash.md5}{ext}<span class="pl-pds">"</span></span> --exec - -<span class="pl-c"><span class="pl-c">#</span> Remove space in directory</span> -f2 --find <span class="pl-s"><span class="pl-pds">"</span> <span class="pl-pds">"</span></span> --replace <span class="pl-s"><span class="pl-pds">"</span>_<span class="pl-pds">"</span></span> --string-mode --only-dir --exec</pre> + <pre><span class="pl-c"><span class="pl-c">#</span> Compress pdf</span> +qpdf input.pdf output.pdf --verbose --linearize --optimize-images</pre> </div> <div> diff --git a/posts/2023-07-01-pastebin.md b/posts/2023-07-01-pastebin.md index 5c054e3..b41fdc4 100644 --- a/posts/2023-07-01-pastebin.md +++ b/posts/2023-07-01-pastebin.md @@ -224,20 +224,11 @@ fd -H '^\.DS_Store$' -tf -X rm ## [sd](https://github.com/chmln/sd) -Remove proto options: - ```sh +# Remove proto option sd -F 'import "validate/validate.proto";' '' api/raw/*.proto sd -F 'import "marshal-zap.proto";' '' api/raw/*.proto -sd -f s '\s\[.*?];' ';' api/raw/*.proto -``` - -## [fdupes](https://github.com/adrianlopezroche/fdupes) - -Remove duplicated files: - -```sh -fdupes -rdN . +sd -f s '\s\[\s*\(.*?];' ';' api/raw/*.proto ``` ## [rsync](https://github.com/WayneD/rsync) @@ -264,6 +255,28 @@ Be careful flags (need dry run if not sure): - `--delete`: delete files in **dst** if not exist in **src**, useful to sync dst with src +## [fclones](https://github.com/pkolaczk/fclones) + +```sh +fclones group . | fclones remove +``` + +## [F2](https://github.com/ayoisaiah/f2) + +```sh +# If dry run, remove --exec +f2 --replace "{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{hash.md5}{ext}" --exec + +# Include ImageSize (require exiftool) +f2 --replace "{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{xt.ImageSize}_{hash.md5}{ext}" --exec + +# Not include time +f2 --exclude="\d+x\d+_[a-z\d]{32}" --sort=mtime --replace "{xt.ImageSize}_{hash.md5}{ext}" --exec + +# Remove space in directory +f2 --find " " --replace "_" --string-mode --only-dir --exec +``` + ## [ffmpeg](https://github.com/FFmpeg/FFmpeg) ```sh @@ -277,9 +290,13 @@ Links: - [H.265/HEVC Video Encoding Guide](https://trac.ffmpeg.org/wiki/Encode/H.265) -## [libvips](https://github.com/libvips/libvips) +## [yt-dlp](https://github.com/yt-dlp/yt-dlp) -Convert: +```sh +yt-dlp -f - "https://www.youtube.com/watch?v=video_id" +``` + +## [libvips](https://github.com/libvips/libvips) ```sh # Add --vips-progress to show progress @@ -297,28 +314,9 @@ fd "png|webp|gif" --exec-batch rm vips rot filename.jxl new_filename.jxl d90 ``` -## [yt-dlp](https://github.com/yt-dlp/yt-dlp) - -Download: - -```sh -yt-dlp -f - "https://www.youtube.com/watch?v=video_id" -``` - -## [F2](https://github.com/ayoisaiah/f2) - -Rename: +## [qpdf](https://github.com/qpdf/qpdf) ```sh -# If dry run, remove --exec -f2 --replace "{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{hash.md5}{ext}" --exec - -# Include ImageSize (require exiftool) -f2 --replace "{mtime.YYYY}{mtime.MM}{mtime.DD}_{mtime.H}{mtime.mm}{mtime.ss}_{xt.ImageSize}_{hash.md5}{ext}" --exec - -# Not include time -f2 --exclude="\d+x\d+_[a-z\d]{32}" --sort=mtime --replace "{xt.ImageSize}_{hash.md5}{ext}" --exec - -# Remove space in directory -f2 --find " " --replace "_" --string-mode --only-dir --exec +# Compress pdf +qpdf input.pdf output.pdf --verbose --linearize --optimize-images ```