Re: Org export to HTML with encrypted information ??

2019-11-29 Thread wry

Hi,
Here's a simpler flow. See if it would support your use case:

Modern PDF readers support password
encryption. org-latex-export-to-pdf, then encrypt the file and share
it with your family. If you want to keep it offline, give them USB
drives. It's not too late to get black Friday deals on the 2.0 sticks.

Write the password on a sticky note and stick it on your fridge. 


If you're worried about the integrity of the org file on your own
computer, make it a .gpg file instead, and stick something like:

# -*- mode:org; epa-file-encrypt-to: ("y...@email.com") -*-

at the top.

Nick



Re: “Literate” python?

2019-11-29 Thread Norman Walsh
Diego Zamboni  writes:
> Hi Norm,
>
> As George said, the trick in this case is to use the =:noweb= and
> =:noweb-ref= headers. The change is minimal from the script you
> sent:

Thanks. With your help (and Barry’s and George’s), I got over the
initial hurdles. I wrote about it here:
https://so.nwalsh.com/2019/11/29/t2

> If I may do a bit of self-promotion, feel free to check out my
> "Literate Config" booklet, which I published just a few days ago
> (available for free) and which contains some more tips for doing
> literate programming: https://leanpub.com/lit-config/read

Purchased. Authors gotta get paid. :-)

Be seeing you,
  norm

-- 
Norman Walsh  | The First Amendment is often
http://nwalsh.com/| inconvenient. But that is besides the
  | point. Inconvenience does not absolve
  | the government of its obligation to
  | tolerate speech.--Justice Anthony
  | Kennedy, in 91-155


signature.asc
Description: PGP signature


Re: “Literate” python?

2019-11-29 Thread Diego Zamboni
Hi Norm,

As George said, the trick in this case is to use the =:noweb= and
=:noweb-ref= headers. The change is minimal from the script you sent:

#+TITLE: Python literate programming
#+OPTIONS: html-postamble:nil

It starts off as a completely standard Python3 program.

#+BEGIN_SRC python :tangle yes :weave no
#!/usr/bin/env python3
#+END_SRC

It defines ~a~.

#+BEGIN_SRC python :tangle yes
def a():
print("a")

#+END_SRC

And ~b~.

#+BEGIN_SRC python :tangle yes
def b():
print("b")

#+END_SRC

Now ~c~ is a little more complicated:

#+BEGIN_SRC python :tangle yes :noweb no-export
def c():
   print("c")
   <>
#+END_SRC

Not only does ~c~ print “c”, it calls ~a()~ and ~b()~.

#+BEGIN_SRC python :tangle no :noweb-ref call-a-and-b
   b()
   a()
#+END_SRC

Finally, make it importable. Not that you’d want to.

#+BEGIN_SRC python :tangle yes
if __name__ == "__main__":
main()
#+END_SRC

Note the =:noweb no-export= in the block that contains =def c()=. The
=no-export= value makes it so that, on HTML export, the noweb reference is
shown as a reference instead of expanded (which is usually what you want).
The next block is given its name using the =:noweb-ref= header argument.
You could also use =#+name:= - the main difference is that =:noweb-ref=
allows you to have multiple blocks with the same name, which are
concatenated together when tangled, whereas =#+name:= only allows one block
with the same name.

If I may do a bit of self-promotion, feel free to check out my "Literate
Config" booklet, which I published just a few days ago (available for free)
and which contains some more tips for doing literate programming:
https://leanpub.com/lit-config/read

Best,
--Diego


On Fri, Nov 29, 2019 at 7:09 PM Norman Walsh  wrote:

> Hi,
>
> I’ve seen a couple of pointers recently to using Org mode and tangle
> to write more literate Emacs configurations. I use Org+babel all the
> time to write “interactive” documents, so I thought I’d try out tangle
> from Org.
>
> I didn’t want to start with something as comlicated as my Emacs
> config :-) so I figured I’d kick the tires with a small python
> program. That did not end well.
>
> Consider:
>
> #+TITLE: Python literate programming
> #+OPTIONS: html-postamble:nil
>
> It starts off as a completely standard Python3 program.
>
> ---%<--
> #+BEGIN_SRC python :tangle yes :weave no
> #!/usr/bin/env python3
>
> #+END_SRC
>
> It defines ~a~.
>
> #+BEGIN_SRC python :tangle yes
> def a():
> print("a")
>
>
> #+END_SRC
>
> And ~b~.
>
> #+BEGIN_SRC python :tangle yes
> def b():
> print("b")
>
>
> #+END_SRC
>
> Now ~c~ is a little more complicated:
>
> #+BEGIN_SRC python :tangle yes
> def c():
>print("c")
> #+END_SRC
>
> Not only does ~c~ print “c”, it calls ~a()~ and ~b()~.
>
> #+BEGIN_SRC python :tangle yes
>b()
>a()
> #+END_SRC
>
> Finally, make it importable. Not that you’d want to.
>
> #+BEGIN_SRC python :tangle yes
> if __name__ == "__main__":
> main()
> #+END_SRC
> --->%--
>
> That’s the script. It weaves into HTML more-or-less ok (there’s a
> weird black box at the front of indented lines, but I can come back to
> that later).
>
> It’s a complete mess when tangled.
>
> The extra blank lines between functions (to make pylint happy with
> some PEP guideline) have disappeared. I guess I could live with that,
> but the complete failure to preserve indention in the penultimate code
> block is a show stopper:
>
> #!/usr/bin/env python3
>
> def a():
> print("a")
>
> def b():
> print("b")
>
> def c():
>print("c")
>
> b()
> a()
>
> if __name__ == "__main__":
> main()
>
> (Also, why is there an extra blank line before the incorrectly
> indented block?)
>
> Is this user error on my part somehow? I suppose I could write my own
> version of tangle, though I’m not clear if the whitespace is lost in
> the tangle function or in the Org mode data model.
>
> Thoughts?
>
> Be seeing you,
>   norm
>
> --
> Norman Walsh  | We discover in ourselves what others
> http://nwalsh.com/| hide from us, and we recognize in
>   | others what we hide from
>   | ourselves.--Vauvenargues
>


Re: “Literate” python?

2019-11-29 Thread Norman Walsh
George Mauer  writes:
> I've used noweb references to actually assemble what will be tangled
> all at once. See how I did it here.

Thanks.

> Also I'm pretty sure there's no :weave header arg...at least I
> haven't seen it used and can't find it documented anywhere.

No, that was just me guessing. Thanks for the pointers.

Be seeing you,
  norm

-- 
Norman Walsh  | A child becomes an adult when he
http://nwalsh.com/| realizes he has a right not only to be
  | right but also to be wrong.--Thomas
  | Szasz


signature.asc
Description: PGP signature


Re: “Literate” python?

2019-11-29 Thread Norman Walsh
"Berry, Charles"  writes:

> A couple of things might help.
>
> First, use the :noweb-ref argument to mark each of the code blocks
> you wish to tangle.
[…]
> The remaining problem (as you will see) is the indentation. Fix this
> by adding the `-i' flag to the penultimate code block, viz.
[…]
> See 12.6 Literal Examples and 15.10 Noweb Reference Syntax in the manual.

Thank you. I had failed to locate the relevant manual sections. Those
changes did appear to resolve the issues and I’ll study the docs with
a little more care!

Be seeing you,
  norm

-- 
Norman Walsh  | To enjoy yourself and make others enjoy
http://nwalsh.com/| themselves, without harming yourself or
  | any other; that, to my mind, is the
  | whole of ethics.--Chamfort


signature.asc
Description: PGP signature


Re: “Literate” python?

2019-11-29 Thread George Mauer
I've used noweb references to actually assemble what will be tangled all at
once. See how I did it here

.

The reason why the "incorrect" block is outdented is that tangle
automatically tries to guess indentation level. (Take that as a handwavy
thing - I don't know exactly how it does that nor how configurable it is)
The solution I've found is noweb - basically you *wouldn't* tangle any of
those blocks, but would create another non-evaluated or exportable block
that has noweb references to the above blocks and how you want them
arranged. *This* is the block you tangle.

I haven't yet figured out how, but it should be possible to automatically
configure things to run autopep8 after tangling - that would take care of
indentation issues.

Also I'm pretty sure there's no :weave header arg...at least I haven't seen
it used and can't find it documented anywhere.

On Fri, Nov 29, 2019 at 12:08 PM Norman Walsh  wrote:

> Hi,
>
> I’ve seen a couple of pointers recently to using Org mode and tangle
> to write more literate Emacs configurations. I use Org+babel all the
> time to write “interactive” documents, so I thought I’d try out tangle
> from Org.
>
> I didn’t want to start with something as comlicated as my Emacs
> config :-) so I figured I’d kick the tires with a small python
> program. That did not end well.
>
> Consider:
>
> #+TITLE: Python literate programming
> #+OPTIONS: html-postamble:nil
>
> It starts off as a completely standard Python3 program.
>
> ---%<--
> #+BEGIN_SRC python :tangle yes :weave no
> #!/usr/bin/env python3
>
> #+END_SRC
>
> It defines ~a~.
>
> #+BEGIN_SRC python :tangle yes
> def a():
> print("a")
>
>
> #+END_SRC
>
> And ~b~.
>
> #+BEGIN_SRC python :tangle yes
> def b():
> print("b")
>
>
> #+END_SRC
>
> Now ~c~ is a little more complicated:
>
> #+BEGIN_SRC python :tangle yes
> def c():
>print("c")
> #+END_SRC
>
> Not only does ~c~ print “c”, it calls ~a()~ and ~b()~.
>
> #+BEGIN_SRC python :tangle yes
>b()
>a()
> #+END_SRC
>
> Finally, make it importable. Not that you’d want to.
>
> #+BEGIN_SRC python :tangle yes
> if __name__ == "__main__":
> main()
> #+END_SRC
> --->%--
>
> That’s the script. It weaves into HTML more-or-less ok (there’s a
> weird black box at the front of indented lines, but I can come back to
> that later).
>
> It’s a complete mess when tangled.
>
> The extra blank lines between functions (to make pylint happy with
> some PEP guideline) have disappeared. I guess I could live with that,
> but the complete failure to preserve indention in the penultimate code
> block is a show stopper:
>
> #!/usr/bin/env python3
>
> def a():
> print("a")
>
> def b():
> print("b")
>
> def c():
>print("c")
>
> b()
> a()
>
> if __name__ == "__main__":
> main()
>
> (Also, why is there an extra blank line before the incorrectly
> indented block?)
>
> Is this user error on my part somehow? I suppose I could write my own
> version of tangle, though I’m not clear if the whitespace is lost in
> the tangle function or in the Org mode data model.
>
> Thoughts?
>
> Be seeing you,
>   norm
>
> --
> Norman Walsh  | We discover in ourselves what others
> http://nwalsh.com/| hide from us, and we recognize in
>   | others what we hide from
>   | ourselves.--Vauvenargues
>


“Literate” python?

2019-11-29 Thread Norman Walsh
Hi,

I’ve seen a couple of pointers recently to using Org mode and tangle
to write more literate Emacs configurations. I use Org+babel all the
time to write “interactive” documents, so I thought I’d try out tangle
from Org.

I didn’t want to start with something as comlicated as my Emacs
config :-) so I figured I’d kick the tires with a small python
program. That did not end well.

Consider:

#+TITLE: Python literate programming
#+OPTIONS: html-postamble:nil

It starts off as a completely standard Python3 program.

---%<--
#+BEGIN_SRC python :tangle yes :weave no
#!/usr/bin/env python3

#+END_SRC

It defines ~a~.

#+BEGIN_SRC python :tangle yes
def a():
print("a")


#+END_SRC

And ~b~.

#+BEGIN_SRC python :tangle yes
def b():
print("b")


#+END_SRC

Now ~c~ is a little more complicated:

#+BEGIN_SRC python :tangle yes
def c():
   print("c")
#+END_SRC

Not only does ~c~ print “c”, it calls ~a()~ and ~b()~.

#+BEGIN_SRC python :tangle yes
   b()
   a()
#+END_SRC

Finally, make it importable. Not that you’d want to.

#+BEGIN_SRC python :tangle yes
if __name__ == "__main__":
main()
#+END_SRC
--->%--

That’s the script. It weaves into HTML more-or-less ok (there’s a
weird black box at the front of indented lines, but I can come back to
that later).

It’s a complete mess when tangled.

The extra blank lines between functions (to make pylint happy with
some PEP guideline) have disappeared. I guess I could live with that,
but the complete failure to preserve indention in the penultimate code
block is a show stopper:

#!/usr/bin/env python3

def a():
print("a")

def b():
print("b")

def c():
   print("c")

b()
a()

if __name__ == "__main__":
main()

(Also, why is there an extra blank line before the incorrectly
indented block?)

Is this user error on my part somehow? I suppose I could write my own
version of tangle, though I’m not clear if the whitespace is lost in
the tangle function or in the Org mode data model.

Thoughts?

Be seeing you,
  norm

-- 
Norman Walsh  | We discover in ourselves what others
http://nwalsh.com/| hide from us, and we recognize in
  | others what we hide from
  | ourselves.--Vauvenargues


signature.asc
Description: PGP signature


Re: Org export to HTML with encrypted information ??

2019-11-29 Thread George Mauer
Basic "I'm not too worried about it" level of security: stick it on a
webserver using .htaccess to demand a password. Make that password halfway
decent.

Better option: export to PDF by either exporting to HTML or latex and then
using that system's PDF export. Keep both PDF and original in a folder on
Google drive or Dropbox that is shared only with those who need access. (No
password needed at all so you won't have someone compromising you with a
crap password)

Best option: same thing but store those files in a respected password
manager like 1password or keepass. Train your family to use the password
manager. Use it as a vault for all sorts of "just in case, they should
know" info.

In theory, you could even automate things to work on a deadman's switch.
Have a system that pings you via email, SMS, or another communications
mechanism weekly. If you don't respond within a few days, it automatically
shares the aforementioned files using gdrive, Dropbox, 1password, etc (not
email though - email is not secure)

On Fri, Nov 29, 2019, 5:56 AM Marcin Borkowski  wrote:

>
> On 2019-11-29, at 08:24, David Masterson  wrote:
>
> > My use-case is this:
> >
> > I'd like to use Org to write up *all* the information about my family
> > life (so to speak) including medical histories of my family, issues with
> > the house, bank accounts, financial information, etc., so that my family
> > has all the information to refer to when necessary in a (hopefully)
> > well-structured form.  Naturally, this is going to have a fair amount of
> > really sensitive information.  By carefully outlining the information, I
> > can structure the sensitive information to be in key parts of the
> > documents that I can then encrypt using org-crypt.
> >
> > That part is straightforward.  The tricky part is that my family is not
> > "Emacs literate" and, so, I'm thinking the best idea is to export the
> > information from Org files to HTML files so that I can then present to
> > them as a website.  They are used to browsing the web, so this should be
> > more natural to them.  The problem that I'm looking for help with is how
> > to deal with the encrypted information?  Any suggestions?
>
> This is a very interesting and important question.  I don't have any
> advice, but I would very much like to hear what others have to say.
>
> While this does not answer your question (but is related): who is going
> to have the password/passphrase?  Have you considered using a secret
> sharing scheme?
>
> Best,
>
> --
> Marcin Borkowski
> http://mbork.pl
>
>


Re: Org export to HTML with encrypted information ??

2019-11-29 Thread Marcin Borkowski


On 2019-11-29, at 08:24, David Masterson  wrote:

> My use-case is this:
>
> I'd like to use Org to write up *all* the information about my family
> life (so to speak) including medical histories of my family, issues with
> the house, bank accounts, financial information, etc., so that my family
> has all the information to refer to when necessary in a (hopefully)
> well-structured form.  Naturally, this is going to have a fair amount of
> really sensitive information.  By carefully outlining the information, I
> can structure the sensitive information to be in key parts of the
> documents that I can then encrypt using org-crypt.
>
> That part is straightforward.  The tricky part is that my family is not
> "Emacs literate" and, so, I'm thinking the best idea is to export the
> information from Org files to HTML files so that I can then present to
> them as a website.  They are used to browsing the web, so this should be
> more natural to them.  The problem that I'm looking for help with is how
> to deal with the encrypted information?  Any suggestions?

This is a very interesting and important question.  I don't have any
advice, but I would very much like to hear what others have to say.

While this does not answer your question (but is related): who is going
to have the password/passphrase?  Have you considered using a secret
sharing scheme?

Best,

-- 
Marcin Borkowski
http://mbork.pl



Re: Org export to HTML with encrypted information ??

2019-11-29 Thread Colin Baxter
> David Masterson  writes:

> My use-case is this: I'd like to use Org to write up *all* the
> information about my family life (so to speak) including medical
> histories of my family, issues with the house, bank accounts,
> financial information, etc., so that my family has all the

I would strongly advise against including any financial or medical
information. All encryption is breakable given adequate resources. I
suggest that you would be providing sufficient motivation for someone 
to garner those resources.

-- 
Colin Baxter
www.Colin-Baxter.com