Launch H2 shell

2017-06-10
coursier launch com.h2database:h2:5:1.4.195 --main-class org.h2.tools.Shell

Rendering GraphViz for web

2017-06-09

GraphViz is a brilliant vendor-independent way of creating graphs and having them render into multiple formats such as SVG.

We can achieve stuff like this:

Just managed to map an #SBT project to an #SVG diagram. Clicking a node takes you to the project folder. https://t.co/IKr8eMkogp pic.twitter.com/9btcMAdKzk

— William Narmontas (@ScalaWilliam) May 27, 2017

Two options:

Render on the client-side
Can use Viz-JS (GitHub).
Very easy to use:
<script src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/1.8.0/viz-lite.js"
    integrity="sha256-lLBbzF3IYSscIpBw/KgKjF1dDWMQdz1RWZnEdnNSDxA=" crossorigin="anonymous"></script>

    <script type="text/javascript">
    document.querySelector("#target").innerHTML = Viz(dotString, {format: "svg"});
    flw.innerHTML = image;
</script>
            
            
Render on the server-side
nidi3/graphviz-java
More powerful, can do XSL transforms, etc, etc, before serving SVG
Specific library however uses a V8 layer which seemed unstable to me.

Hub @ GitHub

Very useful utility, can just type hub push for example.

Scale stuff

Begin by using the non-scalable thing.

Then don't forget to scale.

These are just some ideas, non-committal I am.

Fast to useUsage scales
Markdown, Google Docs HTML, XML
Python, JavaScriptScala, Haskell
GitHub Self hosted
Twitter, Medium, Quora Self hosted

Execute XSLT in one line

Using Saxon and Coursier

coursier launch net.sf.saxon:Saxon-HE:9.7.0-18 --main net.sf.saxon.Transform -- -s:source -xsl:stylesheet -o:output

Very useful when you want to run an XSLT transform..

May 27, 2017

Convert BPMN to SVG via command line

Not very pretty at all but could be improved with a better XSLT sheet. Way better than manual clicking:

$ wget https://raw.githubusercontent.com/trevershick/example-bpmn-dot-render/a1c1287bf19b1e1310cbbcfd37e767e71d651812/src/main/resources/xsl/bpmn.dot.xsl
$ coursier launch net.sf.saxon:Saxon-HE:9.7.0-18 --main net.sf.saxon.Transform -- -s:diagram.bpmn -xsl:bpmn.dot.xsl -o:diagram.dot
$ dot -Tsvg -o diagram.svg diagram.dot

I also filed an issue on bpmn-js.

Identity XSLT transform

wget -O test.xsl 'https://git.io/vHnat'

Also used the git.io Link Shortener for this.

Split a Git repository

Suppose you now want to split away a project but keep the commit history in Git.

$ git filter-branch --tree-filter 'mkdir new-repo; mv x y z new-repo || true' HEAD
...
$ git filter-branch --prune-empty -f --subdirectory-filter new-repo -- --all

Why does software take so long?

When a non-techie asks you why you take so long to get the thing done, this is what you tell them. #softwarehttps://t.co/dpB156iqpv

— William Narmontas (@ScalaWilliam) April 15, 2017

BlueGriffon Entity conversions

BlueGriffon converts entities to their direct characters, which then don't render.

To fix this, go to 'Preferences' > 'Source' > 'Serialization' > 'Output the following characters as entities' > 'All HTML4 special characters'.

JSON array to TSV?

Yep, doable with jq. Useful when you want to process data with CLI tools more easily.

Example:

curl -s 'https://actionfps.com/players/?format=json' | jq -r '.[] | [.id, .nickname.nickname] | @tsv'

#json array to #tsv with #jq: `curl -s 'https://t.co/NbmkSBPzSz' | jq -r '.[] | [.id, .nickname.nickname] | @tsv'` so nice.

— William Narmontas (@ScalaWilliam) May 11, 2017