Skip to content

Instantly share code, notes, and snippets.

View xlbruce's full-sized avatar
💭
Adena plz

Gilson de Paula xlbruce

💭
Adena plz
View GitHub Profile
@xlbruce
xlbruce / Sonar build.txt
Created May 19, 2016 17:13
Maven command to build, test and add a project on Sonarqube
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Pcoverage-per-test && mvn sonar:sonar -Dsonar.host.url=http://localhost:9000
@xlbruce
xlbruce / Plugin surefire
Created June 6, 2016 17:56
Sometimes, tests pass fine on Eclipse, but fail on Maven Surefire
http://stackoverflow.com/questions/3365628/junit-tests-pass-in-eclipse-but-fail-in-maven-surefire
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<reuseForks>false</reuseForks>
<forkCount>1</forkCount>
</configuration>
@xlbruce
xlbruce / CalculateDuration.java
Created July 5, 2016 20:40
Get a human readable String representing a period between 2 dates
private static String getStringDuration(Temporal startDate, Temporal endDate){
Duration d = Duration.between(startDate, endDate);
StringBuilder str = new StringBuilder();
long total = d.getSeconds();
long days = total / DAYS;
if (days > 0) {
str.append(days)
.append("d ");
total -= days * DAYS;
@xlbruce
xlbruce / dump.sh
Created July 26, 2016 17:40
Dump MySql
mysqldump -h [host] -u [user] -p"password" [--lock-tables=false] db_name [table_name] > dump.sql
@xlbruce
xlbruce / .tmux.conf
Last active September 1, 2016 19:31
My Tmux configuration file to ease management of terminal screen
# Set ^a as default key-binding
set -g prefix C-a
unbind-key C-b
# use | and - to split the windows
bind-key | split-window -h
bind-key - split-window -v
# make the first window number start at 1
set -g base-index 1
@xlbruce
xlbruce / .vimrc
Last active April 12, 2019 13:39
My ~/.vimrc file
" Vundle setup
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
http://www.baeldung.com/rest-api-search-language-spring-data-querydsl
@xlbruce
xlbruce / list-foreign-keys.sql
Created December 14, 2016 20:17
List all tables that have a foreign key given a table name
SELECT *
FROM
KEY_COLUMN_USAGE
WHERE
REFERENCED_TABLE_NAME = 'table_name'
@xlbruce
xlbruce / .zshrc
Created December 26, 2016 16:35
My custom ZSH config file
# Example aliases
alias zshconfig="vim ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias gpom='git pull origin master'
alias mvncli='mvn clean install package'
alias jjar='java -jar'
alias run='mvn spring-boot:run'
alias legacydb='mysql -u root -proot -D legacy'
alias stagingdb='mysql -u dev_debug -p"v1owd*C$>+" -D platform_staging -h phoenix-db-qa.clickbus.net -A'
@xlbruce
xlbruce / ReadFromBluetooth.java
Created January 14, 2017 19:42
This snippet reads a message from a bluetooth device and converts it content into a String object
public void run() {
StringBuilder sb = new StringBuilder();
while (true) {
try {
byte[] buffer = new byte[1024];
int bytes;
int bytesRead = -1;
do {