snipt

Ctrl+h for KB shortcuts

Bash

Download a local copy of a whole website

wget -H -N -k -p --exclude-domains quantserve.com --no-check-certificate -U "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a2) Gecko/20110613 Firefox/6.0a2" <FULL_HTTP_URL>
https://snipt.net/embed/3e47ca3f7da22c51faf9a1e951cd3e58/
/raw/3e47ca3f7da22c51faf9a1e951cd3e58/
3e47ca3f7da22c51faf9a1e951cd3e58
bash
Bash
1
2019-08-19T10:22:24
True
False
False
Apr 16, 2014 at 03:45 AM
/api/public/snipt/130426/
download-a-local-copy-of-a-whole-website
<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></span><span id="L-1"><a name="L-1"></a>wget -H -N -k -p --exclude-domains quantserve.com --no-check-certificate -U <span class="s2">&quot;Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a2) Gecko/20110613 Firefox/6.0a2&quot;</span> &lt;FULL_HTTP_URL&gt; </span></pre></div> </td></tr></table>
download, site, wget

Bash

Recursively find and list the last modified files in a directory

stat --printf="%y %n\n" $(ls -tr $(find * -type f))
https://snipt.net/embed/658e81891f567c2b90931e8f90e60846/
/raw/658e81891f567c2b90931e8f90e60846/
658e81891f567c2b90931e8f90e60846
bash
Bash
1
2019-08-19T10:23:23
True
False
False
Jan 31, 2014 at 06:10 AM
/api/public/snipt/109821/
recursively-find-and-list-the-last-modified-files-in-a-directory
<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></span><span id="L-1"><a name="L-1"></a>stat --printf<span class="o">=</span><span class="s2">&quot;%y %n\n&quot;</span> <span class="k">$(</span>ls -tr <span class="k">$(</span>find * -type f<span class="k">))</span> </span></pre></div> </td></tr></table>
date, find, ls, stat

Text only

Create a new MySQL user and grant permissions

1
2
3
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
https://snipt.net/embed/e75d2b07cd56ee71c09da2af27eb7b58/
/raw/e75d2b07cd56ee71c09da2af27eb7b58/
e75d2b07cd56ee71c09da2af27eb7b58
text
Text only
3
2019-08-19T10:24:29
True
False
False
Jan 20, 2014 at 07:43 AM
/api/public/snipt/107183/
create-a-new-mysql-user-and-grant-permissions
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>CREATE USER &#39;newuser&#39;@&#39;localhost&#39; IDENTIFIED BY &#39;password&#39;; </span><span id="L-2"><a name="L-2"></a>GRANT ALL PRIVILEGES ON *.* TO &#39;newuser&#39;@&#39;localhost&#39;; </span><span id="L-3"><a name="L-3"></a>FLUSH PRIVILEGES; </span></pre></div> </td></tr></table>
mysql, user

Bash

Fix broken packages in Ubuntu and Debian

1
2
3
4
5
6
7
8
dpkg --configure -a
apt-get install -f

# If the problem of a broken package still exist, the solution is to edit the dpkg status file manually.

nano /var/lib/dpkg/status

# Locate the corrupt package, and remove the whole block of information about it and save the file.
https://snipt.net/embed/c909f1463882443c12d770afa20dd0d1/
/raw/c909f1463882443c12d770afa20dd0d1/
c909f1463882443c12d770afa20dd0d1
bash
Bash
8
2019-08-19T10:25:21
True
False
False
Dec 04, 2013 at 02:34 AM
/api/public/snipt/98414/
fix-broken-packages-in-ubuntu-and-debian
<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> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>dpkg --configure -a </span><span id="L-2"><a name="L-2"></a>apt-get install -f </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># If the problem of a broken package still exist, the solution is to edit the dpkg status file manually.</span> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>nano /var/lib/dpkg/status </span><span id="L-7"><a name="L-7"></a> </span><span id="L-8"><a name="L-8"></a><span class="c1"># Locate the corrupt package, and remove the whole block of information about it and save the file.</span> </span></pre></div> </td></tr></table>
apt, broken, debian, dpkg, fix, packages, status, ubuntu

Bash

Watch a real 3D movie in 2D with MPlayer

mplayer <VIDEO_FILE> -vo gl:stereo=3
https://snipt.net/embed/11c192fc1ffbad4aff016669c8578b23/
/raw/11c192fc1ffbad4aff016669c8578b23/
11c192fc1ffbad4aff016669c8578b23
bash
Bash
1
2019-08-19T10:26:45
True
False
False
Dec 02, 2013 at 07:48 AM
/api/public/snipt/97932/
watch-a-real-3d-movie-in-2d-with-mplayer
<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></span><span id="L-1"><a name="L-1"></a>mplayer &lt;VIDEO_FILE&gt; -vo gl:stereo<span class="o">=</span>3 </span></pre></div> </td></tr></table>
2d, 3d, bash, movie, mplayer, video

Bash

Show user certificates stored in Mozilla Firefox

1
2
3
certutil -K -d <PROFILE_DIRECTORY>
modutil -list -dbdir <PROFILE_DIRECTORY>
modutil -rawlist -dbdir <PROFILE_DIRECTORY>
https://snipt.net/embed/c736d144c2a86b43bf9e4695669ebd74/
/raw/c736d144c2a86b43bf9e4695669ebd74/
c736d144c2a86b43bf9e4695669ebd74
bash
Bash
3
2019-08-25T00:24:04
True
False
False
Oct 18, 2013 at 03:09 AM
/api/public/snipt/88441/
show-user-certificates-stored-in-mozilla-firefox
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>certutil -K -d &lt;PROFILE_DIRECTORY&gt; </span><span id="L-2"><a name="L-2"></a>modutil -list -dbdir &lt;PROFILE_DIRECTORY&gt; </span><span id="L-3"><a name="L-3"></a>modutil -rawlist -dbdir &lt;PROFILE_DIRECTORY&gt; </span></pre></div> </td></tr></table>
bash, certificates, certutil, firefox, modutil, mozilla

Bash

TAR command to preserve files' permissions

1
2
3
4
5
# Compression
tar -pcvzf ABC.tar.gz ABC

# Decompression
tar -pxvzf ABC.tar.gz
https://snipt.net/embed/4d97bbd42854bf8c9bcb8d0c3b31e472/
/raw/4d97bbd42854bf8c9bcb8d0c3b31e472/
4d97bbd42854bf8c9bcb8d0c3b31e472
bash
Bash
5
2019-08-22T22:33:20
True
False
False
Oct 18, 2013 at 03:10 AM
/api/public/snipt/87757/
tar-command-to-preserve-files-permissions
<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> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Compression</span> </span><span id="L-2"><a name="L-2"></a>tar -pcvzf ABC.tar.gz ABC </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># Decompression</span> </span><span id="L-5"><a name="L-5"></a>tar -pxvzf ABC.tar.gz </span></pre></div> </td></tr></table>
bash, gz, permissions, tar

Bash

How to repair a corrupted FAT32 filesystem

dosfsck -w -r -l -a -v -t <DEVICE>
https://snipt.net/embed/7f179848d48bb1646df3df15ee92b7dc/
/raw/7f179848d48bb1646df3df15ee92b7dc/
7f179848d48bb1646df3df15ee92b7dc
bash
Bash
1
2019-08-24T18:17:03
True
False
False
Oct 07, 2013 at 04:21 AM
/api/public/snipt/85972/
how-to-repair-a-corrupted-fat32-filesystem
<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></span><span id="L-1"><a name="L-1"></a>dosfsck -w -r -l -a -v -t &lt;DEVICE&gt; </span></pre></div> </td></tr></table>
bash, dosfsck, fat, filesystem, fs, repair, vfat