snipt

Ctrl+h for KB shortcuts

ApacheConf

mod_rewrite 301 redirect

RewriteRule ^whatever/(.*)$ http://www.domain.com/$1/ [R=301,L]
https://snipt.net/embed/e4754a4e77c65133b1c9404bb821e45a/
/raw/e4754a4e77c65133b1c9404bb821e45a/
e4754a4e77c65133b1c9404bb821e45a
apacheconf
ApacheConf
1
2019-06-12T21:19:55
True
False
False
/api/public/snipt/438/
mod_rewrite-301-redirect
<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="nb">RewriteRule</span> ^whatever/(.*)$ http://www.domain.com/$1/ [R=301,L] </span></pre></div> </td></tr></table>
apache, mod_rewrite

INI

passwordless access to mysql

1
2
3
4
#this should be in your ~/.my.cnf
[client]
user=root
password=<the password>
https://snipt.net/embed/138070396e31c714ba371c70285d5dda/
/raw/138070396e31c714ba371c70285d5dda/
138070396e31c714ba371c70285d5dda
ini
INI
4
2019-06-07T11:55:13
True
False
False
/api/public/snipt/422/
passwordless-access-to-mysql
<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="c1">#this should be in your ~/.my.cnf</span> </span><span id="L-2"><a name="L-2"></a><span class="k">[client]</span> </span><span id="L-3"><a name="L-3"></a><span class="na">user</span><span class="o">=</span><span class="s">root</span> </span><span id="L-4"><a name="L-4"></a><span class="na">password</span><span class="o">=</span><span class="s">&lt;the password&gt;</span> </span></pre></div> </td></tr></table>
configuration, mysql, passwordless

Bash

start mysql

1
2
3
4
cd /usr/local/mysql
sudo ./bin/mysqld_safe
ctrl Z
bg
https://snipt.net/embed/be91d91ed21ece7b1c476c075b7cfe6a/
/raw/be91d91ed21ece7b1c476c075b7cfe6a/
be91d91ed21ece7b1c476c075b7cfe6a
bash
Bash
4
2019-06-07T20:27:33
True
False
False
/api/public/snipt/383/
start-mysql
<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> /usr/local/mysql </span><span id="L-2"><a name="L-2"></a>sudo ./bin/mysqld_safe </span><span id="L-3"><a name="L-3"></a>ctrl Z </span><span id="L-4"><a name="L-4"></a><span class="nb">bg</span> </span></pre></div> </td></tr></table>
mysql, terminal

Ruby

select

1
2
3
<% t = Tipo.find :all %>
<%= f.label :tipo %><br />
    <%= select "usuario", "tipo", t.collect{|v| [v.nombre, v.id]} %>
https://snipt.net/embed/fd45798317282490a48a30dec1a27f2e/
/raw/fd45798317282490a48a30dec1a27f2e/
fd45798317282490a48a30dec1a27f2e
rb
Ruby
3
2019-06-11T18:42:50
True
False
False
/api/public/snipt/380/
select-1
<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="o">&lt;</span><span class="sx">% t </span><span class="o">=</span> <span class="no">Tipo</span><span class="o">.</span><span class="n">find</span> <span class="ss">:all</span> <span class="sx">%&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="sx">&lt;%= f.label :tipo %&gt;</span><span class="o">&lt;</span><span class="n">br</span> <span class="sr">/&gt;</span> </span><span id="L-3"><a name="L-3"></a><span class="sr"> &lt;%= select &quot;usuario&quot;, &quot;tipo&quot;, t.collect{|v| [v.nombre, v.id]} %&gt;</span> </span></pre></div> </td></tr></table>
ruby, select