Cheat Sheets

!Hotkeys

Terminal

Useful terminal commands

change screenshot format

defaults write com.apple.screencapture type jpg
killall SystemUIServer

build a Jekyll website and deploy it

#!/bin/bash

JEKYLL_ENV=production bundle exec jekyll build
rsync -avr --rsh='ssh' --delete-after --delete-excluded _site/ username@IP.Add.re.ss:~/notes/_site

note: -avr could be -avz instead

Compress a file or a folder

zip -r -X archive-name.zip folder-to-compress

prevent sleep

caffeinate -i -t 3600

Change update interval

defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1

A quick for loop

for f in *.txt; do pandoc '$f' -s -o '${f%.txt}.rtf'; done

watch Star Wars - A New Hope in ASCII (not a joke)

nc towel.blinkenlights.nl 23

Erase disk

sudo diskutil eraseDisk /dev/disk2 

Disk space usage

du # dust

With say, convert a text file to an audio file with Apple’s TTS engine:

say -v Alex -f file.txt -o "output.m4a"
  • -v allows you to select the kind of voice for the output

recursively count files in a directory

find . -type f | wc -l

Recursively copying files from subdirectories to root directory

find ./input/ -type file -exec cp {} ./output/ \;
# or a more modern alternative
fd . ./input/ -t f -x cp {} ./output/ \;

Take a screenshot:

man screencapture

Subliminal

subliminal --opensubtitles xplosionmind 'z#5Br1&9b7niM~QZ$2hJTkn2gQRReJWy4i8zwuF6Pc1wXA#fVIcykUjb' download -l en La.Casa.de.Papel.S05E10.1080p.WEB-DL.DUAL.5.1.mkv

Downgrade package with Homebrew

# remove current version
brew uninstall navi

# find formula/bottle
# launches url
brew info --github navi

# from github url
# 1. locate version
# 2. click 'History'
# 3. locate for the version from @BrewTestBot
# 4. click 'Commit' > 'View File' > Raw
# 5. fetch using `cURL`
curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/7c7f18795fac61747fe383d7c22ec183d5283362/Formula/navi.rb

# install older version
brew install navi.rb && rm navi.rb

# optional, pin until fix is known
brew pin navi

Resources



GPG

GnuPG Cheat Sheets:



sd

sd is a wonderful command-line tool to find and replace sub-strings in files. Its original version is sed, which comes by default in shell.

Replace foo with bar in all files inside pwd:

sd 'foo' 'bar' ./*


HTML proofer

HTML proofer is a Ruby script to check HTML quality of a local folder. It can both be used as a library and as a command line tool.

basic check of a Jekyll website

bundle exec htmlproofer --assume-extension --allow_hash_href --check_favicon --check_opengraph --check_html --check_img_http --http_status_ignore 429 --url_ignore '#!' --checks_to_ignore '#!' --report_eof_tags --report_invalid_tags --report_mismatched_tags --report_missing_names --report_script_embeds /Users/tommi/tommi.space/\_site # --report_missing_doctype

See HTML Proofer > Configuration for the complete parameters list.



Linux

!Linuxplosion#Cheat sheet



Vim

!Vim#Cheat Sheet



Pandoc

!Pandoc#Cheat sheet



Exiftool

!ExifTool#Cheat Sheet



FFMPEG

!FFMPEG#Cheat Sheet



git

!git#Cheat sheet



Nextcloud manteinance

!Server Setup#Nextcloud Cheat Sheet

Share

Comments