During the more than two years they spent under the control of the Islamic State group, many residents of the Iraqi city often defied the strict rules of the "caliphate" in the secrecy of their homes.