snipt

Ctrl+h for KB shortcuts
Sign up for : store and share your own code snippets.
#67180

Shell 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
Shell Session
1
2015-02-27T19:27:04
True
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 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
#66472

Batchfile

fuh.bat

1
2
3
4
5
:: Fix issue where hidden folders can not be unhidden, because of a malware execution.
:: -----------------------------------------------------------------------------------
:: http://mybroadband.co.za/vb/showthread.php/352368-Can-t-quot-UNHIDE-quot-Hidden-files?s=2178d779b3dcb064b2b7b00e30e7c907&p=6535122&viewfull=1#post6535122
@echo off
attrib /S /D *.* -s -r -h
https://snipt.net/embed/c93bb303b469fabd56fbc22934d6c284/
https://snipt.net/raw/c93bb303b469fabd56fbc22934d6c284/
c93bb303b469fabd56fbc22934d6c284
bat
Batchfile
5
2015-02-26T19:37:24
True
False
/api/public/snipt/66472/
fuhbat
<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 id="L-1"><a name="L-1"></a><span class="c">:: Fix issue where hidden folders can not be unhidden, because of a malware execution.</span> </span><span id="L-2"><a name="L-2"></a><span class="c">:: -----------------------------------------------------------------------------------</span> </span><span id="L-3"><a name="L-3"></a><span class="c">:: http://mybroadband.co.za/vb/showthread.php/352368-Can-t-quot-UNHIDE-quot-Hidden-files?s=2178d779b3dcb064b2b7b00e30e7c907&amp;p=6535122&amp;viewfull=1#post6535122</span> </span><span id="L-4"><a name="L-4"></a><span class="p">@</span><span class="k">echo</span> <span class="k">off</span> </span><span id="L-5"><a name="L-5"></a>attrib <span class="n">/S</span> <span class="n">/D</span> *.* -s -r -h </span></pre></div> </td></tr></table>
"file system", "flash drive", directory, fix, malware, pendrive
#66239

Shell Session

wp.sh

1
2
3
4
5
6
# Finds out in which partition (wp) a given file/dir resides.
# Defaults to working directory.
# -----------------------------------------------------------
# http://snipt.net/metalcoder/wpsh
file=${1-.}
df -P $file | tail -1 | cut -d' ' -f 1
https://snipt.net/embed/e2057f158fa6f571e2f799aace9f8489/
https://snipt.net/raw/e2057f158fa6f571e2f799aace9f8489/
e2057f158fa6f571e2f799aace9f8489
shell-session
Shell Session
7
2015-03-04T18:26:13
True
False
/api/public/snipt/66239/
wpsh
<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 id="L-1"><a name="L-1"></a><span class="go"># Finds out in which partition (wp) a given file/dir resides.</span> </span><span id="L-2"><a name="L-2"></a><span class="go"># Defaults to working directory.</span> </span><span id="L-3"><a name="L-3"></a><span class="go"># -----------------------------------------------------------</span> </span><span id="L-4"><a name="L-4"></a><span class="go"># http://snipt.net/metalcoder/wpsh</span> </span><span id="L-5"><a name="L-5"></a><span class="go">file=${1-.}</span> </span><span id="L-6"><a name="L-6"></a><span class="go">df -P $file | tail -1 | cut -d&#39; &#39; -f 1</span> </span></pre></div> </td></tr></table>
file-system, linux, shellscript, sysadmin, unix
Copyrighted, illegal, or inappropriate content? Email [email protected].