snipt

Ctrl+h for KB shortcuts

PHP

Reset query

<?php wp_reset_query(); ?>
https://snipt.net/embed/e7cd3704e091ddbf4b636824e183ab9b/
/raw/e7cd3704e091ddbf4b636824e183ab9b/
e7cd3704e091ddbf4b636824e183ab9b
php
PHP
1
2019-06-04T14:17:39
True
False
False
/api/public/snipt/14359/
reset-query
<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="cp">&lt;?php</span> <span class="nx">wp_reset_query</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
query, reset, wordpress

SQL

Monitor active PostgreSQL queries against a database

1
2
3
4
SELECT procpid, current_query, waiting
FROM   pg_stat_activity
WHERE  datname = 'your_database_name'
AND    current_query <> '<IDLE>';
https://snipt.net/embed/47684408f6eae77c0384c2e2644d693d/
/raw/47684408f6eae77c0384c2e2644d693d/
47684408f6eae77c0384c2e2644d693d
sql
SQL
4
2019-06-26T07:53:40
True
False
False
/api/public/snipt/13311/
monitor-active-postgresql-queries-against-a-database
<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">procpid</span><span class="p">,</span> <span class="n">current_query</span><span class="p">,</span> <span class="n">waiting</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">datname</span> <span class="o">=</span> <span class="s1">&#39;your_database_name&#39;</span> </span><span id="L-4"><a name="L-4"></a><span class="k">AND</span> <span class="n">current_query</span> <span class="o">&lt;&gt;</span> <span class="s1">&#39;&lt;IDLE&gt;&#39;</span><span class="p">;</span> </span></pre></div> </td></tr></table>
db, psql, query

Bash

Query Package Install Order and Dates

1
2
3
4
5
6
# Query Package Install Order and Dates 
# Useful after an upgrade to find old packages that were not upgraded.

rpm -qa --last >~/RPMS_by_Install_Date

# Review the end of the output file in "less" to find all RPMS older than the install date. Can also grep for specific packages and see when they were installed. 
https://snipt.net/embed/fd6c741397ac9c342ccb09539bd55d5d/
/raw/fd6c741397ac9c342ccb09539bd55d5d/
fd6c741397ac9c342ccb09539bd55d5d
bash
Bash
6
2019-06-18T12:11:52
True
False
False
/api/public/snipt/5478/
query-package-install-order-and-dates
<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="c1"># Query Package Install Order and Dates </span> </span><span id="L-2"><a name="L-2"></a><span class="c1"># Useful after an upgrade to find old packages that were not upgraded.</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>rpm -qa --last &gt;~/RPMS_by_Install_Date </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="c1"># Review the end of the output file in &quot;less&quot; to find all RPMS older than the install date. Can also grep for specific packages and see when they were installed. </span> </span></pre></div> </td></tr></table>
packages, query, rpm

Bash

list repositories for a deb package

1
2
3
4
5
6
7
8
$ sudo apt-get install apt-show-versions
$ apt-show-versions -a git-core
git-core 1:1.6.0.4-1ubuntu2 install ok installed
git-core 1:1.5.6.3-1.1ubuntu2   intrepid          fi.archive.ubuntu.com
git-core 1:1.5.6.3-1.1ubuntu2.1 intrepid-security security.ubuntu.com
git-core 1:1.6.0.4-1ubuntu2     jaunty            fi.archive.ubuntu.com
No unstable version
git-core/jaunty uptodate 1:1.6.0.4-1ubuntu2
https://snipt.net/embed/d8d74718b12f9a51c299d2a619db73c8/
/raw/d8d74718b12f9a51c299d2a619db73c8/
d8d74718b12f9a51c299d2a619db73c8
bash
Bash
8
2019-06-23T23:48:55
True
False
False
/api/public/snipt/5465/
list-repositories-for-a-deb-package
<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>$ sudo apt-get install apt-show-versions </span><span id="L-2"><a name="L-2"></a>$ apt-show-versions -a git-core </span><span id="L-3"><a name="L-3"></a>git-core 1:1.6.0.4-1ubuntu2 install ok installed </span><span id="L-4"><a name="L-4"></a>git-core 1:1.5.6.3-1.1ubuntu2 intrepid <span class="k">fi</span>.archive.ubuntu.com </span><span id="L-5"><a name="L-5"></a>git-core 1:1.5.6.3-1.1ubuntu2.1 intrepid-security security.ubuntu.com </span><span id="L-6"><a name="L-6"></a>git-core 1:1.6.0.4-1ubuntu2 jaunty <span class="k">fi</span>.archive.ubuntu.com </span><span id="L-7"><a name="L-7"></a>No unstable version </span><span id="L-8"><a name="L-8"></a>git-core/jaunty uptodate 1:1.6.0.4-1ubuntu2 </span></pre></div> </td></tr></table>
apt, debian, dpkg, query, repository, ubuntu