This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.security.GeneralSecurityException; | |
import java.security.SecureRandom; | |
import java.security.cert.CertificateException; | |
import java.security.cert.X509Certificate; | |
import javax.net.ssl.HostnameVerifier; | |
import javax.net.ssl.HttpsURLConnection; | |
import javax.net.ssl.SSLContext; | |
import javax.net.ssl.SSLSession; | |
import javax.net.ssl.TrustManager; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.hazelcast.core.HazelcastInstance; | |
import org.springframework.boot.actuate.health.AbstractHealthIndicator; | |
import org.springframework.boot.actuate.health.Health; | |
import org.springframework.boot.actuate.health.HealthIndicator; | |
import org.springframework.stereotype.Component; | |
import org.springframework.util.Assert; | |
/** | |
* {@link HealthIndicator} for Hazelcast. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.Map; | |
import javax.persistence.EntityManagerFactory; | |
import javax.sql.DataSource; | |
import org.springframework.boot.autoconfigure.domain.EntityScan; | |
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties; | |
import org.springframework.boot.test.context.TestConfiguration; | |
import org.springframework.context.annotation.Bean; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM OPENDATA | |
WHERE other_tags IS NOT JSON; | |
create search index table_log_idx on tbl_lg (jsoncolumn) for json; | |
alter table table_log_idx add constraint ensure_json check (jsoncolumn is json) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected static HttpClientBuilder getClientBuilder(boolean skipSslValidation) { | |
HttpClientBuilder builder = HttpClients.custom() | |
.useSystemProperties() | |
.setRedirectStrategy(new DefaultRedirectStrategy()); | |
if (skipSslValidation) { | |
builder.setSslcontext(getNonValidatingSslContext()); | |
builder.setSSLHostnameVerifier(new NoopHostnameVerifier()); | |
} | |
builder.setConnectionReuseStrategy(NoConnectionReuseStrategy.INSTANCE); | |
return builder; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sun.reflect.ReflectionFactory; | |
import java.lang.reflect.Constructor; | |
public class SilentObjectCreator { | |
public static <T> T create(Class<T> clazz) { | |
return create(clazz, Object.class); | |
} | |
public static <T> T create(Class<T> clazz, | |
Class<? super T> parent) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/11003761/notepad-add-to-every-line | |
Follow these steps: | |
Press Ctrl+H to bring up the Find/Replace Dialog. | |
Choose the Regular expression option near the bottom of the dialog. | |
To add a word, such as test, at the beginning of each line: | |
Type ^ in the Find what textbox |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
relname AS "relation", | |
pg_size_pretty ( | |
pg_total_relation_size (C .oid) | |
) AS "total_size" | |
FROM | |
pg_class C | |
LEFT JOIN pg_namespace N ON (N.oid = C .relnamespace) | |
WHERE | |
nspname NOT IN ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
keytool -genkey -alias server -keyalg RSA -keysize 2048 -keystore yourdomain.jks | |
keytool -certreq -alias server -keyalg RSA -file yourdomain.csr -keystore yourdomain.jks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public BigDecimal multiply() | |
{ | |
try | |
{ | |
return new BigDecimal(new DecimalFormat("#.##").format(n1.multiply(n2))); | |
} | |
catch (ArithmeticException se) | |
{ | |
MathContext mc = new MathContext(2, RoundingMode.HALF_UP); | |
return n1.multiply(n2, mc); |