snipt

Ctrl+h for KB shortcuts
#5721

Bash

compact Firefox (and other Mozilla product) databases

1
2
3
4
# make sure sqlite is installed
sudo apt-get install sqlite3
# vacuum'em-all
find ~/.mozilla -name "*.sqlite" -exec sqlite3 {} "VACUUM;" \;
https://snipt.net/embed/31bfb236664390862401f1f43f3970ba/
https://snipt.net/raw/31bfb236664390862401f1f43f3970ba/
31bfb236664390862401f1f43f3970ba
bash
Bash
4
2014-04-14T20:28:53
True
False
/api/public/snipt/5721/
compact-firefox-and-other-mozilla-product-databases
<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="c"># make sure sqlite is installed</span> </span><span id="L-2"><a name="L-2"></a>sudo apt-get install sqlite3 </span><span id="L-3"><a name="L-3"></a><span class="c"># vacuum&#39;em-all</span> </span><span id="L-4"><a name="L-4"></a>find ~/.mozilla -name <span class="s2">&quot;*.sqlite&quot;</span> -exec sqlite3 <span class="o">{}</span> <span class="s2">&quot;VACUUM;&quot;</span> <span class="se">\;</span> </span></pre></div> </td></tr></table>
compact, database, firefox, mozilla, sqlite, thunderbird, vacuum
#4455

Text only

passwordless PostgreSQL dumps

1
2
3
4
5
6
# /etc/sudoers
username machine = (postgres) NOPASSWD: /usr/bin/pg_dump
# Make sure no following rules override the above one.
# Now you can:
# username@machine $ sudo -u postgres pg_dump mydb
# without needing to enter your password.
https://snipt.net/embed/b3eaa5687c0f900d5a349ba3e688ac2e/
https://snipt.net/raw/b3eaa5687c0f900d5a349ba3e688ac2e/
b3eaa5687c0f900d5a349ba3e688ac2e
text
Text only
6
2014-04-16T23:33:53
True
False
/api/public/snipt/4455/
passwordless-postgresql-dumps
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a># /etc/sudoers </span><span id="L-2"><a name="L-2"></a>username machine = (postgres) NOPASSWD: /usr/bin/pg_dump </span><span id="L-3"><a name="L-3"></a># Make sure no following rules override the above one. </span><span id="L-4"><a name="L-4"></a># Now you can: </span><span id="L-5"><a name="L-5"></a># username@machine $ sudo -u postgres pg_dump mydb </span><span id="L-6"><a name="L-6"></a># without needing to enter your password. </span></pre></div> </td></tr></table>
database, pg_dump, postgresql, sudo
#4454

Bash

copy PostgreSQL database from remote machine

user@local $ sudo -u postgres dropdb mydb
user@local $ ssh remote sudo -u postgres pg_dump -C mydb | sudo -u postgres psql
https://snipt.net/embed/24ccfb7bbc25089656f0665e6fca6aef/
https://snipt.net/raw/24ccfb7bbc25089656f0665e6fca6aef/
24ccfb7bbc25089656f0665e6fca6aef
bash
Bash
2
2014-04-17T05:08:09
True
False
/api/public/snipt/4454/
copy-postgresql-database-from-remote-machine
<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>user@local <span class="nv">$ </span>sudo -u postgres dropdb mydb </span><span id="L-2"><a name="L-2"></a>user@local <span class="nv">$ </span>ssh remote sudo -u postgres pg_dump -C mydb <span class="p">|</span> sudo -u postgres psql </span></pre></div> </td></tr></table>
copy, database, postgresql, ssh, sudo