Skip to content

Instantly share code, notes, and snippets.

View yanaga's full-sized avatar
✈️
Staying at home (or not)!

Edson Yanaga yanaga

✈️
Staying at home (or not)!
View GitHub Profile
import java.io.Serializable;
import java.util.List;
import javax.persistence.EntityManager;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.support.JpaEntityInformation;
Verifying that +yanaga is my blockchain ID. https://onename.com/yanaga
@yanaga
yanaga / SemAcentoNemCedilha.java
Created May 23, 2012 01:02
Normalização de Strings em Java
import java.text.Normalizer;
public class SemAcentoNemCedilha {
public static String normalizar(String s) {
return Normalizer.normalize(value, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "");
}
}
@yanaga
yanaga / ProductionLog4jConfig.java
Created February 22, 2012 18:34
Sample production Spring @configuration bean for log4j
import java.io.FileNotFoundException;
import javax.annotation.PostConstruct;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.util.Log4jConfigurer;
@Configuration
@Profile("production")
RBC WaterPark Workshop - 10/02/2020
Openshift Master Console: http://console-openshift-console.apps.cluster-yyz-3dca.yyz-3dca.example.opentlc.com
Openshift API for command line 'oc' client: https://api.cluster-yyz-3dca.yyz-3dca.example.opentlc.com:6443
Download oc client from https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.3.0/openshift-client-linux-4.3.0.tar.gz
You can choose any combination of username/password on the first time you login.
@yanaga
yanaga / gist:3024877
Created June 30, 2012 18:04
Código Java para validação do CNS (Cartão Nacional de Saúde)
public boolean isValid(String s) {
if (s.matches("[1-2]\\d{10}00[0-1]\\d") || s.matches("[7-9]\\d{14}")) {
return somaPonderada(s) % 11 == 0;
}
return false;
}
private int somaPonderada(String s) {
char[] cs = s.toCharArray();
int soma = 0;
@yanaga
yanaga / gist:a271e0412da5b575d171
Created April 15, 2015 21:19
Create a 4G swap file on Ubuntu
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
cat << EOF | sudo tee -a /etc/fstab
/swapfile none swap sw 0 0
EOF