akuszyk

joined 11 months ago
[โ€“] akuszyk@alien.top 1 points 11 months ago

Thanks; I use lsp-mode for Terraform, but I still find it very useful to be able to read the documentation for a provider in full, from the comfort of Emacs.

 

I just wanted to say thanks to /u/txgvnn for writing the terraform-doc package.

I find accessing Terraform provider documentation on the web to be a little cumbersome, and have often wished for a plain text experience similar to info manuals instead.

I recently decided to Google possible solutions, only to discover that /u/txgvnn had already written a package for it.

Thanks! I think it's awesome! ๐Ÿ™‚

 

Hello r/emacs! First-time poster here!

I recently wanted to visualise some data in org-mode using a Python source block to generate an image, which was then rendered directly in the buffer.

It took my a couple of goes to work out how to do it.

Given some data like this:

#+begin_src bash :results output file :file data.njson
echo '{"name": "Spock", "editor": "Emacs"}
{"name": "James Kirk", "editor": "Vim"}
{"name": "Dr McCoy", "editor": "Vim"}
{"name": "Scotty", "editor": "Emacs"}
{"name": "Worf", "editor": "ed"}
{"name": "Geordi LaForge", "editor": "Emacs"}
{"name": "Data", "editor": "Emacs"}
{"name": "Jean-luc Picard", "editor": "VS Code"}
{"name": "Wesley Crusher", "editor": "VS Code"}
{"name": "William Riker", "editor": "Vim"}
'
#+end_src

A visualisation can be rendered as follows:

#+begin_src python :results output file :file usage.png
import pandas as pd
import seaborn as sns
import sys

df = pd.read_json("data.njson", lines=True)
axes = sns.histplot(df, x="editor")
axes.get_figure().savefig(sys.stdout.buffer)
#+end_src

The main trick here is to set the :results output file header argument to write the output to a file, and to save the figure to sys.stdout.buffer from Python.

I've written about this on my blog too, where you can see the [unsurprising] results of the analysis!