Alt-tick in Linux

In Ubuntu/Mint, alt-back_tick is an annoying shortcut with no easy way to disable it. It conflicts with PyCharm’s shortcuts unless disabled.

After some trolling through launchpad bug reports and stackoverflow questions, here is how to disable it:

  • install dconf-editor
  • look for keys bound to Above_Tab:

     $ gsettings list-recursively | grep Above_Tab
    

    In my case, this was the following keys:

     org.cinnamon.desktop.keybindings.wm switch-group
     org.gnome.desktop.wm.keybindings switch-group
    
  • Change those settings (in dconf-editor) to [‘disabled’]

ccache will speed up your compilation game

Installing ccache creates several symlinks to compilers in /usr/lib/. To make ccache used by default (system-wide), just prepend /usr/lib/ccache to the PATH. This will make sure ccache gets called instead of cc/gcc/g++/etc, so it can do its magic and only call your compiler if it needs to.

So basically inside your .bashrc:

# Enable ccache by prepending its directory to the path
# ccache will get called instead of the vanilla compiler.
export PATH=/usr/lib/ccache:$PATH

Profiling your code in C++ or Python

(Note: this posts exists more to help me jog my own memory than to serve as a truly useful reference.)

C/C++

Use valgrind to profile, and kcachegrind to visualize.

valgrind --tool=callgrind ./program
kcachegrind callgrind.out.NNNN

python

Use cProfile to profile, and snake to visualize.

python -m cProfile -o out.prof program.py
runsnake out.prof