Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

C#

Generic find by key

1
2
3
4
        public TEntity FindById(TKey id)
        {
            return UnitOfWork.Get<TEntity>().SingleOrDefault(t => ((dynamic) t).Id == id);
        }
https://snipt.net/embed/1394039093738ed662d48fc9580789ff/
https://snipt.net/raw/1394039093738ed662d48fc9580789ff/
1394039093738ed662d48fc9580789ff
csharp
C#
4
2016-12-03T05:45:17
True
False
False
/api/public/snipt/27581/
generic-find-by-key
<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">public</span> <span class="n">TEntity</span> <span class="nf">FindById</span><span class="p">(</span><span class="n">TKey</span> <span class="n">id</span><span class="p">)</span> </span><span id="L-2"><a name="L-2"></a> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">return</span> <span class="n">UnitOfWork</span><span class="p">.</span><span class="n">Get</span><span class="p">&lt;</span><span class="n">TEntity</span><span class="p">&gt;().</span><span class="n">SingleOrDefault</span><span class="p">(</span><span class="n">t</span> <span class="p">=&gt;</span> <span class="p">((</span><span class="kt">dynamic</span><span class="p">)</span> <span class="n">t</span><span class="p">).</span><span class="n">Id</span> <span class="p">==</span> <span class="n">id</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a> <span class="p">}</span> </span></pre></div> </td></tr></table>
repository

Bash

Install EPEL repository (64 bit)

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
https://snipt.net/embed/d50b38c7eb8eeb093e6656962040b6c2/
https://snipt.net/raw/d50b38c7eb8eeb093e6656962040b6c2/
d50b38c7eb8eeb093e6656962040b6c2
bash
Bash
1
2016-12-04T15:36:24
True
False
False
/api/public/snipt/24379/
install-epel-repository-64-bit
<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>rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm </span></pre></div> </td></tr></table>
administration, centos, linux, repository, server, yum

Bash

Install Package using Yum without Adding Repository

# Install a package using yum without permanently adding/enabling the repo.
yum --enablerepo=reponame install packagename
https://snipt.net/embed/4e7aa76b79fc91dc88928c825fb02342/
https://snipt.net/raw/4e7aa76b79fc91dc88928c825fb02342/
4e7aa76b79fc91dc88928c825fb02342
bash
Bash
2
2016-12-05T05:40:50
True
False
False
/api/public/snipt/22361/
install-package-using-yum-without-adding-repository
<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"># Install a package using yum without permanently adding/enabling the repo.</span> </span><span id="L-2"><a name="L-2"></a>yum --enablerepo<span class="o">=</span>reponame install packagename </span></pre></div> </td></tr></table>
centos, linux, repository, yum

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/
https://snipt.net/raw/d8d74718b12f9a51c299d2a619db73c8/
d8d74718b12f9a51c299d2a619db73c8
bash
Bash
8
2016-12-05T02:57:58
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
Copyrighted, illegal, or inappropriate content? Email [email protected].