Skip to content

Instantly share code, notes, and snippets.

@mourawaldson
mourawaldson / stashExporter
Created November 7, 2017 18:14 — forked from VersionMismatch/stashExporter
Export git stashes to patch files using the stash name as the file name
git stash list| sed 's/\//\_/g'|sed 's/ /\_/g' | awk -F ":" '{ system("git stash show -p " $1 " >> " $1$2$3 ".diff" ) }'
@mourawaldson
mourawaldson / gist:a70fef9f7d71c001a620
Created February 16, 2015 00:43
Remote access to root user on current database
GRANT ALL PRIVILEGES ON * to 'root';
@mourawaldson
mourawaldson / gist:bff7f9d3a6dad0190fa4
Created February 16, 2015 00:41
Create file with find result
cd /Volumes/DIR
find ./ -type d > file.txt
@mourawaldson
mourawaldson / gist:6e38641f6652fc0f297b
Created February 16, 2015 00:39
Photos structure by date
exiftool -d %Y/%m/%d "-directory<createdate" *
@mourawaldson
mourawaldson / search-field.sql
Created February 16, 2015 00:35
Search for a field in a db
SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%field_name%' AND TABLE_SCHEMA = 'scheme_name';
1. Install git -> http://git-scm.com/download
2. Install dotfiles -> $ cd; git clone git@github.com:mourawaldson/dotfiles.git .dotfiles && bash .dotfiles/install
3. Install vcprompt -> $ cd; mkdir ~/bin && curl -sL https://github.com/djl/vcprompt/raw/master/bin/vcprompt > ~/bin/vcprompt && chmod 755 ~/bin/vcprompt && sudo mv ~/bin/vcprompt /bin/vcprompt && sudo rm -rf ~/bin
4. Install .osx -> $ cd; bash .dotfiles/.osx
@mourawaldson
mourawaldson / split.java
Created April 28, 2012 21:36
Split em Java ME
public final static String[] split(String texto, char separador) {
if (texto == null)
return null;
int tamanhoTexto = texto.length();
if(tamanhoTexto == 0)
return null;
Vector lista = new Vector();
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* Salvar arquivo.
*
@mourawaldson
mourawaldson / get_extension.java
Created April 28, 2012 21:35
Get file extension
import java.io.File;
/**
* Retorna a extensão do arquivo.
*
* @param file
* @return string Extensão
*/
public static String getExtension(String file) {
return file.substring(file.lastIndexOf(".") + 1, file.length());
@mourawaldson
mourawaldson / null_empty.java
Created April 28, 2012 21:34
Check if is null or empty
/**
* Verifica se a String passada por parâmetro é nula ou vazia.
*
* @param str
* String
* @return boolean true se a String for "null" ou vazia; false caso exista
* conteúdo.
*/
public static boolean isNullOrEmpty(String str) {
return ((str == null || str.isEmpty()) || str.trim().length() == 0) ? true