Tealdeer Pages
Table of Contents
This is for configuring tealdeer, a command-line help system.
- The expected folder in this repository to put these pages is
dingehaufen/tealdeer/pages/. - The default location that
tealdeerwill look for the pages is \(~/.local/share/tealdeer/pages/~\) so maybe symlink it there. - The pages that come with
tealdeerare at \(~/.cache/tealdeer/tldr-pages/pages/\) (look here for examples)
Patches
These are patches which extend existing help pages rather than replacing them. If you want to add a new command or replace the existing tealdeer help you would use pages instead (they go in the same folder, there's just a different file-name convention).
gs
This is for ghost script.
Black and White PDF
This is to convert a PDF's text and vector images to Black and White to make it easier to read when printed. From a Ask Ubunt (Stack Exchange) answer.
In the cases I've tried this doesn't convert raster images.
- Convert PDF text to black and white (not grayscale)
`gs -sDEVICE=pdfwrite -dBlackText -dBlackVector -dNOPAUSE -dBATCH -sOutputFile={{output-file-name}} {{pdf-input-file-name}}`
Virtual Fish
Check The Environment
This adds the build-state for the virtual-environments managed by virtualfish.
- List Environments and the Current State (do they need to be rebuilt?):
`vf ls --details`
Rebuild the Environment
This is the command to use after an Ubuntu upgrade where they change the python version and all the virtual environments are broken.
- Rebuild the current environment (e.g. after Ubuntu changes pip):
`vf upgrade --rebuild`
You can also rebuild a specific environment (not necessarily the one you're in).
- Rebuild a specific environment
`vf upgrade --rebuild {{virtualenv-name}}`
If the environments are broken by an update, pipx is likely broken too, run this too, maybe:
pipx reinstall-allpip install setuptools --upgrade
pdfjam
Resize to Letter
- Resize PDF document to letter-paper size
`pdfjam {{input-file}} --paper letter --outfile {{output-file-name}}`
`pdfjam {{input-file}} --papersize 8.5in,11in --outfile {{output-file-name}}`
Emacs
Open File With Sudo
Got this from a Stack Overflow Question. The user's question is asking for an alternative way to do this, but the answers tell him that it's the best way to do it after all (he thought it was using SSH but it uses a sub-shell).
- Open a (local) file with sudo.
`C-x C-f /sudo::/path/to/file`
Use a Different Init.el
This is to use a different init.el file (presumably for debugging).
- Use a different initialization file when starting up:
`emacs --init-directory={{path/to/directory-with-init/}}`
Image Magick
Remove PDF Background
This assumes a image "density" for the background and converts the pages to images so the output file will likely be much larger. It might be best to use this for printing and then deleting the converted PDF.
- Remove background of PDF assuming the image density
`magick convert -density 300 {{path/to/input.pdf}} -white-threshold 80% {{path/to/output.pdf}}`
I also tried removing the background color specifically but doing that eats into everything that sits above the background as well (removes the anti-aliasing overlap, I assume).
Pages
These are pages - whatever you put in a page file will be the starting point for the tealdeer entry - these will either start a new tealdeer entry or will clobber any exsting one that came with tealdeer. The thing that tells tealdeer that it's a page and not a patch is that the filename ends with page.md instead of patch.md. Otherwise the contents look the same.
MakeMKV Command Line
The makemkvcon command has a --help output, which is somewhat vague. I got the information for this from a developers text file usage.txt on makemkv.com/developers. Normally I use the GUI but sometimes it crashes due errors specific to the GUI so the command line interface is useful to work around those cases.
List Drives
This lists the drives as makemkvcon sees them.
--robot: meant for automation, tells the program to output the information to the screen--cache=1: reduce the cache size (optional)info: the sub-command to print informationdisc:9999: show discs (not files, etc.)
- List drives - DRV:index,visible,enabled,flags,drive name,disc name
`makemkvcon --robot --cache=1 info disc:9999`
The output looks something like:
MSG:1005,0,1,"MakeMKV v1.18.2 linux(x64-release) started","%1 started","MakeMKV v1.18.2 linux(x64-release)"
DRV:0,2,999,1,"DVD+R-DL HL-DT-ST DVDRAM GSA-T50N RQ01 KWF9AEJ1028","MAD_MAX_FURY_ROAD","/dev/sr0"
With more lines below it. The second line is the one I'm interested in. It has the format:
`DRV:index,visible,enabled,flags,drive name,disc name`
This table shows what their text file says the fields mean.
| Field | Description |
|---|---|
| DRV | This is a drive |
| index | The number we'll use to refer to the drive |
| visible | 1 if drive is present |
| enabled | 1 if drive is accessible |
| flags | media flags (see AP_DskFsFlagXXX in apdefs.h) |
| drive name | drive name string |
| disc name | disc name string |
Looking at the sample output, it would appear that the drive isn't present or accessible, which doesn't seem right so I just ignore everything but the drive name to find the right entry in the output and the index for use in invoking makemkvcon.
Copy Disc As MKV Files
- Save disk to the current directory as MKV files
`makemkvcon mkv disc:{{index}} all .`
- Save disk to another directory as MKV files
`makemkvcon mkv disc:{{index}} all {{/absolute-path-to-folder/}}`
The sample shows the output being copied to `c:\folder` which is a DOS format (I think). It didn't seem to work when I used a relative path (other than the current directory) so I assume you need to use the full path starting from /home/.