Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

PostgreSQL SQL dialect

psql force drop database

1
2
3
4
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'TARGET_DB'
  AND pid <> pg_backend_pid();
https://snipt.net/embed/cb2252f2e6851df987ee16e35bcb99a8/
https://snipt.net/raw/cb2252f2e6851df987ee16e35bcb99a8/
cb2252f2e6851df987ee16e35bcb99a8
postgresql
PostgreSQL SQL dialect
4
2016-12-10T05:24:59
True
False
False
/api/public/snipt/136146/
psql-force-drop-database-b1947d50
<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></span><span id="L-1"><a name="L-1"></a><span class="k">SELECT</span> <span class="n">pg_terminate_backend</span><span class="p">(</span><span class="n">pg_stat_activity</span><span class="mf">.</span><span class="n">pid</span><span class="p">)</span> </span><span id="L-2"><a name="L-2"></a><span class="k">FROM</span> <span class="n">pg_stat_activity</span> </span><span id="L-3"><a name="L-3"></a><span class="k">WHERE</span> <span class="n">pg_stat_activity</span><span class="mf">.</span><span class="n">datname</span> <span class="o">=</span> <span class="s1">&#39;TARGET_DB&#39;</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">AND</span> <span class="n">pid</span> <span class="o">&lt;&gt;</span> <span class="n">pg_backend_pid</span><span class="p">();</span> </span></pre></div> </td></tr></table>
drop, psql

Bash

null/blackhole route

1
2
3
4
5
6
7
# network route that goes nowhere - blackhole filtering

# 1] available to almost every host implementing the ip module
# 2] almost 0 performance impact
# 3] can sustain higher throughput than conventional firewalls

route add -host 192.168.1.1 reject
https://snipt.net/embed/d88d78e7a1c92f2b7abcb2ca4eb8bf7b/
https://snipt.net/raw/d88d78e7a1c92f2b7abcb2ca4eb8bf7b/
d88d78e7a1c92f2b7abcb2ca4eb8bf7b
bash
Bash
7
2016-12-09T22:26:39
True
False
False
/api/public/snipt/34065/
nullblackhole-route
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># network route that goes nowhere - blackhole filtering</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1"># 1] available to almost every host implementing the ip module</span> </span><span id="L-4"><a name="L-4"></a><span class="c1"># 2] almost 0 performance impact</span> </span><span id="L-5"><a name="L-5"></a><span class="c1"># 3] can sustain higher throughput than conventional firewalls</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a>route add -host 192.168.1.1 reject </span></pre></div> </td></tr></table>
bash, blackhole, drop, filtering, ip, iptables, packet, reject, route

MySQL

mysql drop all tables in a database

mysqldump -u[USERNAME] -p[PASSWORD] --add-drop-table --no-data [DATABASE] | grep ^DROP | mysql -u[USERNAME] -p[PASSWORD] [DATABASE]
https://snipt.net/embed/cce3dccb0e656597a48714c7b7de0076/
https://snipt.net/raw/cce3dccb0e656597a48714c7b7de0076/
cce3dccb0e656597a48714c7b7de0076
mysql
MySQL
1
2016-12-10T18:18:42
True
False
False
/api/public/snipt/23487/
mysql-drop-all-tables-in-a-database
<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><span class="n">mysqldump</span> <span class="o">-</span><span class="n">u</span><span class="p">[</span><span class="n">USERNAME</span><span class="p">]</span> <span class="o">-</span><span class="n">p</span><span class="p">[</span><span class="n">PASSWORD</span><span class="p">]</span> <span class="o">--</span><span class="k">add</span><span class="o">-</span><span class="k">drop</span><span class="o">-</span><span class="k">table</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">data</span> <span class="p">[</span><span class="k">DATABASE</span><span class="p">]</span> <span class="o">|</span> <span class="n">grep</span> <span class="o">^</span><span class="k">DROP</span> <span class="o">|</span> <span class="n">mysql</span> <span class="o">-</span><span class="n">u</span><span class="p">[</span><span class="n">USERNAME</span><span class="p">]</span> <span class="o">-</span><span class="n">p</span><span class="p">[</span><span class="n">PASSWORD</span><span class="p">]</span> <span class="p">[</span><span class="k">DATABASE</span><span class="p">]</span> </span></pre></div> </td></tr></table>
drop, mysql, tables

Bash

delete mysql schema

mysqladmin -u root -p drop <schema_name>
https://snipt.net/embed/09b508817215f659596df4ee26bedd31/
https://snipt.net/raw/09b508817215f659596df4ee26bedd31/
09b508817215f659596df4ee26bedd31
bash
Bash
1
2016-12-09T23:09:25
True
False
False
/api/public/snipt/6419/
delete-mysql-schema
<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>mysqladmin -u root -p drop &lt;schema_name&gt; </span></pre></div> </td></tr></table>
bash, delete, drop, mysql, schema

MySQL

delete mysql user

DROP USER <username>;
https://snipt.net/embed/f9ac28750f8eb2a314a29a3f87fa546d/
https://snipt.net/raw/f9ac28750f8eb2a314a29a3f87fa546d/
f9ac28750f8eb2a314a29a3f87fa546d
mysql
MySQL
1
2016-12-09T23:09:45
True
False
False
/api/public/snipt/6415/
delete-mysql-user
<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><span class="k">DROP</span> <span class="n">USER</span> <span class="o">&lt;</span><span class="n">username</span><span class="o">&gt;</span><span class="p">;</span> </span></pre></div> </td></tr></table>
delete, drop, mysql, user

CSS

Drop Caps

1
2
3
4
5
6
7
8
p:first-letter{  
  display:block;  
  margin:5px 0 0 5px;  
  float:left;  
  color:#FF3366;  
  font-size:60px;  
  font-family:Georgia;  
 } 
https://snipt.net/embed/6b67c193af4e5ba7b36e0dfc37f39bd3/
https://snipt.net/raw/6b67c193af4e5ba7b36e0dfc37f39bd3/
6b67c193af4e5ba7b36e0dfc37f39bd3
css
CSS
8
2016-12-05T17:12:00
True
False
False
/api/public/snipt/2238/
drop-caps
<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><span class="nt">p</span><span class="nd">:first-letter</span><span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="nb">display</span><span class="o">:</span><span class="nb">block</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a> <span class="nb">margin</span><span class="o">:</span><span class="m">5px</span> <span class="m">0</span> <span class="m">0</span> <span class="m">5px</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a> <span class="nb">float</span><span class="o">:</span><span class="nb">left</span><span class="p">;</span> </span><span id="L-5"><a name="L-5"></a> <span class="nb">color</span><span class="o">:</span><span class="m">#FF3366</span><span class="p">;</span> </span><span id="L-6"><a name="L-6"></a> <span class="nb">font-size</span><span class="o">:</span><span class="m">60px</span><span class="p">;</span> </span><span id="L-7"><a name="L-7"></a> <span class="nb">font-family</span><span class="o">:</span><span class="n">Georgia</span><span class="p">;</span> </span><span id="L-8"><a name="L-8"></a> <span class="p">}</span> </span></pre></div> </td></tr></table>
big, caps, css, drop, text
Copyrighted, illegal, or inappropriate content? Email [email protected].