I usually don’t have a keyboard key mapped to caps, since I have my caps mapped to escape instead. However, from time to time it still gets activated. So to save me googling-time, this is the easiest way to turn it off:

Alternative 1

xmodmap -e "clear Lock"

Alternative 2

#! /usr/bin/env python

from ctypes import *
import subprocess

class Display(Structure):
    """ opaque struct """

X11 = cdll.LoadLibrary("libX11.so.6")
X11.XOpenDisplay.restype = POINTER(Display)

display = X11.XOpenDisplay(c_int(0))
X11.XkbLockModifiers(display, c_uint(0x0100), c_uint(2), c_uint(0))
X11.XCloseDisplay(display)