snipt

Ctrl+h for KB shortcuts

Bash

Get package version from deb file

debFile="/path/to/deb/file"
dpkg -I "$debFile"  | grep -oP '(?<=Version: ).*'
https://snipt.net/embed/0bf8d894f6ead618ac4cf860825e6a34/
https://snipt.net/raw/0bf8d894f6ead618ac4cf860825e6a34/
0bf8d894f6ead618ac4cf860825e6a34
bash
Bash
2
2016-08-29T13:10:14
True
False
False
Oct 06, 2015 at 08:16 AM
/api/public/snipt/141521/
get-package-version-from-deb-file
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nv">debFile</span><span class="o">=</span><span class="s2">&quot;/path/to/deb/file&quot;</span> </span><span id="L-2"><a name="L-2"></a>dpkg -I <span class="s2">&quot;</span><span class="nv">$debFile</span><span class="s2">&quot;</span> <span class="p">|</span> grep -oP <span class="s1">&#39;(?&lt;=Version: ).*&#39;</span> </span></pre></div> </td></tr></table>
bash, deb, linux, package, ubuntu

Bash

get remote server cert in PEM format

1
2
3
4
server="www.example.com"
port=443
outFile="/some/file"
openssl s_client -showcerts -connect "$server:$port" < /dev/null | openssl x509 -outform PEM > "$outFile"
https://snipt.net/embed/eeaaedbea37b185b18e01b400ff00db6/
https://snipt.net/raw/eeaaedbea37b185b18e01b400ff00db6/
eeaaedbea37b185b18e01b400ff00db6
bash
Bash
4
2016-08-29T13:10:14
True
False
True
Sep 30, 2015 at 07:12 AM
/api/public/snipt/141318/
get-remote-server-cert-in-pem-format
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nv">server</span><span class="o">=</span><span class="s2">&quot;www.example.com&quot;</span> </span><span id="L-2"><a name="L-2"></a><span class="nv">port</span><span class="o">=</span>443 </span><span id="L-3"><a name="L-3"></a><span class="nv">outFile</span><span class="o">=</span><span class="s2">&quot;/some/file&quot;</span> </span><span id="L-4"><a name="L-4"></a>openssl s_client -showcerts -connect <span class="s2">&quot;</span><span class="nv">$server</span><span class="s2">:</span><span class="nv">$port</span><span class="s2">&quot;</span> &lt; /dev/null <span class="p">|</span> openssl x509 -outform PEM &gt; <span class="s2">&quot;</span><span class="nv">$outFile</span><span class="s2">&quot;</span> </span></pre></div> </td></tr></table>
bash, linux, openssl

Bash

linux > check if username exists

$ id -u name
https://snipt.net/embed/067c62975fc052fa0821b7b3ae80a4c5/
https://snipt.net/raw/067c62975fc052fa0821b7b3ae80a4c5/
067c62975fc052fa0821b7b3ae80a4c5
bash
Bash
1
2016-08-29T13:10:15
True
False
False
Feb 03, 2015 at 07:45 PM
/api/public/snipt/138039/
linux-check-if-username-exists-bc795ca7
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nv">$ </span>id -u name </span></pre></div> </td></tr></table>
bash, linux, ubuntu

Bash

find and delete files older than 15 minutes

$ find /path/to/files/*.json -type f -mmin +15 -delete
https://snipt.net/embed/526b8c150780e8fd47ad7b0adaac0e65/
https://snipt.net/raw/526b8c150780e8fd47ad7b0adaac0e65/
526b8c150780e8fd47ad7b0adaac0e65
bash
Bash
1
2016-08-29T13:10:15
True
False
False
/api/public/snipt/137461/
find-and-delete-files-older-than-15-minutes-e01e1c63
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nv">$ </span>find /path/to/files/*.json -type f -mmin +15 -delete </span></pre></div> </td></tr></table>
bash, delete, find, linux

Bash

ImageMagick list supported formats

$ identify -list format|grep -i webp
https://snipt.net/embed/4435a262d53e289d0f8ba79119675c06/
https://snipt.net/raw/4435a262d53e289d0f8ba79119675c06/
4435a262d53e289d0f8ba79119675c06
bash
Bash
1
2016-08-29T13:10:16
True
False
False
/api/public/snipt/135538/
imagemagick-list-supported-formats-8e405b30
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nv">$ </span>identify -list format<span class="p">|</span>grep -i webp </span></pre></div> </td></tr></table>
bash, conversion, imagemagick

Bash

OSX install imagemagick with WEBP and TIFF support

$ brew install imagemagick --with-webp --with-libtiff
https://snipt.net/embed/7776a00a6468dbe85bb3eb07f987c85a/
https://snipt.net/raw/7776a00a6468dbe85bb3eb07f987c85a/
7776a00a6468dbe85bb3eb07f987c85a
bash
Bash
1
2016-08-29T13:10:16
True
False
False
/api/public/snipt/135508/
osx-install-imagemagick-with-webp-and-tiff-support-27ac9e32
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nv">$ </span>brew install imagemagick --with-webp --with-libtiff </span></pre></div> </td></tr></table>
bash, imagemagick

Bash

Better Git log

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit"
https://snipt.net/embed/1feea14ac5545403b2027bbe7046b8a0/
https://snipt.net/raw/1feea14ac5545403b2027bbe7046b8a0/
1feea14ac5545403b2027bbe7046b8a0
bash
Bash
2
2016-08-29T13:10:17
True
False
False
Feb 24, 2014 at 11:00 AM
/api/public/snipt/116374/
better-git-log
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>git config --global alias.lg <span class="s2">&quot;log --color --graph --pretty=format:&#39;%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)&lt;%an&gt;%Creset&#39; --abbrev-commit&quot;</span> </span></pre></div> </td></tr></table>
bash, git
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.