Skip to content

Instantly share code, notes, and snippets.

View rdeavila's full-sized avatar

Rodrigo de Avila rdeavila

View GitHub Profile
@rdeavila
rdeavila / select-case.sql
Last active August 29, 2015 13:58
SQL: Como fazer select de uma coluna ou outra, usando CASE.
SELECT
e.Nome AS nome_empresa,
(Case
WHEN c.tipo_pessoa = 'J' THEN c.Nome_Fantasia
ELSE c.Nome
END ) AS nome_ordem,
c.*
FROM
LD_Cliente c,
LD_Empresa e
@rdeavila
rdeavila / nullify-emails-sms.sql
Last active August 29, 2015 13:58
Remove endereços de email e configurações de SMS do CRM.
-- Rápido
update syo_campanha set ds_enderecoemail = null;
update syo_contaemail set ds_email = null;
update syo_contatoemail set ds_email = null;
update syo_empresa set ds_email = null, ds_smtpemail = null, ds_usuarioemail = null;
update syo_faleconosco set ds_email = null;
update syo_motivoinsatisfacao set ds_emails = null;
update syo_newsletter set ds_email = null;
update syo_pergunta set ds_emails = null;
@rdeavila
rdeavila / montar.sh
Last active August 29, 2015 13:57
Exemplo de uso de sshfs
#!/bin/bash
#
# Para usar em uma vm:
# adicionar ao /etc/hosts
# 192.168.1.158 macmini.avila.net.br
#
# Para desmontar:
# fusermount -u /home/rodrigo/www
#
@rdeavila
rdeavila / dump.js
Created March 27, 2014 14:22 — forked from oodavid/dump.js
/**
* DUMP
*
* Dumps a variable in a readable form to the console, this is a recursive function
* so be careful of nested references that may cause it to overflow... (untested for that)
*
* @v ANYTHING [Any variable]
* @name STRING [The name of the variable, optional, used internally when looping objects and arrays]
* @spacing STRING [The prefix spacing, used internally when looping objects and arrays]
*/
@rdeavila
rdeavila / rodando.sh
Last active August 29, 2015 13:57
Como usar pidof
#!/bin/bash
# Exemplo no terminal
pidof -xs ${1} 1>/dev/null 2>&1 || echo " ==> Script ${1} não está rodando."
# Exemplo no crontab
# 00 18 * * * pidof -x script.sh || script.sh --iniciar
@rdeavila
rdeavila / CONFIG.md
Last active November 16, 2023 13:16
Apache: Como configurar um VirtualHost com proxy reverso

Apache: Como configurar um VirtualHost com proxy reverso

Instala biblioteca do Apache

sudo apt-get install libapache2-mod-proxy-html

Habilita os módulos no Apache

@rdeavila
rdeavila / internet-explorer-download.sh
Created March 19, 2014 23:46
Downloads de VMs com Internet Explorer.
#!/bin/bash
# IE 7, Windows Vista
curl -O -L "http://www.modern.ie/vmdownload?platform=mac&virtPlatform=parallels&browserOS=IE7-Vista&filename=Parallels/IE7_Vista/IE7.Vista.For.MacParallels.part0{1.sfx,2.rar,3.rar}"
# IE 8, Windows XP
curl -O -L "http://www.modern.ie/vmdownload?platform=mac&virtPlatform=parallels&browserOS=IE8-WinXP&filename=Parallels/IE8_WinXP/IE8.WinXP.For.MacParallels.part{1.sfx,2.rar}"
# IE 9, Windows 7
curl -O -L "http://www.modern.ie/vmdownload?platform=mac&virtPlatform=parallels&browserOS=IE9-Win7&filename=Parallels/IE9_Win7/IE9.Win7.For.MacParallels.part0{1.sfx,2.rar,3.rar,4.rar}"
@rdeavila
rdeavila / README.md
Last active August 29, 2015 13:57
Ubuntu Linux: Como fazer upload de arquivos para o Google Drive, via terminal / ssh
@rdeavila
rdeavila / get-mime.sh
Created March 18, 2014 18:30
Linux: Como ver o mime-type de um arquivo
#!/bin/bash
file --mime-type -b ${1}
@rdeavila
rdeavila / git-update-fork.sh
Last active February 19, 2024 16:02
Git: como atualizar um fork com as mudanças do original?
#!/bin/bash
# Adicione um novo remote; pode chamá-lo de "upstream":
git remote add upstream https://github.com/usuario/projeto.git
# Obtenha todos os branches deste novo remote,
# como o upstream/master por exemplo:
git fetch upstream