Text Tools

Text Tools

Reintroducing text tools you might have forgotten.
LaTeX, Ditaa, Gnuplot, the Graphviz Family (dot, neato...)

1c737f6bf76c2f983c77446629a188d8?s=128

Sylvain Abélard

July 01, 2014
Tweet

Transcript

  1. 2.

    It’s all text! - Write it - Copy it -

    Paste it - Store it - Upgrade it - Share it - Git it - Convert it - Standard it - Generate it Text is awesome because you can do all of this quickly, easily, and while singing to Daft Punk.
  2. 3.
  3. 4.

    Text formatting .txt .md .tex You know plain text and

    probably know markdown. (@happynoff published mustdown and a talk about it)
  4. 5.

    \LaTeX \documentclass{minimal} \begin{document} \[\sum_{n=1}^{+\infty}\frac{1}{n^2}= \frac{\pi^2}{6}.\] \end{document} LaTeX is like a

    program by Don Knuth to produce docs. LaTeX loves science and math. Isn’t it beautiful?
  5. 6.

    Ditaa If you generate docs, you might want to include

    diagrams. It would be a pain to do it in HTML, but what if this...
  6. 7.

    Ditaa +--------+ +-------+ +-------+ | | --+ ditaa +--> |

    | | Text | +-------+ |diagram| |Document| |!magic!| | | | {d}| | | | | +---+----+ +-------+ +-------+ : ^ | Lots of work | +-------------------------+ Could be generated out of this? It’s DITAA magic! Super cool for the notes you took during the meeting.
  7. 8.

    Gnuplot Same here. I know and used a lot of

    JS graphs. What if you just want PNGs (or SVGs) for consistency?
  8. 9.

    Gnuplot set multiplot layout 3, 1 title "Multiplot layout 3,

    1" set tmargin 2 set title "Plot 1" unset key plot sin(x)/x # set title "Plot 2" unset key plot 'silver.dat' using 1:2 ti 'silver.dat' # set style histogram columns set style fill solid set key autotitle column set boxwidth 0.8 set format y " " set tics scale 0 set title "Plot 3" plot 'immigration.dat' using 2 with histograms, \ '' using 7 with histograms , \ '' using 8 with histograms , \ '' using 11 with histograms # unset multiplot Well here’s gnuplot: don’t be afraid, the syntax is simple. Here we got three graphs, and the magic is data loading.
  9. 10.

    set multiplot layout 3, 1 title "Multiplot layout 3, 1"

    set tmargin 2 set title "Plot 1" unset key plot sin(x)/x # set title "Plot 2" unset key plot 'silver.dat' using 1:2 ti 'silver.dat' # set style histogram columns set style fill solid set key autotitle column set boxwidth 0.8 set format y " " set tics scale 0 set title "Plot 3" plot 'immigration.dat' using 2 with histograms, \ '' using 7 with histograms , \ '' using 8 with histograms , \ '' using 11 with histograms # unset multiplot #2 options actual plot #1 options actual plot #3 options actual plot loading data So how does that compare to all the boilerplate you used to code just to use your super framework?
  10. 11.

    Graphviz rg2->green2; yr2->safe1; yr2->red2; safe2->rg2; green2->gy2; yellow2->yr2; red2->rg2; gy1->yellow1; rg1->green1;

    yr1->safe2; yr1->red1; safe1->rg1; green1->gy1; yellow1->yr1; red1->rg1; relations Here’s a state machine diagram. Automatic layout. All I did was just set up relations like nodeA -> nodeB
  11. 12.

    Graphviz How would you make this class-like diagram? You’d generate

    simple text files, run it, and ship the docs!
  12. 13.

    Graphviz "node10" [ shape = "record" label = "<f0> (nil)|

    <f1> | <f2> |-1" ]; "node11" [ shape = "record" label = "<f0> (nil)| <f1> | <f2> |-1" ]; "node0":f1 -> "node2":f0 [ id = 1 ]; "node1":f0 -> "node3":f0 [ id = 2 ]; define node content and options define node content and options define relations content and options It’s pretty easy to learn, and “just works”. Define nodes, define relations, you’re done!
  13. 14.

    Queries sed awk find If you skipped on these, do

    yourself a favor: learn them. They’re everywhere, and they’ll save your ***
  14. 15.

    Queries http://stedolan.github.io/jq/tutorial/ https://github.com/ggreer/the_silver_searcher https://github.com/harelba/q gem list --local | ./q "select

    c2 from -" If you got lazy and can only remember SQL syntax, wouldn’t it be nice to have this? Well you can!
  15. 16.

    Questions? Thanks! @abelar_s // maitre-du-monde.fr Questions included “did you forget

    cut, tr, grep?” Well if you know Ruby, you know these ones, right? ;)