snipt

Ctrl+h for KB shortcuts

Bash

sublime settings synced with dropbox

1
2
3
$ mv ~/Library/Application\ Support/Sublime\ Text\ 3 /path/to/cloud
$ ln -s /path/to/cloud/Sublime\ Text\ 3 ~/Library/Application\ Support/Sublime\ Text\ 3
reply
https://snipt.net/embed/1b33f3e9b0ec4e7649d3c34f5444fb7f/
/raw/1b33f3e9b0ec4e7649d3c34f5444fb7f/
1b33f3e9b0ec4e7649d3c34f5444fb7f
bash
Bash
5
2019-06-13T20:23:17
True
False
False
Feb 14, 2014 at 11:02 PM
/api/public/snipt/113887/
sublime-settings-synced-with-dropbox
<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>$ mv ~/Library/Application<span class="se">\ </span>Support/Sublime<span class="se">\ </span>Text<span class="se">\ </span><span class="m">3</span> /path/to/cloud </span><span id="L-2"><a name="L-2"></a>$ ln -s /path/to/cloud/Sublime<span class="se">\ </span>Text<span class="se">\ </span><span class="m">3</span> ~/Library/Application<span class="se">\ </span>Support/Sublime<span class="se">\ </span>Text<span class="se">\ </span>3 </span><span id="L-3"><a name="L-3"></a>reply </span></pre></div> </td></tr></table>
bash, dropbox, editor, osx, sublime

Bash

Rename file to mayus (not extension)

for i in *.mdf; do ext=${i##*.}; name=$(basename "$i" ".$ext" | tr '[a-z]' '[A-Z]').$ext; cp $i ./mayus/$name; done 
https://snipt.net/embed/5b9087816addb06c2676af80b8db0c73/
/raw/5b9087816addb06c2676af80b8db0c73/
5b9087816addb06c2676af80b8db0c73
bash
Bash
1
2019-05-12T10:53:45
True
False
False
/api/public/snipt/113351/
rename-file-to-mayus-not-extension
<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="k">for</span> i in *.mdf<span class="p">;</span> <span class="k">do</span> <span class="nv">ext</span><span class="o">=</span><span class="si">${</span><span class="nv">i</span><span class="p">##*.</span><span class="si">}</span><span class="p">;</span> <span class="nv">name</span><span class="o">=</span><span class="k">$(</span>basename <span class="s2">&quot;</span><span class="nv">$i</span><span class="s2">&quot;</span> <span class="s2">&quot;.</span><span class="nv">$ext</span><span class="s2">&quot;</span> <span class="p">|</span> tr <span class="s1">&#39;[a-z]&#39;</span> <span class="s1">&#39;[A-Z]&#39;</span><span class="k">)</span>.<span class="nv">$ext</span><span class="p">;</span> cp <span class="nv">$i</span> ./mayus/<span class="nv">$name</span><span class="p">;</span> <span class="k">done</span> </span></pre></div> </td></tr></table>
bash

Bash

diff output from bash commands

$ diff -u <(curl seanomlor.com/demo/asteroids/index.html) <(curl seanomlor.com/demo/snake/index.html)
https://snipt.net/embed/257f895154039f9080e8ed3916e4fd8d/
/raw/257f895154039f9080e8ed3916e4fd8d/
257f895154039f9080e8ed3916e4fd8d
bash
Bash
2
2019-06-18T21:03:59
True
False
False
Feb 08, 2014 at 01:26 AM
/api/public/snipt/111880/
diff-output-from-bash-commands
<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>$ diff -u &lt;<span class="o">(</span>curl seanomlor.com/demo/asteroids/index.html<span class="o">)</span> &lt;<span class="o">(</span>curl seanomlor.com/demo/snake/index.html<span class="o">)</span> </span></pre></div> </td></tr></table>
bash, curl, diff

Text only

Swapping file names Using a bash function

1
2
3
4
function swap_file() {
    TMP_NAME="TMP_$RANDOM"
    mv "$1" "/tmp/$TMP_NAME" && mv "$2" "$1" && mv "/tmp/$TMP_NAME" "$2"
}
https://snipt.net/embed/dd5d1ca34c5cad8fc47329dad6281672/
/raw/dd5d1ca34c5cad8fc47329dad6281672/
dd5d1ca34c5cad8fc47329dad6281672
text
Text only
4
2016-12-29T03:22:26
True
False
True
Feb 04, 2014 at 05:54 AM
/api/public/snipt/110730/
swapping-file-names-using-a-bash-function
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>function swap_file() { </span><span id="L-2"><a name="L-2"></a> TMP_NAME=&quot;TMP_$RANDOM&quot; </span><span id="L-3"><a name="L-3"></a> mv &quot;$1&quot; &quot;/tmp/$TMP_NAME&quot; &amp;&amp; mv &quot;$2&quot; &quot;$1&quot; &amp;&amp; mv &quot;/tmp/$TMP_NAME&quot; &quot;$2&quot; </span><span id="L-4"><a name="L-4"></a>} </span></pre></div> </td></tr></table>
bash

Bash

workaround failed 'brew update'

1
2
3
4
cd `brew --prefix`
git remote add origin https://github.com/mxcl/homebrew.git
git fetch origin
git reset --hard origin/master
https://snipt.net/embed/950cad4515e75bcf1279170f5214aba4/
/raw/950cad4515e75bcf1279170f5214aba4/
950cad4515e75bcf1279170f5214aba4
bash
Bash
4
2019-06-08T10:17:55
True
False
False
Jan 17, 2014 at 03:28 AM
/api/public/snipt/106483/
workaround-failed-brew-update
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">cd</span> <span class="sb">`</span>brew --prefix<span class="sb">`</span> </span><span id="L-2"><a name="L-2"></a>git remote add origin https://github.com/mxcl/homebrew.git </span><span id="L-3"><a name="L-3"></a>git fetch origin </span><span id="L-4"><a name="L-4"></a>git reset --hard origin/master </span></pre></div> </td></tr></table>
bash, brew, git

Bash

Copy directory structure

cd /source/dir
( cd /destination/dir/; sudo find . -depth -type d ! -name . -print0 ) | xargs -0 mkdir -p
https://snipt.net/embed/218cdc121a23332b57466b390fd9d4b6/
/raw/218cdc121a23332b57466b390fd9d4b6/
218cdc121a23332b57466b390fd9d4b6
bash
Bash
2
2019-06-03T04:57:33
True
False
False
/api/public/snipt/103904/
copy-directory-structure
<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="nb">cd</span> /source/dir </span><span id="L-2"><a name="L-2"></a><span class="o">(</span> <span class="nb">cd</span> /destination/dir/<span class="p">;</span> sudo find . -depth -type d ! -name . -print0 <span class="o">)</span> <span class="p">|</span> xargs -0 mkdir -p </span></pre></div> </td></tr></table>
bash, mass

Bash

Watch a real 3D movie in 2D with MPlayer

mplayer <VIDEO_FILE> -vo gl:stereo=3
https://snipt.net/embed/11c192fc1ffbad4aff016669c8578b23/
/raw/11c192fc1ffbad4aff016669c8578b23/
11c192fc1ffbad4aff016669c8578b23
bash
Bash
1
2019-06-18T05:12:35
True
False
False
Dec 02, 2013 at 07:48 AM
/api/public/snipt/97932/
watch-a-real-3d-movie-in-2d-with-mplayer
<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>mplayer &lt;VIDEO_FILE&gt; -vo gl:stereo<span class="o">=</span>3 </span></pre></div> </td></tr></table>
2d, 3d, bash, movie, mplayer, video