Skip to content

Instantly share code, notes, and snippets.

View luizrobertofreitas's full-sized avatar

Luiz Roberto Freitas luizrobertofreitas

View GitHub Profile
@luizrobertofreitas
luizrobertofreitas / change-jdk.sh
Created August 4, 2018 17:35
Script to change jdk based on update-alternatives
#!/bin/bash
alternatives --config java
alternatives --config javac
alternatives --config javaws
alternatives --config jconsole
alternatives --config keytool
alternatives --config java_home
@luizrobertofreitas
luizrobertofreitas / run-update-alternatives.sh
Created August 4, 2018 17:34
Setting up java alternatives
#!/usr/bin/env python
import subprocess
import os
ALL_JDK_FOLDERS = ['jdk1.8.0_181', 'graalvm-ee-1.0.0-rc4', 'jdk-10.0.1', 'jdk-9.0.4', 'jdk1.7.0_80', 'jdk1.6.0_45']
BASE_FOLDER = '/opt/jdks'
DEFAULT_JDK_FOLDER = 'jdk1.8.0_181'
@luizrobertofreitas
luizrobertofreitas / java6 on fedora
Created August 4, 2018 17:32
Java 6 on Fedora error
When getting the error about libnsl.so.1
ln -s /usr/lib64/libnsl.so.2.0.0 /usr/lib64/libnsl.so.1
ln -s /usr/lib/libnsl.so.2.0.0 /usr/lib/libnsl.so.1
@luizrobertofreitas
luizrobertofreitas / send-message-to-graylog
Last active October 24, 2017 01:20
Graylog linux shell command
echo "Hello Graylog, let's be friends." | nc -w 1 -u 127.0.0.1 9000
echo '{"version": "1.1","host":"example.org","short_message":"A short message that helps you identify what is going on","full_message":"Backtrace here\n\nmore stuff","level":1,"_user_id":9001,"_some_info":"foo","_some_env_var":"bar"}' | gzip | nc -u -w 1 commons-graylog001.azure.zup.com.br 12379
@luizrobertofreitas
luizrobertofreitas / gist:dd680fe80efbfd49c7817935d0527d79
Created June 10, 2017 04:54
Connect with php to dockered mysql
This happen because selinux avoid db connections from the httpd server to the remote db server. To solve it you need to access your server trough ssh or just open a console if you have pretencial acces and do the follow:
You must check in the SELinux if the port 80 is managed in. You can check it typing # semanage port -l | grep http_port_t for list and check:
http_port_t tcp 443, 488, 8008, 8009, 8443, 9000
If you need to add the required port, just type:
# semanage port -a -t http_port_t -p tcp 80
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@luizrobertofreitas
luizrobertofreitas / spring-boot-utc-timezone
Created June 5, 2017 15:06
Setting UTC timezone spring-boot
@SpringBootApplication
public class Application {
@PostConstruct
void started() {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
@luizrobertofreitas
luizrobertofreitas / checkpoint-snx-vpn-client-fedora25.txt
Created May 16, 2017 13:20 — forked from rafaeltuelho/checkpoint-snx-vpn-client-fedora25.txt
setup Checkpoint Firewall VPN with SNX on Linux Fedora 25
First you have to ensure the Java JRE is installed on your system.
Remember the java plugin will only work on Firefox. If you prefer to install from fedora/rhel repos:
sudo dnf (yum) install java-1.8.0-openjdk icedtea-web
download the snx script installer from the Checkpoint VPN page:
https://<your company vpn ip addr>/sslvpn/SNX/INSTALL/snx_install.sh
run int as root to install
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386
@luizrobertofreitas
luizrobertofreitas / elem-os-warnings.txt
Created January 2, 2016 13:38
Alguns warnings que ocorrem ao abrir programas Gtk no elementary os
1 - Gtk-Message: Failed to load module "pantheon-filechooser-module"
2 - Gtk-Message: Failed to load module "canberra-gtk-module"
$ sudo apt-get install libcanberra-gtk-module
3 - Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap"