snipt

Ctrl+h for KB shortcuts

Bash

add newlines to one-line xml string

sed 's/\(<\/[a-zA-Z0-9]*>\)/\1\
/g'
https://snipt.net/embed/ef54209ac6189b5143e415f98ea033e0/
/raw/ef54209ac6189b5143e415f98ea033e0/
ef54209ac6189b5143e415f98ea033e0
bash
Bash
2
2019-06-25T15:07:43
True
False
False
/api/public/snipt/217/
add-newlines-to-one-line-xml-string
<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>sed <span class="s1">&#39;s/\(&lt;\/[a-zA-Z0-9]*&gt;\)/\1\</span> </span><span id="L-2"><a name="L-2"></a><span class="s1">/g&#39;</span> </span></pre></div> </td></tr></table>
bash, newline, sed, xml

Bash

Add all files marked as '?'

svn status |grep '^?' |sed 's/^?      /svn add "/g' |sed 's/$/"/g' |sh
https://snipt.net/embed/f9f5bfa0d39c724b60f27b7dda0a0650/
/raw/f9f5bfa0d39c724b60f27b7dda0a0650/
f9f5bfa0d39c724b60f27b7dda0a0650
bash
Bash
1
2019-06-22T23:51:08
True
False
False
/api/public/snipt/209/
add-all-files-marked-as
<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 status <span class="p">|</span>grep <span class="s1">&#39;^?&#39;</span> <span class="p">|</span>sed <span class="s1">&#39;s/^? /svn add &quot;/g&#39;</span> <span class="p">|</span>sed <span class="s1">&#39;s/$/&quot;/g&#39;</span> <span class="p">|</span>sh </span></pre></div> </td></tr></table>
svn

Bash

Delete all files marked as '!'

svn status |grep '^!' |sed 's/^!      /svn delete "/g' |sed 's/$/"/g' |sh
https://snipt.net/embed/38bb1c28d1998e0357ef01c799027a61/
/raw/38bb1c28d1998e0357ef01c799027a61/
38bb1c28d1998e0357ef01c799027a61
bash
Bash
1
2019-06-26T08:14:55
True
False
False
/api/public/snipt/208/
delete-all-files-marked-as
<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 status <span class="p">|</span>grep <span class="s1">&#39;^!&#39;</span> <span class="p">|</span>sed <span class="s1">&#39;s/^! /svn delete &quot;/g&#39;</span> <span class="p">|</span>sed <span class="s1">&#39;s/$/&quot;/g&#39;</span> <span class="p">|</span>sh </span></pre></div> </td></tr></table>
svn

Bash

raid drives status check

mdadm --query --detail /dev/md1
https://snipt.net/embed/24ab27e4c5e18f6957d22cf3c8a19515/
/raw/24ab27e4c5e18f6957d22cf3c8a19515/
24ab27e4c5e18f6957d22cf3c8a19515
bash
Bash
1
2019-06-25T14:10:42
True
False
False
/api/public/snipt/180/
raid-drives-status-check
<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>mdadm --query --detail /dev/md1 </span></pre></div> </td></tr></table>
raid

Bash

cisco vpn client restart on mac os x

sudo /System/Library/StartupItems/CiscoVPN/CiscoVPN restart
https://snipt.net/embed/0ce68bbb0af1d55101b5e808fe12c772/
/raw/0ce68bbb0af1d55101b5e808fe12c772/
0ce68bbb0af1d55101b5e808fe12c772
bash
Bash
1
2019-06-24T19:16:17
True
False
False
/api/public/snipt/135/
cisco-vpn-client-restart-on-mac-os-x
<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>sudo /System/Library/StartupItems/CiscoVPN/CiscoVPN restart </span></pre></div> </td></tr></table>
cisco, osx, vpn

PHP

providing node templates in a module directory

1
2
3
4
5
6
7
<?php

function mymodule_theme_registry_alter(&$theme_registry) {
  $theme_hook = 'node';
  $modulepath = drupal_get_path('module', 'mymodule');
  array_unshift($theme_registry[$theme_hook]['theme paths'], $modulepath);
}
https://snipt.net/embed/ded0a5f2411a2d6a83824a3d7f70a17d/
/raw/ded0a5f2411a2d6a83824a3d7f70a17d/
ded0a5f2411a2d6a83824a3d7f70a17d
php
PHP
8
2019-06-24T23:40:11
True
False
False
/api/public/snipt/72/
providing-node-templates-in-a-module-directory
<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> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="k">function</span> <span class="nf">mymodule_theme_registry_alter</span><span class="p">(</span><span class="o">&amp;</span><span class="nv">$theme_registry</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-4"><a name="L-4"></a> <span class="nv">$theme_hook</span> <span class="o">=</span> <span class="s1">&#39;node&#39;</span><span class="p">;</span> </span><span id="L-5"><a name="L-5"></a> <span class="nv">$modulepath</span> <span class="o">=</span> <span class="nx">drupal_get_path</span><span class="p">(</span><span class="s1">&#39;module&#39;</span><span class="p">,</span> <span class="s1">&#39;mymodule&#39;</span><span class="p">);</span> </span><span id="L-6"><a name="L-6"></a> <span class="nb">array_unshift</span><span class="p">(</span><span class="nv">$theme_registry</span><span class="p">[</span><span class="nv">$theme_hook</span><span class="p">][</span><span class="s1">&#39;theme paths&#39;</span><span class="p">],</span> <span class="nv">$modulepath</span><span class="p">);</span> </span><span id="L-7"><a name="L-7"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
"node template", "theme registry", drupal

Bash

svn delete all files marked for deletion

svn status |grep '^!' |sed 's/^!      /svn delete "/g' |sed 's/$/"/g' |sh
https://snipt.net/embed/13be4cf6c9164f255653122f1f9bad8d/
/raw/13be4cf6c9164f255653122f1f9bad8d/
13be4cf6c9164f255653122f1f9bad8d
bash
Bash
1
2019-06-23T00:12:22
True
False
False
/api/public/snipt/69/
svn-delete-all-files-marked-for-deletion
<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 status <span class="p">|</span>grep <span class="s1">&#39;^!&#39;</span> <span class="p">|</span>sed <span class="s1">&#39;s/^! /svn delete &quot;/g&#39;</span> <span class="p">|</span>sed <span class="s1">&#39;s/$/&quot;/g&#39;</span> <span class="p">|</span>sh </span></pre></div> </td></tr></table>
subversion

Bash

svn add all files marked for add

svn status |grep '^?' |sed 's/^?      /svn add "/g' |sed 's/$/"/g' |sh
https://snipt.net/embed/d08a99d87660f35353d5fb6cd0f1b15b/
/raw/d08a99d87660f35353d5fb6cd0f1b15b/
d08a99d87660f35353d5fb6cd0f1b15b
bash
Bash
1
2019-06-23T05:31:26
True
False
False
/api/public/snipt/68/
svn-add-all-files-marked-for-add
<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 status <span class="p">|</span>grep <span class="s1">&#39;^?&#39;</span> <span class="p">|</span>sed <span class="s1">&#39;s/^? /svn add &quot;/g&#39;</span> <span class="p">|</span>sed <span class="s1">&#39;s/$/&quot;/g&#39;</span> <span class="p">|</span>sh </span></pre></div> </td></tr></table>
subversion