Skip to content

Commit

Permalink
more pastebin
Browse files Browse the repository at this point in the history
  • Loading branch information
haunt98 committed Jan 5, 2025
1 parent 435dae7 commit 3cccc3e
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 87 deletions.
116 changes: 64 additions & 52 deletions docs/2023-07-01-pastebin.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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
Expand All @@ -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>
Expand Down
68 changes: 33 additions & 35 deletions posts/2023-07-01-pastebin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
```

0 comments on commit 3cccc3e

Please sign in to comment.