snipt

Ctrl+h for KB shortcuts

Bash

find and delete files older than 15 minutes

$ find /path/to/files/*.json -type f -mmin +15 -delete
https://snipt.net/embed/526b8c150780e8fd47ad7b0adaac0e65/
https://snipt.net/raw/526b8c150780e8fd47ad7b0adaac0e65/
526b8c150780e8fd47ad7b0adaac0e65
bash
Bash
1
2016-02-05T14:21:11
True
False
/api/public/snipt/137461/
find-and-delete-files-older-than-15-minutes-e01e1c63
<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="nv">$ </span>find /path/to/files/*.json -type f -mmin +15 -delete </span></pre></div> </td></tr></table>
bash, delete, find, linux

Bash

Better Git log

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit"
https://snipt.net/embed/1feea14ac5545403b2027bbe7046b8a0/
https://snipt.net/raw/1feea14ac5545403b2027bbe7046b8a0/
1feea14ac5545403b2027bbe7046b8a0
bash
Bash
2
2016-02-05T12:42:49
True
False
Feb 24, 2014 at 11:00 AM
/api/public/snipt/116374/
better-git-log
<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>git config --global alias.lg <span class="s2">&quot;log --color --graph --pretty=format:&#39;%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)&lt;%an&gt;%Creset&#39; --abbrev-commit&quot;</span> </span></pre></div> </td></tr></table>
bash, git

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/
https://snipt.net/raw/1b33f3e9b0ec4e7649d3c34f5444fb7f/
1b33f3e9b0ec4e7649d3c34f5444fb7f
bash
Bash
5
2016-02-03T22:09:58
True
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 id="L-1"><a name="L-1"></a><span class="nv">$ </span>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><span class="nv">$ </span>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/
https://snipt.net/raw/5b9087816addb06c2676af80b8db0c73/
5b9087816addb06c2676af80b8db0c73
bash
Bash
1
2016-02-05T22:48:21
True
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 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/
https://snipt.net/raw/257f895154039f9080e8ed3916e4fd8d/
257f895154039f9080e8ed3916e4fd8d
bash
Bash
2
2016-02-03T00:48:11
True
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 id="L-1"><a name="L-1"></a><span class="nv">$ </span>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
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.