A collection of useful tools and hacks I’ve come across recently (list updated):
Resetting an administrative password in Ubuntu
It is possible to reset an administrative password you forgot, provided you have access to the physical machine (this is obviously a security measure). To reset simply restart the machine and on the GNU GRUB screen select “advanced settings“. Then select boot into recovery mode. A new menu will come up: scroll down to “root” and press the enter key. This will bring up a terminal prompt on the bottom. Type the following commands into the prompt:
mount -o rw,remount /
passwd [your_username]
– this will let you type in your new password.
Reboot and you’re done.
Compressing a pdf
To compress originalfilename.pdf to compressedfilename.pdf, use this ghostcript command:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressedfilename.pdf originalfilename.pdf
If the image resolution in the output file is too low, then remove -dPDFSETTINGS=/ebook
from the above command.
Combing multiple files into a single pdf
It is possible to combine multiple files (not necessarily PDF files, they could for example be JPEGs) using this command from ImageMagick:
convert image1.jpg image2.jpg image3.jpg image4.jpg doc.pdf text.txt outputfilename.pdf
PDF-Shuffler is really useful for re-ordering pages, or rotating selected pages within a PDF document.
Fixing page margins for IEEE conferences using LyX
Conference paper submissions often require strict margins which LyX may not produce in the final pdf document. Even after importing the ieeeconf.cls stylesheet, my margins were wrong (the last line on each page went beyond the bottom margins). To fix this I added the following lines to the LyX preamble:
\usepackage[bottom=0.75in,top=0.75in,left=0.75in,right=0.75in]{geometry}
These margins (0.75 in in this case) are specific to each conference and are usually provided by the organisers on the submission page.
Removing page numbers in IEEE conferences using LyX
Simply add this to the preamble: \pagenumbering{gobble}
Multiple tabs in Ubuntu terminals
The xdotool package allows you to open multiple tabs in an Ubuntu terminal, which is really useful when going through the ROS tutorials. To install the package simply type:
sudo apt-get install xdotool
Then you can just press SHIFT+Ctrl+T to open a new tab in a terminal.
Maintaining a persistent connection on a remote server
When you ssh into a server and the connection breaks (say you shut down your machine) this could result in you loosing some valuable work. GNU Screen is a really neat tool for overcoming this. It allows you to open multiple terminal processes, each in their own screens, and you can attach and detach from them easily. When you detach from a screen, whatever process was running on the screen continues to run on the server and you can safely disconnect from your ssh session to the remote server.
To start a session type this command in your terminal: screen
To end a session enter Ctr+a d
to detach
To list all the running screen sessions type: screen -ls
To reattach to a screen session, type: screen -r [session number PID]
For a nice list of GNU Screen commands check out this guide.
Using cmake with a GUI
ccmake is a cmake curses interface that lets you set project configurations using the GUI. To install ccmake type: sudo apt install cmake-curses-gui