Computing

Home | Computing | Cooking | MAT436

Printing at school from a phone.

Here I share some simple scripts which adjust the way programs are accessed in Windows. These were written with the view that programs made for a wide audience are too general to be well tuned to everyone's needs.

AutoHotkey
AutoHotkey is a scripting language which allows for easy implementation of keyboard shortcuts. My AutoHotkey.ahk file is available here. I primarily use AHK to toggle the active state of programs (cmd and email) that are always running in the background. I also use it to access keybinds within the Emacs editor buffer zone (where the Emacs keybinds are not accessible).

Computing at the University of Toronto
All external tools required for the programs under this section can be found here.

- AutoAuth
Description: Uses asymmetric cryptography to grant access to Coxeter.
Required programs: AutoAuth, Pageant, and PuTTYgen.

-
RunCoxeter
Description: Opens the Coxeter command-line interface.
Required program: AutoAuth, PuTTY.

-Blacklist
Description: Enter an email to server-side blacklist. Blacklisted senders' emails will be sent directly to SuspectedSpam and will be deleted with time.
Required program: AutoAuth, Plink.

-Print
Description: Takes a local file and prints it through Coxeter. Does not leave a copy of the file on Coxeter.
Required programs: AutoAuth, Plink, PSCP.

Emacs
Emacs is a sophisticated text editor with many packages which help type mathematics, and macros which are programmable in a way that facilitates collaboration.

Potentially problematic macros in .tex files occur with those which are local to a user. Take, for instance, macros of the form '$\R$' for '$\mathbb{R}$' or '$\eps$' for '$\epsilon$' or '$\varepsilon$' which are defined in the preamble. Problems arise if collaborators do not have the same macros defined. Emacs allows the use of macros similar to those mentioned to access the same functions while also benefiting from using language which is interpretable assuming only the presence of basic mathematics packages.

An Emacs macro can bind the string 'mb' to result in '\mathbb{R}' and 'pre' to result in the default .tex preamble with the text cursor aligned at the line following '\begin{document}'. The Emacs package AUCTeX allows the combination ` + 'e' to output '\epsilon' or ` + 've' to output '\varepsilon', among many others. AUCTeX also allows the combination CTRL + 'c' then CTRL + 'e' to begin a TheoremStyle environment. This combination prompts, in the buffer zone, the type of TheoremStyle environment one wishes to enter. If 'enumerate' is given, then the following text is the output with the text cursor placed immediately after '\item '.
\begin{enumerate}
\item
\end{enumerate}
If ALT + ENTER is pressed for a new line, then one gets a new line, a new item and the text cursor is aligned at the end of the last '\item '.
\begin{enumerate}
\item
\item
\end{enumerate}
These are just some of the many features that are available. Writing macros in Emacs is done through the initialization file and is often named 'init.el'. I have included my initialization file here so that one can see the other features I use and to get an idea of how Emacs can be programmed. Keybinds which are local to the Emacs editor cannot be accessed in the Emacs buffer zone. This can be circumvented with the use of AHK keybinds which can be defined to be local to Emacs.

File Manager
This file manager was made for efficient management of LaTeX files and files produced through a LaTeX compiler.

If Emacs.exe is running when this program is called, it exits Emacs and the DVI reader. Otherwise, the program's following features are accessible. From here on out, we will assume we are working in a given directory so that, for instance, if the given directory is C:\, the file path 512 is to be understood as C:\512. Its functions are accessed by inputs of the form `[command] [filename]'. The complete list of the commands is 1. write, 2. open, 3. compile, 4. dvi, 5. pdf. The filenames are required to be of one of the following three forms: i. a, ii. a-b, iii. a-b.c where a, b, c are strings that do not contain `-' or `.'.

We are now ready to describe the commands above by example. All commands except for compile are compatible with the three string types mentioned above. Compile must take type ii. strings.

1. The command `write 512-1.3' creates the file 512-1.3.tex in the directory 512\512-1\512-1.3\, creating all necessary folders along the way. Then it runs the command `open 512-1.3'.
2. The command `open 512-1.3' opens 512-1.3.tex and aligns the document to the left half of the screen on which it opened and also opens 512-1.3.dvi and aligns the document to the right half of the screen on which it opened.
3. The command `compile 512-1' reads the bodies of the .tex files from all immediate subfolders of 512-1 (that is, folders of the form 512-1-*) and compiles this information to 512-1.tex in the folder 512\512-1 in ascending alphabetical/numerical order.
4. The command `dvi 512-1.3' opens the file 512-1.3.dvi to display on the full screen.
5. The command `pdf 512-1.3' opens the file 512-1.3.pdf to display on the full screen.

This program is in the process of being rewritten in PowerShell.

Shortcuts
This is a PowerShell application which takes a string and runs files, applications, or links. The program is initiated through the command prompt by the input 'st'. Once activated, the permissible inputs are 'add', 'remove', 'view', or any stored string which has been mapped to run something.

Shortcuts was written in AHK at some point. It has since been rewritten in the much more expressive language PowerShell at the suggestion of my mother. This rewriting improved the program's capabilities and dramatically simplified the code.

-Shortcuts
Description: This is the program described. It needs an XML file to store the shortcuts. This file can be used to get started. These two files alone allow Shortcuts to run, but it is more conveniently accessed through the cmd.

-ExeShortcuts
Description: Runs Shortcuts through the cmd. This file can be placed in the startup folder if you wish for it to run whenever the computer starts.