favicon mika @ schillinger's lab

Removing watermarks and other clutter from manuscripts

June 22, 2022, 12:51 PM

Consider reading a manuscript that includes automatically generated watermarks/metadata on each page, which covers some of the text. Additionally, the document is split into several PDFs. After the third page of the second PDF referencing something from the first PDF you might wonder, if you can remove that clutter and merge the cleaned PDFs.

#!/usr/bin/env bash
## file: script.sh

## directory structure
# $ tree
#   .
#   ├── 1.pdf
#   ├── 2.pdf
#   ├── 3.pdf
#   ├── 4.pdf
#   ├── orig_merged.pdf
#   ├── script.sh
#   └── workdir
#       ├── 1.pdf
#       ├── 2.pdf
#       ├── 3.pdf
#       ├── 4.pdf
#       ├── clean_compressed.pdf
#       └── clean.pdf
#   
#   1 directory, 12 files

mkdir -p workdir

for f in ...

Read more...

Folding Julia code regions in Visual Studio Code

March 12, 2021, 7:10 PM

Folding long regions of code can improve readability and help getting a better view of what a file contains. As of now, Visual Studio Code does not provide a possibility to define custom folding rules (PR) and the default folding is rather unsatisfying when it comes to Julia source code.

Until we get custom folding in VS Code, I'm using Explicit Folding (v0.8.2) with the following settings in settings.json

{
    "editor.showFoldingControls": "always",
    "editor.foldingStrategy": "auto",

    "folding": {
        "*": [
            {
                "begin": "##region",
                "end": "##endregion"
            },
            {
                "begin": "##docs",
                "end": "##enddocs"
            },
            {
                "beginRegex": "\"\"\"",
                "endRegex": "\"\"\"",
            }
        ]
    },
}

Keep in mind the correct JSON syntax and don't forget the ...

Read more...