Skip to content

Instantly share code, notes, and snippets.

View petergi's full-sized avatar
💭
Just Busy Living On The Side Of A Square

Peter Giannopoulos petergi

💭
Just Busy Living On The Side Of A Square
View GitHub Profile

Option Key

To type accents and other French characters, hold the option key while typing the key(s) in the third column, then release everything and press the key in the last column (if any). For example, to type é, hold option key while typing e, then release both and type e again.

Hold option key and Then type shortcut
Accent aigu é e e ⌥-e-e
Accent grave à, è, ù ` a, e, u ⌥-`-e
Cédille ç c

Character classes

. Any character, except newline
\c Control Character
\w Word
\d Digit
\x Hexadecimal Digit
\O Octal Digit

ZSH Cheatsheet

Parameter expansion

files=(*.txt)          # store a glob in a variable
print -l $files
print -l $files(:h)    # this is the syntax we saw before
print -l ${files:h}
print -l ${files(:h)}  # don't mix the two, or you'll get an error

Usage

find <path> <conditions> <actions>

Conditions

Arrays

list = [a,b,c,d,e]
list[1]                 // → b
list.indexOf(b)         // → 1

Subsets

Queries

Basic query

{ status }

# To print Abbreviated weekday name:
date +"%a"
# To print Full month name:
date +"%B"
# To print ISO date (same as %Y-%m-%d):
date +"%F"
# To start the docker daemon:
docker -d
# To build a docker image:
docker build -t <image-tag-name> <path-of-Dockerfile>
# To start a container with an interactive shell:
docker run -ti <image-name> /bin/bash
# To "shell" into a running container (docker-1.3+):
# To set your identity:
git config --global user.name <name>
git config --global user.email <email>
# To set your editor:
git config --global core.editor <editor>
# To enable color:
git config --global color.ui true

Rsync cheatsheet

oh-my-zsh rsync aliases

Alias Command
rsync-copy rsync -avz --progress -h
rsync-move rsync -avz --progress -h --remove-source-files