All This Programming, Machine Learning & Physics

Embed Pure HTML Inside a Jekyll Blog

|

There are many instances where we would like to include an entire HTML page inside a Jekyll blog. This is usually done using the Jekyll’s include directive. However for it to work, the included page has to be inside the _includes directory. There is also a include_relative directive, whose documentation is confusing at best. Also these include* mechanisms fail if a sufficiently complex HTML page (such as Tiddlywiki ) were to be included. The following solution which just uses a simple iFrame seems work work rather well:

  1. Create a directory in the root of the blog with some name, say files
  2. Drop the file to be included in that directory, say example.html.
  3. Add a code snippet similar to the below in a post.
<div id="included">
  <iframe height="500" width="800" scrolling="yes"
    src="/files/example.html"
    frameborder="no" allowtransparency="true" allowfullscreen="true">
  </iframe>
</div>

The output should look like the below.

Merging Multiple Latex Files

|

Many folks prefer writing different sections of the paper in separate tex files and including them in the main document using the include directive. This has several advantages:

  1. Coauthors often feel comfortable working on their individual sections.
  2. Makes versioning a little easier.
  3. Navigating is less painful.

There are situations where merging those sections into a single document is needed. For example, when some publications ask you to limit the number of files. After a little bit googling, this good old perl script seems to get the job done. To merge multiple sections run

    perl latexpand main.tex > merged.tex

Tiddlywiki

|

Tiddlywiki is an amazing piece of software. It promises being future proof as a feature:

If you’re starting to use TiddlyWiki at the beginning of your career you can be confident that it will carry you through to retirement.

It is a single HTML file with no additional dependencies after all! But don’t let that simplicity fool you - it is packed with features from audio support to encryption. And then there are tons of plugins contributed by the community. When compared to the many paid solutions for knowledge organization, it is quite powerful but costs nothing! Getting started with Tiddlywiki could be quite changing. But this YouTube video tutorial is very helpful.

You can also use the Tiddlywiki for collaborative editing using the awesome TiddlyServer project. There are docker wrappers available such as this one. To start a Tiddlywiki server follow the steps below on your local machine or a server instance.

    docker pull mazzolino/tiddlywiki
    mkdir your-wiki-name
    docker run -d -p 8080:8080 -v $(pwd)/<your-wiki-name>:/var/lib/tiddlywiki mazzolino/tiddlywiki

The folder your-wiki-name will contain the contents of your Tiddlywiki. Navigate to http://<server-name>:8080 to get started on setting up the wiki.

Useful links:

Move Firefox Tabs to the Side

|

With smaller laptops, vertical space comes at a premium. This is an inconvenience when reading long-form articles from news websites because of having to scroll constantly.
Especially when using a MacBook, the dock occupies about 10% of the screen height. One could hide the dock or move it to the side, but that is only part of the solution. For those using Firefox as their primary browser, it will be nice to be able to move the tabs to the side. This can be accomplished using the Tree Style Tab extension.

VS Code Hacks

|

VS Code doesn’t seem to have a keyboard shortcut for switching between editor and terminal windows. This is typical of the Electron JS apps don’t seem to pay too much attention to ergonomics. This Stackoverflow answer might just be the best solution for the problem:

// Toggle between terminal and editor focus
{ "key": "ctrl+`", "command": "workbench.action.terminal.focus"},
{ "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"}