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 / dump.sh
Created February 19, 2018 18:09
This script makes a dump from a given database ignoring unwanted content from certain tables, like histories and orders.
#!/bin/bash
tmpFile1=~/.tmp1$$
tmpFile2=~/.tmp2$$
database=$1
database_local=$2
function cleanFiles() {
rm $tmpFile1 $tmpFile2 > /dev/null 2>&1;
exit;
@xlbruce
xlbruce / Git blame original author
Created April 20, 2017 14:11
Show the original author of lines using git log
git log -p -M --follow --stat -- path/to/your/file
@xlbruce
xlbruce / Post in Blogger.txt
Last active June 11, 2017 03:56
Simple workflow description describing how to insert a new post using Blogger API v3.
Create a post flow:
1- Generate an access token:
//TODO search how to do this programmatically
2- Send a request to blogger with post content
URI: https://www.googleapis.com/blogger/v3/blogs/$blogId/posts
Header:
@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 {
@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 / 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'
http://www.baeldung.com/rest-api-search-language-spring-data-querydsl
@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'
@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 / 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