Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

Mac OSX Environment Variable For GUI apps

1
2
3
# To set ENV variables for GUI apps, use `launchctl setenv`
export YOUR_VAR="Hello World!"
launchctl setenv YOUR_VAR $YOUR_VAR
https://snipt.net/embed/473e39fae887f52ae1ac675720b86b8f/
https://snipt.net/raw/473e39fae887f52ae1ac675720b86b8f/
473e39fae887f52ae1ac675720b86b8f
bash
Bash
4
2016-12-07T03:59:02
True
False
False
May 24, 2015 at 07:25 AM
/api/public/snipt/139576/
mac-osx-environment-variable-for-gui-apps-7347322b
<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="c1"># To set ENV variables for GUI apps, use `launchctl setenv`</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">export</span> <span class="nv">YOUR_VAR</span><span class="o">=</span><span class="s2">&quot;Hello World!&quot;</span> </span><span id="L-3"><a name="L-3"></a>launchctl setenv YOUR_VAR <span class="nv">$YOUR_VAR</span> </span></pre></div> </td></tr></table>
env, osx, shell

Bash

Useful bash command snippets

1
2
3
4
5
6
# Clean all dirs that have mvn builds in them to 
# recover space taken up by /target dirs that are not used
for foo in *; do cd $foo; mvn clean; cd ..; done

# clean all SNAPSHOT items from the local maven repo
cd .m2/repository && find . -name '*-SNAPSHOT' -print0 | xargs -0 rm -rf
https://snipt.net/embed/b52b012c361bfbb20511292c266400c9/
https://snipt.net/raw/b52b012c361bfbb20511292c266400c9/
b52b012c361bfbb20511292c266400c9
bash
Bash
6
2016-12-07T03:59:21
True
False
False
/api/public/snipt/136637/
useful-bash-command-snippets-3c6e6349
<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"># Clean all dirs that have mvn builds in them to </span> </span><span id="L-2"><a name="L-2"></a><span class="c1"># recover space taken up by /target dirs that are not used</span> </span><span id="L-3"><a name="L-3"></a><span class="k">for</span> foo in *<span class="p">;</span> <span class="k">do</span> <span class="nb">cd</span> <span class="nv">$foo</span><span class="p">;</span> mvn clean<span class="p">;</span> <span class="nb">cd</span> ..<span class="p">;</span> <span class="k">done</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="c1"># clean all SNAPSHOT items from the local maven repo</span> </span><span id="L-6"><a name="L-6"></a><span class="nb">cd</span> .m2/repository <span class="o">&amp;&amp;</span> find . -name <span class="s1">&#39;*-SNAPSHOT&#39;</span> -print0 <span class="p">|</span> xargs -0 rm -rf </span></pre></div> </td></tr></table>
bash, cleanup, maven, shell

Text only

Oracle - Shell

1
2
3
#I came up with a situation where i need to append @ and PATH at th starting of the all files that are modified on particular day here what i did

ls -lt|grep "Sep 24" | awk '{print $9}'|sed 's/^/@\/Users\/chakri\/projects\//g'
https://snipt.net/embed/202975296bec91de33b644019acb13a3/
https://snipt.net/raw/202975296bec91de33b644019acb13a3/
202975296bec91de33b644019acb13a3
text
Text only
3
2016-12-04T03:11:09
True
False
False
/api/public/snipt/83044/
oracle-shell
<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>#I came up with a situation where i need to append @ and PATH at th starting of the all files that are modified on particular day here what i did </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>ls -lt|grep &quot;Sep 24&quot; | awk &#39;{print $9}&#39;|sed &#39;s/^/@\/Users\/chakri\/projects\//g&#39; </span></pre></div> </td></tr></table>
bash, oracle, shell

Bash

svn update with no interaction and accept certificate from cli

svn up --username <user> --password <psw> --non-interactive --trust-server-cert
https://snipt.net/embed/8ee9a30e7f44092e596ab7820a8c1502/
https://snipt.net/raw/8ee9a30e7f44092e596ab7820a8c1502/
8ee9a30e7f44092e596ab7820a8c1502
bash
Bash
1
2016-12-05T05:14:07
True
False
False
Jul 19, 2013 at 09:24 AM
/api/public/snipt/68603/
svn-update-with-no-interaction-and-accept-certificate-from-cli
<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>svn up --username &lt;user&gt; --password &lt;psw&gt; --non-interactive --trust-server-cert </span></pre></div> </td></tr></table>
accept, certificate, cli, command, line, linux, shell, svn, up, update

Bash Session

Emoticon approval on Linux prompt

   PS1="\`if [ \$? = 0 ]; then echo -e '\[\e[01;32m\]:) '; else echo -e '\[\e[01;31m\]:( '; fi\`\[\e[m\]"
https://snipt.net/embed/bfdf196422206fd3d2788f1c915404fa/
https://snipt.net/raw/bfdf196422206fd3d2788f1c915404fa/
bfdf196422206fd3d2788f1c915404fa
shell-session
Bash Session
1
2016-12-02T13:29:41
True
False
False
/api/public/snipt/67180/
emoticon-approval-on-linux-prompt
<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="go"> PS1=&quot;\`if [ \$? = 0 ]; then echo -e &#39;\[\e[01;32m\]:) &#39;; else echo -e &#39;\[\e[01;31m\]:( &#39;; fi\`\[\e[m\]&quot;</span> </span></pre></div> </td></tr></table>
linux, prompt, shell
Copyrighted, illegal, or inappropriate content? Email [email protected].