Home

Awesome

Awesome Stuff

Random awesome hints, fixes and stuff. Also see robotics-setup.

Awesome Lists

MacOS

Screenshots

copy for pasting

save to desktop

set screenshot format

defaults write com.apple.screencapture type png

Options are png, jpg, gif, tiff, jpg

iTerm2 Zsh Keyboard shortcuts

To be able to skip to the next word with command left and command right:

If you are using Zsh, like Oh My Zsh, in iTerm then go to: Preferences > Profiles > Keys sub-menu

Click the + sign to add a new command.

Add your shortcut such as command + left arrow then choose "Send Escape Sequence" left: [1;5D right: [1;5C

Sourcetree

Sourcetree is a Git application for Windows + Mac

fix stree command line utility

alias stree='/Applications/SourceTree.app/Contents/Resources/stree'

View user manual aka man files as a PDF in Preview

man -t command | open -f -a /Applications/Preview.app

Linux

OpenGL Crashing on Command Line Launch

OpenGL crashed you need to specify the display on which to run the program as follows:

DISPLAY=:0.0; sudo ./vrep.sh

Check your specific machine (or google) for what display variable to use.

List your installed Ubuntu repositories

apt-cache policy |grep http |awk '{print $2 $3}' |sort -u

Search ubuntu packages on command line

apt-cache search keyword

To list all packages:

apt-cache search .

Find libraries if you have linking trouble

dpkg-query -L ros-kinetic-opencv3

How to find the versions of drivers you need

sudo ubuntu-drivers devices

View your disk io

sudo iotop -aoP

View your disk usage

QDirStat is an excellent utility for plotting the files and folders that take up the most disk space on your machine.

sudo add-apt-repository ppa:nathan-renniewaldock/qdirstat
sudo apt-get install qdirstat

Get the display working with multiple nvidia GPUs

There are a lot of steps for this so follow the link above if the instructions below aren't clear.

# figure out the pci bus slot of the device you want to display on (0, 1, 2 etc)
nvidia-smi -a

look for a line like the following for the device you want to display on:

PCI
    Bus                         : 0x03    

create a new gpu config file and edit it:

sudo nvidia-xconfig -multigpu=on
sudo vim /etc/X11/xorg.conf

Update xorg.conf "Device" section to look like the following, replacing the "2" below with the value you found in nvidia-smi -a:

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BusID          "PCI:2:0:0"
EndSection

Save and exit then restart the computer.

sudo reboot now

Auto mounting drives at startup

Adapted easy instructions:

  1. Open Disks Ubuntu application
  2. Select the partition
  3. click the "settings" cog wheel
  4. click Edit Mount Options
  5. change settings to mount at startup

More manual terminal instructions:

Ubuntu equivalent to MacOS quick look

sudo apt-get install gnome-sushi

No space left on device (when there is space) inotify limit

This is when you've hit the inotify limit and files can't be opened. Instructions to see the limit and fix it or Alternate instructions.

Python

pip install a local package folder with pip such that changes are immediately available in the package.

pip install -e . --user --upgrade
    py-spy --record $PID --format speedscope -o profile.speedscope.json

Git

Global .gitignore:

git config --global core.excludesfile ~/.gitignore

ssh

Load and authorize your ssh key (such as for github):

eval "$(ssh-agent -s)" && ssh-add ~/.ssh/id_rsa

See a WARNING: UNPROTECTED PRIVATE KEY FILE! perimssions error on you ssh key?

chmod 600 ~/.ssh/id_rsa

xonsh shell:

source-bash eval "$(ssh-agent -s)" && ssh-add ~/.ssh/github_rsa

Command line / Terminal

Kill a process when ctrl+c doesn't work

ctrl + \

"repair" broken/corrupted pdfs

pdf2ps file.pdf
ps2pdf file.ps

Correct python permission errors

sudo chown -R $USER /usr/local/lib/python2.7

Make zsh your shell without root access

export SHELL=`which zsh`
[ -z "$ZSH_VERSION" ] && exec "$SHELL" -l

Attribution of Pair programming with git

https://github.com/A-Helberg/pair-up

Create a torrent

webtorrent desktop browser torrent

First install npm (node package manager) and then webtorrent:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
npm install webtorrent webtorrent-cli webtorrent-hybrid -g

Then you can create your torrent:

webtorrent create /path/to/file/or/folder/to/share/ -o /path/to/file/or/folder/to/share.torrent

And seed it for others to download:

webtorrent seed /path/to/file/or/folder/to/share.torrent

Copy files with progress bar

rsync -ah --info=progress2 /copy/from/here /copy/to/here

See all locations of a specific filename

whereis

example: whereis cmake

To see the current default instead use which, ie which cmake.

Compress a PDF

On macOS open the pdf with the "ColorSync Utility".

Prepping a latex paper for submission to ArXiV.org with bibtex

pdflatex main.tex --shell-escape && bibtex main && pdflatex main.tex && bibtex main && rm -rf main.pdf && cp main.bbl sample.bbl