Skip to content

Instantly share code, notes, and snippets.

View alexruzenhack's full-sized avatar

Alex Ruzenhack alexruzenhack

View GitHub Profile
@alexruzenhack
alexruzenhack / check-services-and-ports.md
Last active November 27, 2018 14:31
📋 Check witch ports are open and witch services are running #linux #wildfly

Verify services

Status of all services:

service --status-all

Status of any service:

service wildfly status
@alexruzenhack
alexruzenhack / mysql-function-gender.sql
Last active November 27, 2018 14:35
Query para criar uma função de retorno padrao de genero em string no #mysql
CREATE FUNCTION dermage_regua.gender(currentGender varchar(1)) RETURNS varchar(1) CHARSET utf8
BEGIN
declare gender varchar(1);
IF currentGender IN ('F','M') THEN SET gender = currentGender;
ELSE SET gender = 'F';
END IF;
RETURN gender;
END
@alexruzenhack
alexruzenhack / insert_hardcode_javascript_in_body_tag_dom.html
Last active April 6, 2017 19:53
How to insert a hardcode javascript in body tag of the HTML DOM
<script type="text/javascript">
(function () {
var ss = document.createElement('script');
ss.type = 'text/javascript';
ss.async = true;
ss.src = '//app.shoptarget.com.br/js/tracking.js';
var body = document.getElementsByTagName('body')[0]; // seleciona o elemento body
body.appendChild(ss); // adiciona elemento script antes do fechamento do elemento body
})();
</script>
@alexruzenhack
alexruzenhack / insert_hardcode_javascript_in_head_tag_dom.html
Last active April 6, 2017 19:54
How to insert a hardcode javascript in head tag of the HTML DOM
<script type="text/javascipt">
try{
(function(window,document){
head=document.getElementsByTagName('head')[0];
script=document.createElement('script');
// treat the hardcode script tag
head.appendChild(script);
})(window,document);
} catch(e) {
console.log('[GTM][Error in tag "nomeDaTag"]: '+e);
@alexruzenhack
alexruzenhack / mysql-function-first_name_capitalized.sql
Last active November 27, 2018 14:33
Query para criar uma função de extrair string capitalizada do primeiro nome de string de nome completo no #mysql
CREATE DEFINER=`ruzenhack`@`%` FUNCTION `first_name_capitalized`(name varchar(100)) RETURNS varchar(100) CHARSET utf8
BEGIN
declare firstName varchar(100);
declare firstNameCapitalized varchar(100);
SET firstName = substring_index(name, ' ', 1);
SET firstNameCapitalized = concat(ucase(left(firstName,1)),lcase(substring(firstName,2)));
RETURN firstNameCapitalized;
END
@alexruzenhack
alexruzenhack / mysql-function-first_name.sql
Last active November 27, 2018 14:34
Query para criar uma função de extrair string do primeiro nome de string de nome completo no #mysql
CREATE DEFINER=`ruzenhack`@`%` FUNCTION `first_name`(name varchar(100)) RETURNS varchar(100) CHARSET utf8
BEGIN
declare firstName varchar(100);
SET firstName = ucase(substring_index(name, ' ', 1));
RETURN firstName;
END
@alexruzenhack
alexruzenhack / select_mysql_event.sql
Last active November 27, 2018 14:34
How to select an event information from a schema #mysql
select * from information_schema.events where event_name = 'your_event_name' and event_schema = 'your_schema';
@alexruzenhack
alexruzenhack / alter_mysql_event.sql
Last active November 27, 2018 14:34
Hot to alter starts of an event #mysql
alter event your_schema.your_event on schedule every 1 day starts '2016-08-09 19:00:00';
@alexruzenhack
alexruzenhack / craete_mysql_event.sql
Last active November 27, 2018 14:33
How to create an event schedule on #mysql
create event event_nome
on schedule
every 1 day
starts '2016-08-09 00:18:00'
do
call your_schema.your_procedure();
@alexruzenhack
alexruzenhack / create_mysql_procedure.sql
Last active November 27, 2018 14:33
How to create a procedure on #mysql
CREATE DEFINER=`username`@`%` PROCEDURE `nome_da_procedure`()
BEGIN
Your_Query;
END