snipt

Ctrl+h for KB shortcuts

Python

absolute directory path in python

1
2
3
4
5
# Find current directory
DIR_ROOT = os.path.dirname(os.path.abspath(__file__))

# Absolute path for subfolder(s)
LOG_ROOT = os.path.join(DIR_ROOT, 'logs')
https://snipt.net/embed/c0504f2f7c262bc718291e7c9f59bc9e/
/raw/c0504f2f7c262bc718291e7c9f59bc9e/
c0504f2f7c262bc718291e7c9f59bc9e
python
Python
5
2019-08-19T00:53:03
True
False
False
/api/public/snipt/12842/
absolute-directory-path-in-python
<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"># Find current directory</span> </span><span id="L-2"><a name="L-2"></a><span class="n">DIR_ROOT</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">__file__</span><span class="p">))</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># Absolute path for subfolder(s)</span> </span><span id="L-5"><a name="L-5"></a><span class="n">LOG_ROOT</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">DIR_ROOT</span><span class="p">,</span> <span class="s1">&#39;logs&#39;</span><span class="p">)</span> </span></pre></div> </td></tr></table>
absolute, directory, os.path, path, python

Bash

Mediatemple (dv) server - Plesk & Apache restart

/usr/local/psa/admin/sbin/websrvmng -a -v
https://snipt.net/embed/64a52bf658113ac80b0e6ed360972556/
/raw/64a52bf658113ac80b0e6ed360972556/
64a52bf658113ac80b0e6ed360972556
bash
Bash
1
2019-08-18T20:09:01
True
False
False
/api/public/snipt/9993/
restart-mediatemple-dv-pleskapache
<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>/usr/local/psa/admin/sbin/websrvmng -a -v </span></pre></div> </td></tr></table>
apache, dv, mediatemple, plesk, restart

Bash

Recursively remove all .svn directories

find . -name .svn -exec rm -rf {} \;
https://snipt.net/embed/4d5067083443d01f068c98e625bdc459/
/raw/4d5067083443d01f068c98e625bdc459/
4d5067083443d01f068c98e625bdc459
bash
Bash
1
2019-08-15T23:47:31
True
False
False
/api/public/snipt/5615/
recursively-remove-all-svn-directories-1
<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>find . -name .svn -exec rm -rf <span class="o">{}</span> <span class="se">\;</span> </span></pre></div> </td></tr></table>
bash, osx, svn