Skip to content

Instantly share code, notes, and snippets.

# Better handling modified files
git status --porcelain --untracked-files=no| awk '/^.M/ { print $2;}' | while read file; do
hash=$(git log -n 1 --pretty=format:%h -- $file)
git commit --fixup $hash $file
done
@karl82
karl82 / InstantParseTest.java
Created June 16, 2020 18:08
Instant.parse difference between JDK11 and JDK13+
import java.time.Instant;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
public class InstantParseTest {
@ParameterizedTest
@ValueSource(strings = {"2019-12-20T00:00:00+00:00", "2019-12-19T16:00:00-08:00", "2019-12-20T00:00:00Z"})
public void parse(String text) {
System.out.println(Instant.parse(text));
@karl82
karl82 / gist:13d6ea7cf4ea86b1eea82e8f65540b6b
Created February 11, 2023 22:37
Extract invoice IDs from Apple Payments
gsed -n -e 's|.*Display.OrderID">\(.*\)</span.*|\1|p' \
-e 's|.*RAP2.PurchaseList.PLIDetails.Display.Title.*">\(.*\)</div></l.*|\1|p' \
-e 's|.*"RAP2.PurchaseList.PLIDetails.Display.Publisher.*>\(.*\)</div.*|\1|p' \
-e 's|.*pli-media-type.*>\(.*\)</div.*|\1|p' \
-e 's|.*PurchaseHeader.Display.Date.*>\(.*\)</span> .*|\1|p' < page.html \
|pr -5 -a -t -s';' |mvim -