snipt

Ctrl+h for KB shortcuts

VimL

Matando processo pelo nome

1
2
3
4
5
6
7
8
# SH para finalizar um processo especifico pelo nome
# Criador - Jefferson Luis Follmann

#!/bin/sh
echo "Digite o nome do processo a ser finalizado"
read process
kill -9 `pgrep $process`
echo "Processo finalizado"
https://snipt.net/embed/9d0a4570f0ad41b65e6fdef47dba82fc/
/raw/9d0a4570f0ad41b65e6fdef47dba82fc/
9d0a4570f0ad41b65e6fdef47dba82fc
vim
VimL
8
2019-08-17T11:14:43
True
False
False
/api/public/snipt/6669/
matando-processo-pelo-nome
<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># SH <span class="nb">para</span> finalizar um processo especifico pelo nome </span><span id="L-2"><a name="L-2"></a># Criador <span class="p">-</span> Jefferson Luis Follmann </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>#<span class="p">!</span><span class="sr">/bin/</span><span class="k">sh</span> </span><span id="L-5"><a name="L-5"></a>echo <span class="s2">&quot;Digite o nome do processo a ser finalizado&quot;</span> </span><span id="L-6"><a name="L-6"></a>read process </span><span id="L-7"><a name="L-7"></a>kill <span class="m">-9</span> `pgrep $process` </span><span id="L-8"><a name="L-8"></a>echo <span class="s2">&quot;Processo finalizado&quot;</span> </span></pre></div> </td></tr></table>
sh

SQL

Adicionando Contraint

1
2
3
/*Adciona Constraint*/
ALTER TABLE sigh.ficha_amb_int ADD CONSTRAINT fk_cod_fatura_consulta 
    FOREIGN KEY (cod_fatura_consulta) REFERENCES sigh.faturas_consulta (id_fatura_consulta) ON UPDATE CASCADE ON DELETE RESTRICT;
https://snipt.net/embed/ada349b50aa60f03934e2f9a981e919a/
/raw/ada349b50aa60f03934e2f9a981e919a/
ada349b50aa60f03934e2f9a981e919a
sql
SQL
3
2019-08-15T01:31:25
True
False
False
/api/public/snipt/6569/
adicionando-contraint
<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="cm">/*Adciona Constraint*/</span> </span><span id="L-2"><a name="L-2"></a><span class="k">ALTER</span> <span class="k">TABLE</span> <span class="n">sigh</span><span class="p">.</span><span class="n">ficha_amb_int</span> <span class="k">ADD</span> <span class="k">CONSTRAINT</span> <span class="n">fk_cod_fatura_consulta</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">FOREIGN</span> <span class="k">KEY</span> <span class="p">(</span><span class="n">cod_fatura_consulta</span><span class="p">)</span> <span class="k">REFERENCES</span> <span class="n">sigh</span><span class="p">.</span><span class="n">faturas_consulta</span> <span class="p">(</span><span class="n">id_fatura_consulta</span><span class="p">)</span> <span class="k">ON</span> <span class="k">UPDATE</span> <span class="k">CASCADE</span> <span class="k">ON</span> <span class="k">DELETE</span> <span class="k">RESTRICT</span><span class="p">;</span> </span></pre></div> </td></tr></table>
sql

SQL

iLike = ~*

1
2
3
4
5
6
7
/* funciona igual iLike ( ~*  ) */
select
	nm_paciente
from
	sigh.pacientes
where
	nm_paciente ~* 'marco aurelio miranda dreher'
https://snipt.net/embed/1e6f2689ebe20a449a81142e91fb6c60/
/raw/1e6f2689ebe20a449a81142e91fb6c60/
1e6f2689ebe20a449a81142e91fb6c60
sql
SQL
7
2019-08-16T09:35:23
True
False
False
/api/public/snipt/6568/
ilike
<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="cm">/* funciona igual iLike ( ~* ) */</span> </span><span id="L-2"><a name="L-2"></a><span class="k">select</span> </span><span id="L-3"><a name="L-3"></a> <span class="n">nm_paciente</span> </span><span id="L-4"><a name="L-4"></a><span class="k">from</span> </span><span id="L-5"><a name="L-5"></a> <span class="n">sigh</span><span class="p">.</span><span class="n">pacientes</span> </span><span id="L-6"><a name="L-6"></a><span class="k">where</span> </span><span id="L-7"><a name="L-7"></a> <span class="n">nm_paciente</span> <span class="o">~*</span> <span class="s1">&#39;marco aurelio miranda dreher&#39;</span> </span></pre></div> </td></tr></table>
sql