Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

HTML

Prefetching in HTML5

<link rel="prefetch" href="/images/big.jpeg">
<link rel="next" href="page2.html">
https://snipt.net/embed/9eb3c272d98ab5875773707882dc9daa/
https://snipt.net/raw/9eb3c272d98ab5875773707882dc9daa/
9eb3c272d98ab5875773707882dc9daa
html
HTML
2
2016-12-02T15:35:13
True
False
False
/api/public/snipt/15384/
prefetching-in-html5
<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></span><span id="L-1"><a name="L-1"></a><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;prefetch&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;/images/big.jpeg&quot;</span><span class="p">&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;next&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;page2.html&quot;</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
html5, optimization, prefetching

Bash

parse mysql slow query log with maatkit script and save to database table.

mk-query-digest --review D=<database name>,t=<table name>,u=<username>,p='secret' /var/log/mysql/mysql-slow.log
https://snipt.net/embed/ec106fd3e54173b8cf23f32cc94123fa/
https://snipt.net/raw/ec106fd3e54173b8cf23f32cc94123fa/
ec106fd3e54173b8cf23f32cc94123fa
bash
Bash
1
2016-12-02T15:30:54
True
False
False
/api/public/snipt/7391/
parse-mysql-slow-query-log-with-maatkit-script-and-save-to-query_review-table
<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>mk-query-digest --review <span class="nv">D</span><span class="o">=</span>&lt;database name&gt;,t<span class="o">=</span>&lt;table name&gt;,u<span class="o">=</span>&lt;username&gt;,p<span class="o">=</span><span class="s1">&#39;secret&#39;</span> /var/log/mysql/mysql-slow.log </span></pre></div> </td></tr></table>
database, monitoring, optimization

Text only

Enable Deflate

1
2
3
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
   SetOutputFilter DEFLATE
</FilesMatch>
https://snipt.net/embed/5b31ec55be7f7d44321f047b9fdc6b89/
https://snipt.net/raw/5b31ec55be7f7d44321f047b9fdc6b89/
5b31ec55be7f7d44321f047b9fdc6b89
text
Text only
3
2016-12-02T15:35:16
True
False
False
/api/public/snipt/2765/
enable-deflate
<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>&lt;FilesMatch &quot;\\.(js|css|html|htm|php|xml)$&quot;&gt; </span><span id="L-2"><a name="L-2"></a> SetOutputFilter DEFLATE </span><span id="L-3"><a name="L-3"></a>&lt;/FilesMatch&gt; </span></pre></div> </td></tr></table>
deflate, htaccess, optimization

Text only

Enable Expires

1
2
3
4
5
6
<ifmodule mod_expires.c>
  <filesmatch "\.(jpg|gif|png|css|js)$">
       ExpiresActive on
       ExpiresDefault "access plus 7 days"
   </filesmatch>
</ifmodule>
https://snipt.net/embed/07fcec8d28269392f605f3b22ce4fbd6/
https://snipt.net/raw/07fcec8d28269392f605f3b22ce4fbd6/
07fcec8d28269392f605f3b22ce4fbd6
text
Text only
6
2016-12-02T15:35:18
True
False
False
/api/public/snipt/2764/
enable-expires
<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></span><span id="L-1"><a name="L-1"></a>&lt;ifmodule mod_expires.c&gt; </span><span id="L-2"><a name="L-2"></a> &lt;filesmatch &quot;\.(jpg|gif|png|css|js)$&quot;&gt; </span><span id="L-3"><a name="L-3"></a> ExpiresActive on </span><span id="L-4"><a name="L-4"></a> ExpiresDefault &quot;access plus 7 days&quot; </span><span id="L-5"><a name="L-5"></a> &lt;/filesmatch&gt; </span><span id="L-6"><a name="L-6"></a>&lt;/ifmodule&gt; </span></pre></div> </td></tr></table>
expires, htaccess, optimization

Text only

Enable ETags

FileETag MTime Size
https://snipt.net/embed/a78c41c1315a97bcf1d5a3fe09868f11/
https://snipt.net/raw/a78c41c1315a97bcf1d5a3fe09868f11/
a78c41c1315a97bcf1d5a3fe09868f11
text
Text only
1
2016-12-02T15:35:21
True
False
False
/api/public/snipt/2763/
enable-etags
<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>FileETag MTime Size </span></pre></div> </td></tr></table>
etags, htaccess, optimization

MySQL

show state & thread ID's of MySQL processes

SHOW PROCESSLIST;
https://snipt.net/embed/48249b7e42ff1283a6efb0212f0f78df/
https://snipt.net/raw/48249b7e42ff1283a6efb0212f0f78df/
48249b7e42ff1283a6efb0212f0f78df
mysql
MySQL
1
2016-12-02T10:19:04
True
False
False
/api/public/snipt/1349/
show-state-thread-ids-of-mysql-processes
<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">SHOW</span> <span class="n">PROCESSLIST</span><span class="p">;</span> </span></pre></div> </td></tr></table>
mysql, optimization
Copyrighted, illegal, or inappropriate content? Email [email protected].