snipt

Ctrl+h for KB shortcuts

Bash

Display system information

# Display CPU information
less /proc/cpuinfo
https://snipt.net/embed/e0711a2bd0d5ad44b89c3db42988f696/
/raw/e0711a2bd0d5ad44b89c3db42988f696/
e0711a2bd0d5ad44b89c3db42988f696
bash
Bash
2
2019-06-21T03:45:57
True
False
False
/api/public/snipt/32159/
display-system-information
<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="c1"># Display CPU information</span> </span><span id="L-2"><a name="L-2"></a>less /proc/cpuinfo </span></pre></div> </td></tr></table>
cpu, system

Text only

Useful tool

1. tshark
https://snipt.net/embed/51ecd43b520fbb2428f27db9eefc38fe/
/raw/51ecd43b520fbb2428f27db9eefc38fe/
51ecd43b520fbb2428f27db9eefc38fe
text
Text only
1
2019-06-23T16:40:00
True
False
False
/api/public/snipt/29429/
useful-tool
<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>1. tshark </span></pre></div> </td></tr></table>
capture, tool

Text only

Import database from file

mysql -u username -p -h chuabiet.com databaseName < /path/to/database.sql
mysql -u username -p databaseName < /path/to/database.sql # localhost
https://snipt.net/embed/05591dc893d6835a7498e629c5d15801/
/raw/05591dc893d6835a7498e629c5d15801/
05591dc893d6835a7498e629c5d15801
text
Text only
2
2019-06-21T09:27:16
True
False
False
/api/public/snipt/28918/
import-database-from-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></span><span id="L-1"><a name="L-1"></a>mysql -u username -p -h chuabiet.com databaseName &lt; /path/to/database.sql </span><span id="L-2"><a name="L-2"></a>mysql -u username -p databaseName &lt; /path/to/database.sql # localhost </span></pre></div> </td></tr></table>
import, mysql

Text only

Regular expression cookbook

1
2
3
4
5
# Không ch?p nh?n kí t? ??u tiên là @
'/^[^@]/'

# Không ch?p nh?t các kí t? @?!a
'/^[^@?!a]+$/'
https://snipt.net/embed/be89318712ec41def6641ec670796fbb/
/raw/be89318712ec41def6641ec670796fbb/
be89318712ec41def6641ec670796fbb
text
Text only
5
2019-06-22T03:02:54
True
False
False
/api/public/snipt/28466/
regular-expression-cookbook
<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># Không ch?p nh?n kí t? ??u tiên là @ </span><span id="L-2"><a name="L-2"></a>&#39;/^[^@]/&#39; </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a># Không ch?p nh?t các kí t? @?!a </span><span id="L-5"><a name="L-5"></a>&#39;/^[^@?!a]+$/&#39; </span></pre></div> </td></tr></table>
"regular expression", reg

HTML

Url in Symfony

<a href="<?php echo url_for('@video_category?category_slug='.$mtvVideoCategory->getSlug())?>"><?php echo $mtvVideoCategory->getName(); ?></a>
https://snipt.net/embed/c1ccebe304405ca264551c5cd39de633/
/raw/c1ccebe304405ca264551c5cd39de633/
c1ccebe304405ca264551c5cd39de633
html
HTML
3
2019-06-05T06:44:02
True
False
False
/api/public/snipt/28330/
url-in-symfony
<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="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;&lt;?php echo url_for(&#39;@video_category?category_slug=&#39;.$mtvVideoCategory-&gt;getSlug())?&gt;&quot;</span><span class="p">&gt;</span><span class="cp">&lt;?php echo $mtvVideoCategory-&gt;getName(); ?&gt;</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
routing, symfony, url

Text only

Remove all .svn files in source code directory

find . -name .svn -print0 | xargs -0 rm -rf
https://snipt.net/embed/929f246f203cb3b091b4acffa58ca6e7/
/raw/929f246f203cb3b091b4acffa58ca6e7/
929f246f203cb3b091b4acffa58ca6e7
text
Text only
1
2019-06-23T04:17:46
True
False
False
/api/public/snipt/28233/
remove-all-svn-files-in-source-code-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>find . -name .svn -print0 | xargs -0 rm -rf </span></pre></div> </td></tr></table>
.svn, svn

Python

Get platform information

1
2
3
4
5
6
7
8
# Get platform information
import platform
platform.uname()
platform.platform()
platform.release()
platform.version()   
platform.system()    
dir(platform)        
https://snipt.net/embed/052a322b93023f96e15542a287f04a67/
/raw/052a322b93023f96e15542a287f04a67/
052a322b93023f96e15542a287f04a67
python
Python
8
2019-06-19T13:50:07
True
False
False
/api/public/snipt/28017/
get-platform-information
<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="c1"># Get platform information</span> </span><span id="L-2"><a name="L-2"></a><span class="kn">import</span> <span class="nn">platform</span> </span><span id="L-3"><a name="L-3"></a><span class="n">platform</span><span class="o">.</span><span class="n">uname</span><span class="p">()</span> </span><span id="L-4"><a name="L-4"></a><span class="n">platform</span><span class="o">.</span><span class="n">platform</span><span class="p">()</span> </span><span id="L-5"><a name="L-5"></a><span class="n">platform</span><span class="o">.</span><span class="n">release</span><span class="p">()</span> </span><span id="L-6"><a name="L-6"></a><span class="n">platform</span><span class="o">.</span><span class="n">version</span><span class="p">()</span> </span><span id="L-7"><a name="L-7"></a><span class="n">platform</span><span class="o">.</span><span class="n">system</span><span class="p">()</span> </span><span id="L-8"><a name="L-8"></a><span class="nb">dir</span><span class="p">(</span><span class="n">platform</span><span class="p">)</span> </span></pre></div> </td></tr></table>
os, platform, python, system