Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

JavaScript

SlimTimmer - Open Timer to the top right

javascript:newwindow=window.open('http://slimtimer.com/client/','slimtimer','resizable=1,toolbar=0,location=0,status=1,menubar=0,scrollbars=1,width=175,height=700,left=2400,top=20');newwindow.focus();
https://snipt.net/embed/4424f42ed6e1f81508f5693959d37003/
https://snipt.net/raw/4424f42ed6e1f81508f5693959d37003/
4424f42ed6e1f81508f5693959d37003
js
JavaScript
1
2016-12-10T05:41:28
True
False
False
May 14, 2013 at 10:23 AM
/api/public/snipt/61299/
slimtimmer-open-timer-to-the-top-right
<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="nx">javascript</span><span class="o">:</span><span class="nx">newwindow</span><span class="o">=</span><span class="nb">window</span><span class="p">.</span><span class="nx">open</span><span class="p">(</span><span class="s1">&#39;http://slimtimer.com/client/&#39;</span><span class="p">,</span><span class="s1">&#39;slimtimer&#39;</span><span class="p">,</span><span class="s1">&#39;resizable=1,toolbar=0,location=0,status=1,menubar=0,scrollbars=1,width=175,height=700,left=2400,top=20&#39;</span><span class="p">);</span><span class="nx">newwindow</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span> </span></pre></div> </td></tr></table>
"time tracking", "work tool", bunny, open, position, slimtimer, timer, window

Bash

Open man pages graphically. Requires bwana.

1
2
3
	function man {
		open "man:$*"
	}
https://snipt.net/embed/b529f7b54bee876b021e77c265a888d8/
https://snipt.net/raw/b529f7b54bee876b021e77c265a888d8/
b529f7b54bee876b021e77c265a888d8
bash
Bash
3
2016-11-18T17:15:58
True
False
False
/api/public/snipt/30227/
open-man-pages-graphically-requires-bwana
<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">function</span> man <span class="o">{</span> </span><span id="L-2"><a name="L-2"></a> open <span class="s2">&quot;man:</span><span class="nv">$*</span><span class="s2">&quot;</span> </span><span id="L-3"><a name="L-3"></a> <span class="o">}</span> </span></pre></div> </td></tr></table>
bwana, graphical, man, open

Java

open xml document with JDOM

1
2
3
4
5
6
// Build the document with SAX and Xerces, no validation
SAXBuilder builder = new SAXBuilder();
// Create the document
Document doc = (Document) builder.build(file);
// Output the document, use standard formatter
Element root = doc.getRootElement();
https://snipt.net/embed/5764e8a5cab74aa2aea1046bbfb71408/
https://snipt.net/raw/5764e8a5cab74aa2aea1046bbfb71408/
5764e8a5cab74aa2aea1046bbfb71408
java
Java
6
2016-11-25T11:46:41
True
False
False
/api/public/snipt/11843/
open-xml-document-with-jdom
<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">// Build the document with SAX and Xerces, no validation</span> </span><span id="L-2"><a name="L-2"></a><span class="n">SAXBuilder</span> <span class="n">builder</span> <span class="o">=</span> <span class="k">new</span> <span class="n">SAXBuilder</span><span class="o">();</span> </span><span id="L-3"><a name="L-3"></a><span class="c1">// Create the document</span> </span><span id="L-4"><a name="L-4"></a><span class="n">Document</span> <span class="n">doc</span> <span class="o">=</span> <span class="o">(</span><span class="n">Document</span><span class="o">)</span> <span class="n">builder</span><span class="o">.</span><span class="na">build</span><span class="o">(</span><span class="n">file</span><span class="o">);</span> </span><span id="L-5"><a name="L-5"></a><span class="c1">// Output the document, use standard formatter</span> </span><span id="L-6"><a name="L-6"></a><span class="n">Element</span> <span class="n">root</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="na">getRootElement</span><span class="o">();</span> </span></pre></div> </td></tr></table>
document, jdom, open

Bash

counting open apache connections

netstat -an | grep :80 | wc -l 
https://snipt.net/embed/aa4a7df7d5507a25361df3a0920f032f/
https://snipt.net/raw/aa4a7df7d5507a25361df3a0920f032f/
aa4a7df7d5507a25361df3a0920f032f
bash
Bash
1
2016-12-10T08:53:54
True
False
False
/api/public/snipt/9074/
counting-open-apache-connections
<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>netstat -an <span class="p">|</span> grep :80 <span class="p">|</span> wc -l </span></pre></div> </td></tr></table>
apache, connections, open

Bash

amount of file handlers | ? | total allowed

cat /proc/sys/fs/file-nr 
https://snipt.net/embed/2fb96ee8630083b72c9477822d161540/
https://snipt.net/raw/2fb96ee8630083b72c9477822d161540/
2fb96ee8630083b72c9477822d161540
bash
Bash
1
2016-12-10T03:08:15
True
False
False
/api/public/snipt/6447/
amount-of-file-handlers-total-allowed
<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>cat /proc/sys/fs/file-nr </span></pre></div> </td></tr></table>
bash, files, list, lsof, of, open

Bash

max for lsof

cat /proc/sys/fs/file-max 
https://snipt.net/embed/2c971c605eb1597ba0413e38ca4fa8ee/
https://snipt.net/raw/2c971c605eb1597ba0413e38ca4fa8ee/
2c971c605eb1597ba0413e38ca4fa8ee
bash
Bash
1
2016-12-09T10:47:07
True
False
False
/api/public/snipt/6446/
max-for-lsof
<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>cat /proc/sys/fs/file-max </span></pre></div> </td></tr></table>
bash, files, list, lsof, open

Bash

list open files

lsof | awk '{print $1}' | sort | uniq -c
https://snipt.net/embed/02dc9fb5c844190160b7fc39c6fce2ee/
https://snipt.net/raw/02dc9fb5c844190160b7fc39c6fce2ee/
02dc9fb5c844190160b7fc39c6fce2ee
bash
Bash
1
2016-11-25T12:55:05
True
False
False
/api/public/snipt/5975/
list-open-files
<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>lsof <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span> <span class="p">|</span> sort <span class="p">|</span> uniq -c </span></pre></div> </td></tr></table>
files, lsof, numfile, open

Java

Abrir ficheiro atraves com Java

Desktop desktop =Desktop.getDesktop();
desktop.open(new File("e:\\teste.txt"));
https://snipt.net/embed/db67bfaaf0dda8448a180d874066b7ce/
https://snipt.net/raw/db67bfaaf0dda8448a180d874066b7ce/
db67bfaaf0dda8448a180d874066b7ce
java
Java
2
2016-12-09T23:42:26
True
False
False
/api/public/snipt/798/
abrir-ficheiro-atraves-com-java
<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="n">Desktop</span> <span class="n">desktop</span> <span class="o">=</span><span class="n">Desktop</span><span class="o">.</span><span class="na">getDesktop</span><span class="o">();</span> </span><span id="L-2"><a name="L-2"></a><span class="n">desktop</span><span class="o">.</span><span class="na">open</span><span class="o">(</span><span class="k">new</span> <span class="n">File</span><span class="o">(</span><span class="s">&quot;e:\\teste.txt&quot;</span><span class="o">));</span> </span></pre></div> </td></tr></table>
file, java, open
Copyrighted, illegal, or inappropriate content? Email [email protected].