April 10, 2021

[Note] convert, memory allocation failed, attempt to perform an operation not allowed

Trying to convert multiple image files to a PDF file:

$ convert *.gif output.pdf

Then I got bunch of errors such as:

convert-im6.q16: memory allocation failed `302.gif' @ error/gif.c/ReadGIFImage/1303.

This is due to insufficient memory, and can be fixed in ImageMagick policy file.

First, find where the policy file is by running this command:

$ identify -list policy | more

Mine is in /etc/ImageMatick-6/policy.xml

$ identify -list policy | more

Path: /etc/ImageMagick-6/policy.xml
  Policy: Resource
    name: disk

Edit the file and allocate more memory:

$ sudo vi /etc/ImageMagick-6/policy.xml

Find this line and change its value.  I have 64GB memory, allocated 32GB:

<policy domain="resource" name="memory" value="32GiB"/>

I ran, but encountered another error:

$ convert *.gif output.pdf
convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408.

Again, this is due to the policy.  Edit the file again and remove or comment out these lines:

<policy domain="coder" rights="none" pattern="PS" />
<policy domain="coder" rights="none" pattern="PS2" />
<policy domain="coder" rights="none" pattern="PS3" />
<policy domain="coder" rights="none" pattern="EPS" />
<policy domain="coder" rights="none" pattern="PDF" />
<policy domain="coder" rights="none" pattern="XPS" />

Then it worked fine.




April 2, 2021

Learning Quantum Computing, Qiskit

Quantum Computing courses

The Introduction to Quantum Computing

Physical Basics of Quantum Computing

Quantum Computing. Less Formulas - More Understanding






[Old Tech] Alpine mail client, Spreadsheet Calculator

Terminal Email Client

Long time ago, when I used Solaris -- I used mail, then elm, then pine.  I really liked elm for its simplicity, lightweight.  

I couldn't find elm for Linux or its clone, but found Alpine which is Apache License Pine.

 There are plenty of web sites showing how to set up Alpine for Gmail, so won't put another step here.  Just visit this page, for example - https://www.xmodulo.com/gmail-command-line-linux-alpine.html


Terminal Spreadsheet

There is a terminal version of spreadsheet -- feels like VisiCalc or Lotus 1-2-3.  It's called Spreadsheet Calculator (SC), https://en.wikipedia.org/wiki/Sc_(spreadsheet_calculator)

It's pretty useful sometimes when you are stuck in terminal, or want to do quick calculation.  

See these pages for usage,