snipt

Ctrl+h for KB shortcuts

SQL

Find Grants in tables and views in Oracle

1
2
3
select * from table_privileges 
where grantor = 'schema-name' or grantor = 'schema-name' 
order by table_name asc
https://snipt.net/embed/ec83bb0727088a263737e26ea900b6a8/
/raw/ec83bb0727088a263737e26ea900b6a8/
ec83bb0727088a263737e26ea900b6a8
sql
SQL
3
2019-07-06T17:16:25
True
False
False
Nov 11, 2012 at 11:32 PM
/api/public/snipt/50058/
find-grants-in-tables-and-views-in-oracle
<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">select</span> <span class="o">*</span> <span class="k">from</span> <span class="n">table_privileges</span> </span><span id="L-2"><a name="L-2"></a><span class="k">where</span> <span class="n">grantor</span> <span class="o">=</span> <span class="s1">&#39;schema-name&#39;</span> <span class="k">or</span> <span class="n">grantor</span> <span class="o">=</span> <span class="s1">&#39;schema-name&#39;</span> </span><span id="L-3"><a name="L-3"></a><span class="k">order</span> <span class="k">by</span> <span class="k">table_name</span> <span class="k">asc</span> </span></pre></div> </td></tr></table>
Oracle

SQL

See all Oracle errors

select * from all_errors;
https://snipt.net/embed/2e897cd212002978bf945cf925da1946/
/raw/2e897cd212002978bf945cf925da1946/
2e897cd212002978bf945cf925da1946
sql
SQL
1
2019-07-06T06:01:32
True
False
False
Nov 11, 2012 at 11:31 PM
/api/public/snipt/50057/
see-all-oracle-errors
<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">select</span> <span class="o">*</span> <span class="k">from</span> <span class="n">all_errors</span><span class="p">;</span> </span></pre></div> </td></tr></table>
Oracle

SQL

Find tables and views by name

1
2
3
select table_name from user_tables;

select view_name from user_views;
https://snipt.net/embed/36ae02198111240cf0b6c2937deb548e/
/raw/36ae02198111240cf0b6c2937deb548e/
36ae02198111240cf0b6c2937deb548e
sql
SQL
3
2019-07-10T10:07:52
True
False
False
Nov 11, 2012 at 11:31 PM
/api/public/snipt/50056/
find-tables-and-views-by-name
<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">select</span> <span class="k">table_name</span> <span class="k">from</span> <span class="n">user_tables</span><span class="p">;</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="k">select</span> <span class="n">view_name</span> <span class="k">from</span> <span class="n">user_views</span><span class="p">;</span> </span></pre></div> </td></tr></table>
Oracle

SQL

Find a text occurrence in Oracle PL/SQL code

1
2
3
SELECT name, line, text
  FROM user_source
 WHERE text LIKE '%someText1%' OR text LIKE '%someText2%';
https://snipt.net/embed/b620a78449db869f5fa16425623bdbd0/
/raw/b620a78449db869f5fa16425623bdbd0/
b620a78449db869f5fa16425623bdbd0
sql
SQL
3
2019-07-16T04:13:28
True
False
False
Nov 11, 2012 at 11:30 PM
/api/public/snipt/50055/
find-a-text-occurrence-in-oracle-plsql-code
<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">SELECT</span> <span class="n">name</span><span class="p">,</span> <span class="n">line</span><span class="p">,</span> <span class="nb">text</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">FROM</span> <span class="n">user_source</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">WHERE</span> <span class="nb">text</span> <span class="k">LIKE</span> <span class="s1">&#39;%someText1%&#39;</span> <span class="k">OR</span> <span class="nb">text</span> <span class="k">LIKE</span> <span class="s1">&#39;%someText2%&#39;</span><span class="p">;</span> </span></pre></div> </td></tr></table>
Oracle

Bash

Encrypt a Password using JBoss

java -cp lib/jboss-common.jar;lib/jboss-jmx.jar;server/default/lib/jbosssx.jar;server/default/lib/jboss-jca.jar org.jboss.resource.security.SecureIdentityLoginModule secretPassword
https://snipt.net/embed/896058ecdc6911bbcc1069da4c3adcf8/
/raw/896058ecdc6911bbcc1069da4c3adcf8/
896058ecdc6911bbcc1069da4c3adcf8
bash
Bash
1
2019-07-17T06:43:01
True
False
False
/api/public/snipt/50054/
encrypt-a-password-using-jboss
<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>java -cp lib/jboss-common.jar<span class="p">;</span>lib/jboss-jmx.jar<span class="p">;</span>server/default/lib/jbosssx.jar<span class="p">;</span>server/default/lib/jboss-jca.jar org.jboss.resource.security.SecureIdentityLoginModule secretPassword </span></pre></div> </td></tr></table>
JBoss, Security

JavaScript

JavaScript class (using object literals)

1
2
3
4
5
6
7
var apple = {
    type: "macintosh",
    color: "red",
    getInfo: function () {
        return this.color + ' ' + this.type + ' apple';
    }
}
https://snipt.net/embed/c9317947f24221f0505b2c2a47ea05d3/
/raw/c9317947f24221f0505b2c2a47ea05d3/
c9317947f24221f0505b2c2a47ea05d3
js
JavaScript
7
2019-07-12T05:35:21
True
False
False
Nov 11, 2012 at 11:26 PM
/api/public/snipt/50052/
javascript-class-using-object-literals-1
<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="kd">var</span> <span class="nx">apple</span> <span class="o">=</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="nx">type</span><span class="o">:</span> <span class="s2">&quot;macintosh&quot;</span><span class="p">,</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">color</span><span class="o">:</span> <span class="s2">&quot;red&quot;</span><span class="p">,</span> </span><span id="L-4"><a name="L-4"></a> <span class="nx">getInfo</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> </span><span id="L-5"><a name="L-5"></a> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">color</span> <span class="o">+</span> <span class="s1">&#39; &#39;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">type</span> <span class="o">+</span> <span class="s1">&#39; apple&#39;</span><span class="p">;</span> </span><span id="L-6"><a name="L-6"></a> <span class="p">}</span> </span><span id="L-7"><a name="L-7"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
OOP

JavaScript

Parse JSON with Mustache and jQuery

1
2
3
4
5
$.getJSON('json/data.json', function(data) {
    var template = "<h1>{{firstName}} {{lastName}}</h1>Blog: {{blogURL}}";
    var html = Mustache.to_html(template, data);
    $('#sampleArea').html(html);
});
https://snipt.net/embed/59770f3241dc55ccac435ce7a3f72715/
/raw/59770f3241dc55ccac435ce7a3f72715/
59770f3241dc55ccac435ce7a3f72715
js
JavaScript
5
2019-07-14T06:18:53
True
False
False
Nov 11, 2012 at 11:25 PM
/api/public/snipt/50051/
parse-json-with-mustache-and-jquery-1
<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><span class="nx">$</span><span class="p">.</span><span class="nx">getJSON</span><span class="p">(</span><span class="s1">&#39;json/data.json&#39;</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="kd">var</span> <span class="nx">template</span> <span class="o">=</span> <span class="s2">&quot;&lt;h1&gt;{{firstName}} {{lastName}}&lt;/h1&gt;Blog: {{blogURL}}&quot;</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a> <span class="kd">var</span> <span class="nx">html</span> <span class="o">=</span> <span class="nx">Mustache</span><span class="p">.</span><span class="nx">to_html</span><span class="p">(</span><span class="nx">template</span><span class="p">,</span> <span class="nx">data</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;#sampleArea&#39;</span><span class="p">).</span><span class="nx">html</span><span class="p">(</span><span class="nx">html</span><span class="p">);</span> </span><span id="L-5"><a name="L-5"></a><span class="p">});</span> </span></pre></div> </td></tr></table>
Mustache, jQuery