All This Programming, Machine Learning & Physics

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"}

Multiple Git Accounts

|

Often times people have two GitHub accounts - one for work and personal. Good post on how to manage these accounts here. As mentioned in one of the comments in the same post, it is also important to configure the ssh-agent to make this work.

And in case one gets mixed up with the two ids (before making the above change), this StackOverflow answer provides a way to clean it up. If you correctly implement the above steps, your ssh config will look like the following

#Default GitHub
Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_rsa
    IdentitiesOnly yes
Host github-<COMPANY>
    HostName github.<COMPANY>.com
    User git
    IdentityFile ~/.ssh/id_rsa_<COMPANY>
    IdentitiesOnly yes

In addition to the above steps, if there are any repositories in the your company’s Git that you have already checked out and after making the above changes, you would need to update them as well.

  1. The typical remote.origin.url for a repo looks like git@github.<COMPANY>.com:<ORG_OR_USER/PROJECT_NAME>.git. Change this to the correct URL git remote set-url origin git@github-<COMPANY>:<ORG_OR_USER/PROJECT_NAME>.git this will result the changed config remote.origin.url=git@github-<COMPANY>:ORG_OR_USER/<PROJECT_NAME>.git
  2. Change the email config to the correct email address git config --local user.email <your_email>@<COMPANY>.com if it is messed up due to the multiple accounts.