Skip to content

Instantly share code, notes, and snippets.

@ScottA38
Last active October 8, 2020 12:48
Show Gist options
  • Save ScottA38/6b07c1f14d09c5ceaaa436b13872fc75 to your computer and use it in GitHub Desktop.
Save ScottA38/6b07c1f14d09c5ceaaa436b13872fc75 to your computer and use it in GitHub Desktop.
General OS and common application shortcuts for OSX

Super User gist

A repository for noting shortcuts or short workflow snippets that are important

Using Docker Desktop for OSX

Useful tips

  • Always remember that to do anything you (utilise the Docker Daemon), you must first run docker.app
  • Run docker ps to see all current running containers
  • Run docker ps -a to see all running/previously run containers

Intermediate containers

Sometimes when setting up containers to run you get intermediate, unnamed containers left behind. These containers will have no features for description except for their file size and a 'name' and 'tag' of <none>. You can test if you have such intermediate remnants by running docker images and looking for containers named as such. If you have a lot and want to delete them en-masse in the terminal then run:

docker rmi \docker images -f "dangling=true" -q``

To understand the above command you should run docker images -f "dangling=true" -q in isolation. You will see that if you have such unnamed containers within your images their container hash sequences will be listed one-per-line in the output. Consequently all that wrapping this in backslashes after a docker rmicommand does is feed each of these output lines todocker rmi` which instructs to remove the image based upon the supplied hash. Viola!

If 'hold for accents' is not working on your keyboard:

  • open your terminal
  • run 'defaults write -g ApplePressAndHoldEnabled -bool true'
  • log out and log in again

If you want to make the output of ls colourised on osx:

  • check the current output of $LSCOLORS with echo $LSCOLORS
  • interpret the result with the help of this reference
  • modify as desired

N.B: The above linked reference is specific to MacOS, as it runs on FreeBSD, if you search for LSCOLORS generally you will get linux format tutorials which are a different structure entirely

OSX 'Super User' shortcut notes

general

  • [cmd + \]` = cycle through open windows within the currently focused

application

  • [cmd + tab] = cycle through all active applications sequentially (list goes: CURRENTLY ACTIVE, LAST PREVIOUSLY USED, (ALPHABETICAL)
  • [cmd + tab] = cycle through all active applications in reverse sequential order
  • [cmd + F3] = temporarily push all windows out of the way so that you can see your desktop again
  • [cmd + ctrl + F] = toggle window fullscreen
  • [HOLD(cmd + tab) + alt] = Switch to an application and unhide last window
  • [ctrl + down_key] = See a 'mission-control'-like view of all the windows of the current application

nano

  • [ctrl + a] = start of current line
  • [ctrl + e] = end of current line
  • [ctrl + k] = cut entire line to clipboard -> can be used continuously to delete large segments
  • [ctrl + space] = cursor moves forward a word (next whitespace)
  • [esc + space] = cursor moves back a word (next whitespace)

N.B: this is conventially [alt + space] in nano but for OSX alt is a reserved key so it cannot be used easily and instead esc is used as a substitute)

terminal

  • [cmd + up] = move up to the command executed previously to the current command line
  • [cmd + down] = move down to the command executed following to the current command line
  • [cmd + t] = make new shell 'tab' (new shell in a 'tabbed' shell interface)
  • [ctrl + tab] = move one 'shell tab' to the right
  • [ctrl + shift + tab] = move one 'shell tab' to the left

firefox

  • [ctrl + tab] = cycle tabs in current browser window
  • [ctrl + shift + tab] = cycle tabs in reverse order
  • [cmd + w] = close the current browser tab
  • [cmd + shift + t] = reopen the last closed tab in the window

git

  • git diff HEAD HEAD~N = see the difference between the current HEAD of the repository and the commit 'n' commits previous to that reference on the same branch

PHPStorm Super User

Used on: Ubuntu keymap: Emacs style

shift shift (double tap) -> search through all currently available classes esc + x -> get up 'Search for action' pane (all actions in PHPStorm available by keywork search) ctrl + j -> insert a 'live template'. Live templates are code snippets you want to repetitively insert

Workflow

  • Use 'Database' pane on the left. Authenticate with an existing DB and you can manipulate your tables via GUI

Windows 'Super User' shortcut notes

General

  • [alt + F4]: kill application

Windows pane management

  • [win + up_arrow]: maximise window. If the window is minimised, restore the window instead
  • [win + down arrow]: minimise window. If the window is maximised, restore the window down instead
  • [win + right arrow]: maximise window to take up half of the screen on the right
  • [win + left arrow]: maximise window to take up half of the screen on the left
  • [win + {num}]: (where {num} is the numeric index of the current application across the bottom application taskbar) cycle through windows of a given application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment