Skip to content

Instantly share code, notes, and snippets.

View RELATO's full-sized avatar
🎯
Focusing

Haroldo S. Lontra Jr. RELATO

🎯
Focusing
View GitHub Profile
@RELATO
RELATO / demo-mysql.sql
Created April 14, 2019 19:03
mysql raw sql structure for dbdemo creation (for tests)
# Copyright (c) 2019 Relato
# MIT-licensed
create database dbdemostkovfw DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
use dbdemostkovfw;
create table badges (
Id INT NOT NULL PRIMARY KEY,
UserId INT,
@RELATO
RELATO / RAMDISK.md
Last active November 15, 2022 07:08
Commands to create in memory disk on Ubuntu 16.04

In memory ( RAM ) disk

Use the following commands:

  • Creating the RAM disk:
$ sudo mkdir /mnt/ramdisk
$ sudo vi /etc/fstab
@RELATO
RELATO / running_graphical_app_in_docker.md
Last active June 28, 2017 14:38
Run a graphical app in docker on OSX/Windows/Linux

Run a graphical app in docker on OSX

From: https://gist.github.com/netgusto/931085fc3673b69dd15a1763784307c5

Note: Replace 192.168.0.5 below by your own interface ip

mac $ socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
mac $ docker run --device=/dev/tty0 -e DISPLAY=192.168.0.5:0 -i -t ubuntu /bin/bash
ubuntu $ apt-get update && apt-get install -y firefox
ubuntu $ firefox
@RELATO
RELATO / mysql-dbs-export.bash
Created November 15, 2016 11:39
Script to export all databases to individual files with date + dbname
#!/bin/bash
USER="zend"
PASSWORD=""
#OUTPUT="/Users/rabino/DBs"
#rm "$OUTPUTDIR/*gz" > /dev/null 2>&1
databases=`mysql -u $USER -p$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
Tutorial
Testando Servidor DNS:
Na linha de comando, digite:"nslookup" e pressione ENTER
na próxima linha digite o endereço do Servidor DNS que você deseja testar e pressione ENTER
ex: >www.uol.com.br
Server: 192.168.0.26 (seu servidor DNS)
Adress: 192.168.0.26#53 (porta em que seu servidor DNS esta trabalhando)
@RELATO
RELATO / java8params.txt
Created July 3, 2016 11:27
Java 8-old runtime config tips
For lazy readers full listing is here (for curious detailed explanation is provided below):
Java < 8
-server
-Xms<heap size>[g|m|k] -Xmx<heap size>[g|m|k]
-XX:PermSize=<perm gen size>[g|m|k] -XX:MaxPermSize=<perm gen size>[g|m|k]
-Xmn<young size>[g|m|k]
-XX:SurvivorRatio=<ratio>
-XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled
@RELATO
RELATO / iso88591.sh
Created June 30, 2016 18:47
Script para alterar o mapa de caracteres do Ubuntu UTF-8 para ISO-8859-1 (LATIN1)
#https://www.vivaolinux.com.br/script/Alterando-Ubuntu-de-UTF8-para-ISO88591-(LATIN1)
#!/bin/bash
# Script para alterar o mapa de caracteres do Ubuntu UTF-8 para ISO-8859-1 (LATIN1)
# @uthor Denilson Martins, [email protected]
# 03/03/2010
# /etc/environment
echo -e "LANG=\"pt_BR"\" >> /etc/environment
@RELATO
RELATO / ubuntu-server-locale-ISO-8859-1.txt
Created June 9, 2016 12:28
Configurando o locale no Ubuntu server (12.04 e 14.04)
Editar o arquivo abaixo (com vi editor):
vi /var/lib/locales/supported.d/local
E coloque os locales que você quer que o sistema suporte. A maioria dos usuários brasileiros vai se dar bem com esse conteúdo:
pt_BR ISO-8859-1
pt_BR.UTF-8 UTF-8
#tips: http://www.programcreek.com/java-api-examples/index.php?api=org.hibernate.annotations.Parameter
package com.supportmycode.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.GenerationType;
import org.hibernate.annotations.GenericGenerator;
@RELATO
RELATO / verificareplica.sh
Created November 23, 2015 20:49
Script para verificar a replicação do mysql ( usa percona tools )
#!/bin/bash
#     <300 - [Good]
#     300> <600 - [Warning]
#     > 600 - [Critical]
MAIL_FROM="root@`hostname`"
MAIL_TO="[email protected]"
Warningthreshold=300
Criticalthreshold=600
backup=$1
CMD=$(/root/bin/pt-heartbeat -D test --master-server-id 1 --check | cut -d. -f1)