Skip to content

Instantly share code, notes, and snippets.

View gustavoapolinario's full-sized avatar

GUSTAVO APOLINARIO gustavoapolinario

View GitHub Profile
@gustavoapolinario
gustavoapolinario / myStorage.js
Created January 18, 2017 11:18
Gerencia registros salvando-os no navegador (localStorage ou Cookie)
"use strict";
/*
* Class myStorage
* Gerencia registros salvando-os no navegador
* Suporte a cookie e localStorage
*/
var myStorage = new Object();
myStorage.defaultExpirationDays = 30;
@gustavoapolinario
gustavoapolinario / leArquivo.java
Created January 18, 2017 12:13
Le arquivo no java
private String leArquivo(String nome) {
String linha = "";
StringBuilder conteudoArquivo = new StringBuilder();
try {
FileReader arq = new FileReader(nome);
BufferedReader lerArq = new BufferedReader(arq);
@gustavoapolinario
gustavoapolinario / docker-compose.yml
Created February 6, 2017 16:29
Docker compose for apache/php
db:
image: mariadb:latest
environment:
- MYSQL_ROOT_PASSWORD=Eak829ij23
- MYSQL_USER=dba
- MYSQL_PASSWORD=zoilo367
- TERM=xterm-256color
ports:
- "3306:3306"
@gustavoapolinario
gustavoapolinario / Docker example commands ARG&ENV
Last active January 27, 2019 19:51
Docker common commands
FROM amazonlinux:latest
ARG AURL="https://www.site.com.br/"
ENV URL=$URL
CMD echo $URL
@gustavoapolinario
gustavoapolinario / images-in-registry.sh
Created May 12, 2017 13:56
SH to list all repositories in docker registry, list all tags of repositorie and remove all images from the tag repositorie
#!/bin/bash
#
# SH to list all repositories in docker registry, list all tags of repositorie and remove all images from the tag repositorie
#
# Created by: Gustavo Apolinario
# 2017-05-12
#
# curl -X GET localhost:5000/v2/_catalog
# curl -X GET localhost:5000/v2/socsite_apache/tags/list
# It's Work to you test if the vulnerability is working
# use only to test your system
# use with responsability
#
# use method:
# test-WP-CVE-2017-8295.sh [YOUR-SITE-TO-TEST] [USER-TO-TEST]
# ex: test-WP-CVE-2017-8295.sh example.com user
curl --write-out %{http_code} --silent --output ~/body.txt \
@gustavoapolinario
gustavoapolinario / wildfly-cli
Last active September 30, 2022 01:34
wildfly-cli / jboss-cli
wildfly-cli / jboss-cli common commands
# Connect into wildfly/jboss cli (only with wildfly up)
$JBOSS_HOME/bin/jboss-cli.sh --connect
# Wildfly cli offline
$JBOSS_HOME/bin/jboss-cli.sh --commands="embed-server,$COMMAND,stop-embedded-server"
# Commands:
/system-property=VAR_NAME:add(value=VAR_VALUE)
@gustavoapolinario
gustavoapolinario / mysql-kill-long-queries.sql
Last active August 25, 2020 13:15
Procedure in mysql to kill long queries executions.
DELIMITER //
CREATE PROCEDURE killing_process (total_time int)
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE process_id INT;
DECLARE result varchar(4000);
DECLARE cur1 CURSOR FOR
SELECT id
FROM information_schema.processlist
@gustavoapolinario
gustavoapolinario / clear-logs.sh
Created May 16, 2018 14:16
Script sh to clear logs by time
#!/bin/bash
#not tested... not working.
compacta() {
find $1 -name "*-201" -not -path "*.tar.gz" -exec tar -zcvf {}.tar.gz {} \;
}
remove_olders() {
find $1* -mtime +7 -exec rm {} \;
}
clear() {
@gustavoapolinario
gustavoapolinario / AWS-CodeBuild-sample.yaml
Last active December 26, 2018 23:49
sample Cloudformation CodeBuild docker
AWSTemplateFormatVersion: "2010-09-09"
Description: Example of Cloudformation to Build with CodeBuild an application. Get Code commit repo and build a docker container. Your repo needs the buildspec.yml file.
Parameters:
RepositoryName:
Description: CodeComit repository name
Type: String
Resources:
CodeBuildRole: