From 5a34032fe4d83de1ccbf9cf8e13fc6bfb4f668ce Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Sat, 17 Mar 2018 20:13:53 +0100 Subject: Initial commit --- .gitignore | 1 + README.md | 3 +++ ffmpeg.md | 13 +++++++++++++ lilypond.md | 38 ++++++++++++++++++++++++++++++++++++++ locale.md | 19 +++++++++++++++++++ markdown.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ pdf.md | 13 +++++++++++++ ranger.md | 7 +++++++ video.md | 6 ++++++ vim.md | 14 ++++++++++++++ 10 files changed, 159 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 ffmpeg.md create mode 100644 lilypond.md create mode 100644 locale.md create mode 100644 markdown.md create mode 100644 pdf.md create mode 100644 ranger.md create mode 100644 video.md create mode 100644 vim.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a136337 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pdf diff --git a/README.md b/README.md new file mode 100644 index 0000000..8ed2f05 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Cheatsheets + +A personal list of Linux-related tips, tricks, and reminders. diff --git a/ffmpeg.md b/ffmpeg.md new file mode 100644 index 0000000..6abed19 --- /dev/null +++ b/ffmpeg.md @@ -0,0 +1,13 @@ +# ffmpeg tricks + +## Record screen + + ffmpeg -f x11grab -s 1920x1080 -i :0.0 out.mkv + +## Record from webcam + + ffmpeg -i /dev/video0 out.mkv + +## Record sound + + ffmpeg -f alsa -i default out.flac diff --git a/lilypond.md b/lilypond.md new file mode 100644 index 0000000..a59c48d --- /dev/null +++ b/lilypond.md @@ -0,0 +1,38 @@ +# Lilypond stuff + +Docs: `info LilyPond`. + +## Fine-grained page size + + #(set! paper-alist (cons '("custom size" . (cons (* 3.8 cm) (* 1.6 cm))) + paper-alist)) + \paper { + #(set-paper-size "custom size") + } + +## Remove footer + + \header { + tagline = ##f + } + +## Rhythm stuff + +### Setting beat divisions + + \overrideTimeSignatureSettings + 4/4 % timeSignatureFraction + 1/4 % baseMomentFraction + #'(3 1) % beatStructure + #'() % beamExceptions + \time 4/4 + \repeat unfold 8 { c8 } | + \revertTimeSignatureSettings 4/4 % reverts to defaults + \time 4/4 + \repeat unfold 8 { c8 } | + +### Pickup measure + + \time 3/4 + \partial 8 + e8 | a4 c8 b c4 | diff --git a/locale.md b/locale.md new file mode 100644 index 0000000..abecb35 --- /dev/null +++ b/locale.md @@ -0,0 +1,19 @@ +# Locale tweaks + +Every time after a clean install I have problems with multibyte (Polish) +characters not being handled by the terminal properly. To solve this: generate +both the `en_US` and `pl_PL` utf8 locales, then create a `.config/locale.conf`: + + LANG="pl_PL.utf8" + LC_MESSAGES="en_US.utf8" + LC_TIME="en_US.utf8" + LC_NUMERIC="en_US.utf8" + LC_MEASUREMENT="en_US.utf8" + LC_MONETARY="en_US.utf8" + LC_CTYPE="pl_PL.utf8" + +## Polish font for console + + # /etc/vconcole.conf + KEYMAP=pl2 + FONT=lat2-16 diff --git a/markdown.md b/markdown.md new file mode 100644 index 0000000..4c8835e --- /dev/null +++ b/markdown.md @@ -0,0 +1,45 @@ +# Markdown/Pandoc tricks + +## Math + + $\text{\LaTeX}$ + + \begin{equation} + \mathbb{N} \ni 2 + 2 = 2^2 + \end{equation} + +## Links + +### Named links + + [This][link name] is a link. [Link name][] is the link's name. + + [link name]: (link title) + +### Automatic links + + + +## Presentations + + pandoc in.md -t beamer -o out.pdf + pandoc in.md -t beamer -o out.pdf -i # incremental lists + pandoc in.md -t beamer --slide-level 2 -o out.pdf # # - section, ## - slide + +### Markdown details + +* `#` is a new slide with heading +* Metadata to generate title page, select theme, etc.: + + --- + title: + - Title + subtitle: + - Subtitle + author: + - Author Name + - Another Author + theme: + - Copenhagen + toc: true + --- diff --git a/pdf.md b/pdf.md new file mode 100644 index 0000000..f4e0931 --- /dev/null +++ b/pdf.md @@ -0,0 +1,13 @@ +# PDF operations + +## Merge + + gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf + +## Compress + + gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -dDetectDuplicateImages -dCompressFonts=true -r150 -sOutputFile=output.pdf input.pdf + +## Extract pages + + pdfjam --outfile out.pdf in.pdf 1,3,4-7 diff --git a/ranger.md b/ranger.md new file mode 100644 index 0000000..139aa8b --- /dev/null +++ b/ranger.md @@ -0,0 +1,7 @@ +# Ranger tricks + +## Bulkrename + + :bulkrename + +Opens the selected filenames in vim for editing. diff --git a/video.md b/video.md new file mode 100644 index 0000000..dddccb0 --- /dev/null +++ b/video.md @@ -0,0 +1,6 @@ +# Video editing + +## Cut + + ffmpeg -i in.mp4 -codec:v copy -codec:a copy -ss START_TIME -t DURATION out.mp4 + ffmpeg -ss START_TIME -t DURATION -i in.mp4 -codec:v copy -codec:a copy out.mp4 diff --git a/vim.md b/vim.md new file mode 100644 index 0000000..c11e771 --- /dev/null +++ b/vim.md @@ -0,0 +1,14 @@ +# Vim tricks + +## Navigating help + +| prefix | example | context | +| ------ | ------------- | ------------------------------------------------ | +| `:` | `:h :r` | ex command (command starting with a colon) | +| `none` | `:h r` | normal mode | +| `v_` | `:h v_r` | visual mode | +| `i_` | `:h i_CTRL-W` | insert mode | +| `c_` | `:h c_CTRL-R` | ex command line | +| `/` | `:h /\r` | search pattern (in this case, `:h \r` also works | +| `'` | `:h 'ro'` | option | +| `-` | `:h -r` | Vim argument (starting Vim) | -- cgit v1.2.3