Skip to content

Instantly share code, notes, and snippets.

@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 -
@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));
# 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 / gist:474eac5494c4999e2ae9140cdcaf9b6a
Created February 18, 2017 01:34
Graal/truffel sporadic exception org.graalvm.compiler.code.SourceStackTraceBailoutException
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building pascal 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ pascal ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/karl/src/pascal-truffle/pascal/src/main/resources
[INFO]
@karl82
karl82 / InstanceOfTest.java
Created June 4, 2016 19:24
null instanceof Anything is always false
import org.testng.annotations.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
public class InstanceOfTest {
@Test
public void testNullInstanceOf() throws Exception {
for c in `brew cask list`; do ! brew cask info $c | grep -qF "Not installed" || echo $c; done
@karl82
karl82 / brew-cask-upgrade-all
Last active March 25, 2016 23:05
brew cask upgrade existing
for c in `brew cask list`; do ! brew cask info $c | grep -qF "Not installed" || (brew cask uninstall --force $c && brew cask install $c); done
# Path to your oh-my-zsh installation.
export ZSH=/Users/####/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
colorscheme darkblue
@karl82
karl82 / gist:ef5b8e2e39ea13927725
Last active September 25, 2015 09:49 — forked from hay/gist:1351230
Enterprisify your Java Class Names!
<!doctype html>
<html>
<head>
<title></title>
<style>
body {
background: white;
text-align: center;
padding: 20px;
font-family: Georgia, serif;