Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

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-07T08:30:55
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

SQL

Criteria for PSFT Query to default to current date when entering 1900/01/01

decode(:1,TO_DATE('1900-01-01','YYYY-MM-DD'),trunc(sysdate),:1)
https://snipt.net/embed/446fac0a92c6355ab7a8bf01b70d065e/
https://snipt.net/raw/446fac0a92c6355ab7a8bf01b70d065e/
446fac0a92c6355ab7a8bf01b70d065e
sql
SQL
1
2016-12-06T20:30:49
True
False
False
/api/public/snipt/42763/
criteria-for-psft-query-to-default-to-current-date-when-entering-19000101
<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="n">decode</span><span class="p">(:</span><span class="mi">1</span><span class="p">,</span><span class="n">TO_DATE</span><span class="p">(</span><span class="s1">&#39;1900-01-01&#39;</span><span class="p">,</span><span class="s1">&#39;YYYY-MM-DD&#39;</span><span class="p">),</span><span class="n">trunc</span><span class="p">(</span><span class="n">sysdate</span><span class="p">),:</span><span class="mi">1</span><span class="p">)</span> </span></pre></div> </td></tr></table>
criteria, currentdate, date, peoplesoft, peopletools, prompt

Bash

shell prompt

# Shell Prompt with git and rvm status
export PS1="\w\$(__git_ps1) \$(~/.rvm/bin/rvm-prompt)\$ "
https://snipt.net/embed/ff820329c3f58d657e78b79e9c1b4ba2/
https://snipt.net/raw/ff820329c3f58d657e78b79e9c1b4ba2/
ff820329c3f58d657e78b79e9c1b4ba2
bash
Bash
2
2016-12-06T05:21:38
True
False
False
/api/public/snipt/20010/
shell-prompt
<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"># Shell Prompt with git and rvm status</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">export</span> <span class="nv">PS1</span><span class="o">=</span><span class="s2">&quot;\w\$(__git_ps1) \$(~/.rvm/bin/rvm-prompt)\$ &quot;</span> </span></pre></div> </td></tr></table>
prompt

Bash

Coloring console prompt

1
2
3
4
5
$> echo "PS1='\[\033[01;37;43m\]\u@\h\[\033[00m\]:\[\033[01;37;42m\]\w\[\033[00m\]\$ '" >> ~/.bashrc
$> source ~/.bashrc

# info about colors
$> dircolors --print-database
https://snipt.net/embed/8e906b4689e535210cb1fbea20e2caa9/
https://snipt.net/raw/8e906b4689e535210cb1fbea20e2caa9/
8e906b4689e535210cb1fbea20e2caa9
bash
Bash
5
2016-11-25T13:14:37
True
False
False
/api/public/snipt/6356/
coloring-console-prompt
<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>$&gt; <span class="nb">echo</span> <span class="s2">&quot;PS1=&#39;\[\033[01;37;43m\]\u@\h\[\033[00m\]:\[\033[01;37;42m\]\w\[\033[00m\]\$ &#39;&quot;</span> &gt;&gt; ~/.bashrc </span><span id="L-2"><a name="L-2"></a>$&gt; <span class="nb">source</span> ~/.bashrc </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># info about colors</span> </span><span id="L-5"><a name="L-5"></a>$&gt; dircolors --print-database </span></pre></div> </td></tr></table>
color, linux, prompt

Bash

Fancy Git prompt

1
2
3
4
5
# The prompt
parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(git::\1)/'
}
export PS1="\[\033]0;\h \w \$(parse_git_branch) \007\][\[\033[01;35m\]\h \[\033[01;34m\]\w \[\033[31m\]\$(parse_git_branch)\[\033[00m\]]$ "
https://snipt.net/embed/0bf828fc9cf1d842a84379a241634f84/
https://snipt.net/raw/0bf828fc9cf1d842a84379a241634f84/
0bf828fc9cf1d842a84379a241634f84
bash
Bash
5
2016-12-07T00:11:25
True
False
False
/api/public/snipt/5026/
fancy-git-prompt
<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="c1"># The prompt</span> </span><span id="L-2"><a name="L-2"></a>parse_git_branch<span class="o">()</span> <span class="o">{</span> </span><span id="L-3"><a name="L-3"></a> git branch 2&gt; /dev/null <span class="p">|</span> sed -e <span class="s1">&#39;/^[^*]/d&#39;</span> -e <span class="s1">&#39;s/* \(.*\)/(git::\1)/&#39;</span> </span><span id="L-4"><a name="L-4"></a><span class="o">}</span> </span><span id="L-5"><a name="L-5"></a><span class="nb">export</span> <span class="nv">PS1</span><span class="o">=</span><span class="s2">&quot;\[\033]0;\h \w \$(parse_git_branch) \007\][\[\033[01;35m\]\h \[\033[01;34m\]\w \[\033[31m\]\$(parse_git_branch)\[\033[00m\]]</span>$<span class="s2"> &quot;</span> </span></pre></div> </td></tr></table>
git, prompt

Bash

bash prompt

[[email protected] ~]#
https://snipt.net/embed/4532987491384257c4a3a329688b81aa/
https://snipt.net/raw/4532987491384257c4a3a329688b81aa/
4532987491384257c4a3a329688b81aa
bash
Bash
1
2016-12-02T17:32:19
True
False
False
/api/public/snipt/2297/
bash-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="o">[</span>[email protected] ~<span class="o">]</span><span class="c1">#</span> </span></pre></div> </td></tr></table>
bash, prompt
Copyrighted, illegal, or inappropriate content? Email [email protected].