snipt

Ctrl+h for KB shortcuts

MySQL

Revoke all mysql priveleges

1
2
3
REVOKE ALL PRIVILEGES, GRANT OPTION ON *.* FROM jimmy@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION ON *.* FROM jimmy@localhost.localdomain;
FLUSH PRIVILEGES;
https://snipt.net/embed/80464f6228547deb7f5de02c5c2c8416/
/raw/80464f6228547deb7f5de02c5c2c8416/
80464f6228547deb7f5de02c5c2c8416
mysql
MySQL
3
2019-08-06T13:12:16
True
False
False
/api/public/snipt/10470/
revoke-all-mysql-priveleges
<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><span class="k">REVOKE</span> <span class="k">ALL</span> <span class="n">PRIVILEGES</span><span class="p">,</span> <span class="k">GRANT</span> <span class="k">OPTION</span> <span class="k">ON</span> <span class="o">*</span><span class="p">.</span><span class="o">*</span> <span class="k">FROM</span> <span class="n">jimmy</span><span class="o">@</span><span class="n">localhost</span><span class="p">;</span> </span><span id="L-2"><a name="L-2"></a><span class="k">REVOKE</span> <span class="k">ALL</span> <span class="n">PRIVILEGES</span><span class="p">,</span> <span class="k">GRANT</span> <span class="k">OPTION</span> <span class="k">ON</span> <span class="o">*</span><span class="p">.</span><span class="o">*</span> <span class="k">FROM</span> <span class="n">jimmy</span><span class="o">@</span><span class="n">localhost</span><span class="p">.</span><span class="n">localdomain</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a><span class="k">FLUSH</span> <span class="n">PRIVILEGES</span><span class="p">;</span> </span></pre></div> </td></tr></table>
mysql

Python

Validate email address (based on example from django source)

1
2
3
4
5
6
import re

if re.match(r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*"r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"'r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', email_address, re.IGNORECASE):
	print "valid email"
else:
	print "invalid email"
https://snipt.net/embed/0d4ea6a6c9e34adf46ccbabd66534fe6/
/raw/0d4ea6a6c9e34adf46ccbabd66534fe6/
0d4ea6a6c9e34adf46ccbabd66534fe6
python
Python
6
2019-08-17T02:40:12
True
False
False
/api/public/snipt/9769/
validate-email-address-taken-from-django-source
<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><span class="kn">import</span> <span class="nn">re</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="k">if</span> <span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="s2">r&quot;(^[-!#$%&amp;&#39;*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&amp;&#39;*+/=?^_`{}|~0-9A-Z]+)*&quot;</span><span class="s1">r&#39;|^&quot;([\001-\010\013\014\016-\037!#-\[\]-\177]|</span><span class="se">\\</span><span class="s1">[\001-011\013\014\016-\177])*&quot;&#39;r&#39;)@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$&#39;</span><span class="p">,</span> <span class="n">email_address</span><span class="p">,</span> <span class="n">re</span><span class="o">.</span><span class="n">IGNORECASE</span><span class="p">):</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">print</span> <span class="s2">&quot;valid email&quot;</span> </span><span id="L-5"><a name="L-5"></a><span class="k">else</span><span class="p">:</span> </span><span id="L-6"><a name="L-6"></a> <span class="k">print</span> <span class="s2">&quot;invalid email&quot;</span> </span></pre></div> </td></tr></table>
"validate email", django, python