Skip to content

Instantly share code, notes, and snippets.

View tiagofaustino's full-sized avatar

Tiago Faustino tiagofaustino

View GitHub Profile
@tiagofaustino
tiagofaustino / curso-kotlin-puzzle02.kt
Created June 10, 2023 01:44
Curso Kotlin Puzzle 02
import kotlin.collections.List
fun List<Int>.produto(): Int {
var product = 1
for (element in this) {
product *= element
}
return product
}
@tiagofaustino
tiagofaustino / atualizaProducao.sh
Last active December 11, 2020 12:32
Shell Script usado para fazer deploy de arquivos WAR no Tomcat (usando versão 6 no exemplo). E que foram colocados em uma determinada pasta. Ideal para ser executado num robô toda a noite por exemplo.
#!/bin/bash
PASTA_ORIGEM=/usr/share/deploy_producao/deploy_novo
TOMCAT_HOME=/usr/local/tomcat
TEMPO_SLEEP=20
PASTA_EXECUTADOS=/usr/share/deploy_producao/deploy_executado
LOG_FILE=/usr/share/deploy_producao/deploy_producao.log
#Verifica se foi passado algum nome de war por parametro.
#Quando isso acontecer, só será feito deploy deste war.
@tiagofaustino
tiagofaustino / 0_reuse_code.js
Created June 21, 2016 21:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tiagofaustino
tiagofaustino / DownAndUpTomcat.ahk
Last active March 14, 2016 14:41
Script for AutoHotkey (https://www.autohotkey.com/) to Down and Up Tomcat in Eclipse IDE.
#i::UpTomcatPrincipal() ;Win+i
#k::DownUpTomcatPrincipal() ;Win+k
UpTomcatPrincipal(){
OpenEclipse()
UpTomcat()
OpenPage()
}
DownUpTomcatPrincipal(){
@tiagofaustino
tiagofaustino / atualizaHorario.sh
Last active August 29, 2015 14:09
Forma alternativa de atualizar a hora por wget quando o NTPD é bloqueado no servidor
#!/bin/bash
AGORA_XML=$(wget -qO- "http://api.timezonedb.com/?zone=America/Sao_Paulo&key=<SUA-KEY-API>")
AGORA_XML_STATUS=$(grep -oPm1 "(?<=<status>)[^<]+" <<< "$AGORA_XML")
# Script de atualização de data por API externa do site timezonedb.com
#
#Se o site estiver fora do ar deverá terminar o processo
if [ "$AGORA_XML_STATUS" != "OK" ]; then