Skip to content

Instantly share code, notes, and snippets.

#In a repo, returns a list of the numbers of commites per file ordered desc
git rev-list --objects --all | awk '$2' | sort -k2 | uniq -cf1 | sort -rn |
while read frequency sample path
do
[ "blob" == "$(git cat-file -t $sample)" ] && echo -e "$frequency\t$path";
done
#search for remote branches with a specific name fo deleting afer
git fetch origin;git remote update origin --prune;git branch -r |grep WORDINNAME
#remove remote branches with the word "WORDINNAME" (use first git branch -r |grep WORDINNAME |sed 's/ origin\///' to be sure)
@4lberto
4lberto / MV Tests.txt
Last active January 31, 2018 16:50
mvn commands
#Ejecutar según tipo de test
mvn clean install -DskipUTs=true for skipping surefire tests.
mvn clean install -DskipITs=true for skipping failsafe tests.
mvn clean install -DskipTests=true for skipping all tests.
mvn clean install -Dmaven.test.skip=true neither compile test not execute them
#Test parciales
mvn -Dtest=TestCi*le test
mvn -Dtest=TestSquare,TestCi*le test
#!/usr/local/bin/python
# coding: latin-1
import requests
import json
import time
import random
#******************** DISPO (AUTH) ********************************************
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\[\033[1;36m\]\t\[\033[00m\] [\w]\033[0;37m\]\$(parse_git_branch)\[\033[00m\] $ "
@4lberto
4lberto / gist:4faf01dac7ddf609daed7bc707843cd5
Last active August 4, 2016 15:22
Test Private Constructor
//La clase a testear
private OrderRepositorySQLQueries(){
throw new UnsupportedOperationException();
}
/**
* Utility class to test private constructor of utility classes. Those classes must return UnsupportedOperationException (and be final...)
*
* @param <T>
*/
@4lberto
4lberto / FilterDecorator
Created March 31, 2016 20:09
FilterDecorator For tutorial
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@4lberto
4lberto / gist:05a0764b310bccfb610b
Created March 18, 2016 16:10
Keyboard change in Ubutu to be like Mac
Create a file ~/.Xmodmap file looks like this:
clear control
clear mod1
keycode 37 = Alt_L Meta_L
keycode 64 = Control_L
add control = Control_L Control_R
add mod1 = Alt_L Meta_L
Source: https://earthviaradio.wordpress.com/2012/02/06/swapping-the-left-alt-and-ctrl-keys-in-ubuntu-11-10/
@4lberto
4lberto / gist:9536c4fcca2f45563dfa
Created March 18, 2016 08:35
Temproray Spring configuration for filters
Temprary spring configuration:
<bean id="originalCorsFilter" class="org.ebaysf.web.cors.CORSFilter">
</bean>
<bean id="corsFilter" class=com.ib.framework.utils.cors.FilterDecoratorForSpring">
<constructor-arg ref="originalCorsFilter"></constructor-arg>
<constructor-arg>
<map>
<entry key="cors.allowed.origins" value="*" />