Skip to content

Latest commit

 

History

History
359 lines (273 loc) · 12.3 KB

computer-usage.md

File metadata and controls

359 lines (273 loc) · 12.3 KB

Computer Usage

Tiny GUI Softwares

  • Show live battery information of Mac and iOS device
    coconut Battery
    brew info coconutbattery
  • Control volume slider each app
    Background Music
    brew info background-music

Libraries

Utility Websites

Editor

Visual Studio Code (vscode)

TeXstudio

Atom

Manually install an Atom package (ref):

git clone <package-repo>
cd package-name
apm install
apm link .

[Script Package] Change font size of output window (ref)

  • Open config file ~/.atom/packages/script/styles/script.less
  • Add property font-size: 14px;.
    .script-view {
      // [...]
    
      .line {
        border-radius: 0px;
        margin: 0px;
        padding: 0px;
        font-size: 14px;  // added here
      }
    }

DrRacket (IDE)

Shortcuts

  • Add line comment: Esc-Ctrl-;
  • Remove line comment: Esc-Ctrl-=

Ghostscript

Query settings:

MathJax

Typora (markdown editor)

MathJax config used by Typora for macOS, version 0.9.9.23.4 (2293).

/* /Applications/Typora.app/Contents/Resources/TypeMark/index.html */
<script type="text/x-mathjax-config" aria-hidden="true">
  MathJax.Hub.Config({
    skipStartupTypeset: true,
    jax: ["input/TeX", "output/SVG"],
    extensions: ["tex2jax.js", "toMathML.js"],
    TeX: {
      extensions: ["noUndefined.js", "autoload-all.js", "AMSmath.js", "AMSsymbols.js", "mediawiki-texvc.js"],
      mhchem: { legacy: false }
    },
    /* more */
  });
</script>

<script src="./lib/MathJax/MathJax.js" aria-hidden="true"></script>

Telegram (IM software)

Hashtag

Decompress files

  • in .tar.gz
    tar -zxvf file.tar.gz

Convert DjVu to PDF

Item Content
Preparation install DjVuLibre, see brew info djvulibre
Basic Usage ddjvu -format=pdf [options] input.djvu output.pdf
Useful option -<n> -subsample=<n>, downsize n times; default 1, max 12
Doc ddjvu's man page

Read and Write Outline of DjVu

Item Content
Read Outline djvused input.djvu -e 'print-outline' -u > outline.txt
Write Outline djvused -e 'set-outline outline.txt' -s input.djvu
Doc djvused's man page

Format of an outline

(bookmarks
  ("1 First chapter" "#10"
    ("1.1 First section" "#11"
      ("1.1.1 First subsection" "#12"))
    ("1.2 Second section" "#13"))
  ("2 Second chapter" "#14"
    ("2.1 First section" "#16")
    ("2.2 Second section" "#13")))

PDF Utilities

Use QPDF to check and fix PDF file

brew info qpdf

qpdf --check file.pdf
qpdf --qdf input.pdf - | fix-qdf > output.pdf

Use mutool to generate human readable and editable PDF

brew info mupdf

mutool clean -ad input.pdf output.pdf

doc: https://mupdf.readthedocs.io/en/latest/mutool-clean.html

poppler utilities

brew info poppler
brew list poppler

pdfinfo     # show pdf info
pdffonts    # list used fonts in a pdf
pdfdetach   # extract embedded files from pdf

Read and Write Outlines

pip3 install PyMuPDF
import fitz

doc = fitz.open('test.pdf')
toc = doc.getToC()  # read outlines

# modify toc: List[List]

doc.setToC(toc)     # write outlines
doc.saveIncr()      # saves incrementally

Doc: https://pymupdf.readthedocs.io/en/latest/document.html

Image Processing

Tools

Change DPI (density)

# show dpi
#  - long form `-format '%[units] %[resolution.x],%[resolution.y]\n'`
$ identify -units PixelsPerInch -format '%U %x,%y\n' input.png

# change dpi
$ convert -density 300 -units PixelsPerInch input.png output.png

Remove transparency from a PNG image (ref, also see this Q&A)

# use program ImageMagick
convert input.png -background white -alpha remove output.png

Set transparency color for a PNG image

# make white transparent, allowing a 4% fuzz
# source: https://tex.stackexchange.com/a/611207
convert input.png -fuzz 4% -transparent "#ffffff" output.png

Doc for options -transparent color and -fuzz distance{%}.

Compare images

https://imagemagick.org/script/compare.php

magick compare old.png new.png -highlight-color blue diff.png

Video Processing

Font Selection

Source Code Pro (before v2.032) can't be styled/colored in Chrome

Solution: Install the latest version by running brew install iandol/adobe-fonts/font-source-code-pro

The homebrew-cask-fonts switched the source of Source Code Pro from adobe-fonts to google-fonts, while the latter decided to stop pulling from the former since newer versions don't have hinting. But adobe-fonts just removed SVG table from that font to support its use in browser since v2.032 ...

Longer story

Links

Gradle

Persist --console setting in system-wide gradle.properties file

  • system-wide gradle.properties file is located in the path stored in GRADLE_USER_HOME, which by default is ~/.gradle
  • add line org.gradle.console=verbose to $GRADLE_USER_HOME/gradle.properties, after that running gradle test is equivalent to gradle --console=verbose test

docs: