This file contains 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
#!/usr/bin/env bash | |
# remove expired certs from a keystore | |
# set FN to the keystore file | |
# set the regex to identify expired certs. in my example anything mentioning 2019 is considered expired. | |
FN=cacerts.jks | |
echo "finding expired certs..." | |
ALIASES=`keytool -list -v -keystore $FN -storepass changeit | grep -i 'alias\|until' | grep --before=1 'until.*2019' | grep Alias | awk -F': ' '{print $2}' | sort` |
This file contains 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
@Test | |
public void testBase64() throws IOException { | |
String s = "the CAT sat on the MAT"; | |
String enc = "dGhlIENBVCBzYXQgb24gdGhlIE1BVA=="; | |
String sunMiscVersion = new String(new sun.misc.BASE64Decoder().decodeBuffer(enc), "utf8"); | |
String commonsVersion = new String(Base64.getDecoder().decode(enc), "utf8"); | |
Assert.assertThat(commonsVersion, is(sunMiscVersion)); | |
Assert.assertThat(commonsVersion, is(s)); |
This file contains 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 org.junit.Test | |
import kotlin.test.assertEquals | |
// kata for converting an arabic integer to roman numerals | |
// see https://www.youtube.com/watch?time_continue=953&v=vX-Yym7166Y | |
// where it is done in ruby | |
private val constants: Map<Int, String> = hashMapOf( | |
1 to "I", | |
4 to "IV", |
This file contains 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
@Test | |
public void mapEachTraderToTheSumOfTheirTransactions() { | |
//TODO: Create a Map<String, Integer> that maps each Trader's name with the sum of all its Transactions’ values | |
Map<String, Integer> mapNameToSumValue = new HashMap<>(); | |
mapNameToSumValue = | |
transactions.stream() | |
.collect(groupingBy(transaction -> transaction.getTrader().getName(), | |
summingInt(transaction -> transaction.getValue()) |