snipt

Ctrl+h for KB shortcuts

Bash

Shows svn check ins for a specific user in a certain date range.

$ svn log -r {2009-07-09}:{2007-08-17}  | grep -a3 <username>
https://snipt.net/embed/401c7821dc62f278d5f07f55a06e0469/
/raw/401c7821dc62f278d5f07f55a06e0469/
401c7821dc62f278d5f07f55a06e0469
bash
Bash
1
2019-08-21T08:27:12
True
False
False
/api/public/snipt/7334/
shows-svn-check-ins-for-a-specific-user-in-a-certain-date-range
<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 log -r <span class="o">{</span>2009-07-09<span class="o">}</span>:<span class="o">{</span>2007-08-17<span class="o">}</span> <span class="p">|</span> grep -a3 &lt;username&gt; </span></pre></div> </td></tr></table>
date, log, range, svn, username

Bash

Changing only file or folder permissions recursively in OS X

1
2
3
4
5
# for files only
$find ./ -type f -exec chmod 644 {} +

# for directories only
$find ./ -type d -exec chmod 644 {} +
https://snipt.net/embed/ee7d6a1f25d4bfed4e20c6bc42b95b8e/
/raw/ee7d6a1f25d4bfed4e20c6bc42b95b8e/
ee7d6a1f25d4bfed4e20c6bc42b95b8e
bash
Bash
5
2019-08-23T15:17:25
True
False
False
/api/public/snipt/5351/
changing-only-file-or-folder-permissions-recursively-in-os-x
<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"># for files only</span> </span><span id="L-2"><a name="L-2"></a><span class="nv">$find</span> ./ -type f -exec chmod <span class="m">644</span> <span class="o">{}</span> + </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># for directories only</span> </span><span id="L-5"><a name="L-5"></a><span class="nv">$find</span> ./ -type d -exec chmod <span class="m">644</span> <span class="o">{}</span> + </span></pre></div> </td></tr></table>
bash, file, folder, osx, permissions

Bash

How to flush DNS in OS X

1
2
3
# flash dns

$ dscacheutil -flushcache
https://snipt.net/embed/f629d79f3fdd704b54a7badc2667feb3/
/raw/f629d79f3fdd704b54a7badc2667feb3/
f629d79f3fdd704b54a7badc2667feb3
bash
Bash
3
2019-08-19T12:05:49
True
False
False
/api/public/snipt/4836/
how-to-flush-dns-in-os-x
<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><span class="c1"># flash dns</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>$ dscacheutil -flushcache </span></pre></div> </td></tr></table>
dns, flush, osx, unix

SQL

Show creation script for a table in mysql

show create table TABLE_NAME
https://snipt.net/embed/185e2fc70d403c38b4eed16ac8e4ade4/
/raw/185e2fc70d403c38b4eed16ac8e4ade4/
185e2fc70d403c38b4eed16ac8e4ade4
sql
SQL
1
2019-08-22T23:38:53
True
False
False
/api/public/snipt/3751/
show-creation-script-for-a-table-in-mysql
<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">show</span> <span class="k">create</span> <span class="k">table</span> <span class="k">TABLE_NAME</span> </span></pre></div> </td></tr></table>
"creation script", mysql, table, view

Java

Convert string to enum equivalent

1
2
3
4
5
6
7
8
enum Colors {
  BLUE,
  WHITE
}

// ..

Colors blue = Enum.valueOf(Colors.class, "BLUE");
https://snipt.net/embed/874a923a13e2a05915e4202150f2eb46/
/raw/874a923a13e2a05915e4202150f2eb46/
874a923a13e2a05915e4202150f2eb46
java
Java
8
2019-08-21T16:39:20
True
False
False
/api/public/snipt/3648/
convert-string-to-enum-equivalent
<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> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kd">enum</span> <span class="n">Colors</span> <span class="o">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="n">BLUE</span><span class="o">,</span> </span><span id="L-3"><a name="L-3"></a> <span class="n">WHITE</span> </span><span id="L-4"><a name="L-4"></a><span class="o">}</span> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="c1">// ..</span> </span><span id="L-7"><a name="L-7"></a> </span><span id="L-8"><a name="L-8"></a><span class="n">Colors</span> <span class="n">blue</span> <span class="o">=</span> <span class="n">Enum</span><span class="o">.</span><span class="na">valueOf</span><span class="o">(</span><span class="n">Colors</span><span class="o">.</span><span class="na">class</span><span class="o">,</span> <span class="s">&quot;BLUE&quot;</span><span class="o">);</span> </span></pre></div> </td></tr></table>
conversion, enum, string

Bash

Use your iPhone's 3G to connect Internet

1
2
3
4
5
6
7
8
// 1. Create an Ad-HOC wireless network over Airport
// 2. Connect iPhone to this network
// 3. ssh to iPhone using following snippet

ssh -ND 9999 [email protected]_ADDRESS

// 4. set your browsers socks proxy to localhost:9999
// Done.
https://snipt.net/embed/d21570de5ffdc838cc09e047ce60eb31/
/raw/d21570de5ffdc838cc09e047ce60eb31/
d21570de5ffdc838cc09e047ce60eb31
bash
Bash
8
2019-08-24T14:48:08
True
False
False
/api/public/snipt/3333/
use-your-iphones-3g-to-connect-internet
<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> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>// 1. Create an Ad-HOC wireless network over Airport </span><span id="L-2"><a name="L-2"></a>// 2. Connect iPhone to this network </span><span id="L-3"><a name="L-3"></a>// 3. ssh to iPhone using following snippet </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>ssh -ND <span class="m">9999</span> [email protected]_ADDRESS </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a>// 4. <span class="nb">set</span> your browsers socks proxy to localhost:9999 </span><span id="L-8"><a name="L-8"></a>// Done. </span></pre></div> </td></tr></table>
3g, bash, internet, iphone, ssh, unix