Slide 1

Slide 1 text

Text Tools @abelar_s // maitre-du-monde.fr Old (Unix) text tools we forgot.

Slide 2

Slide 2 text

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.

Slide 3

Slide 3 text

Table Of Contents Text formatting Diagrams Plots Toolbox Here are a few use cases I’d like to help with.

Slide 4

Slide 4 text

Text formatting .txt .md .tex You know plain text and probably know markdown. (@happynoff published mustdown and a talk about it)

Slide 5

Slide 5 text

\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?

Slide 6

Slide 6 text

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...

Slide 7

Slide 7 text

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.

Slide 8

Slide 8 text

Gnuplot Same here. I know and used a lot of JS graphs. What if you just want PNGs (or SVGs) for consistency?

Slide 9

Slide 9 text

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.

Slide 10

Slide 10 text

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?

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

Graphviz How would you make this class-like diagram? You’d generate simple text files, run it, and ship the docs!

Slide 13

Slide 13 text

Graphviz "node10" [ shape = "record" label = " (nil)| | |-1" ]; "node11" [ shape = "record" label = " (nil)| | |-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!

Slide 14

Slide 14 text

Queries sed awk find If you skipped on these, do yourself a favor: learn them. They’re everywhere, and they’ll save your ***

Slide 15

Slide 15 text

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!

Slide 16

Slide 16 text

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? ;)