Human activity is organised around daily and weekly cycles, which should, in turn, dominate all types of social interactions, such as transactions, communications, gatherings and so on. Yet, despite their strategic importance for policing and security, cyclical weekly patterns in crime and road incidents have been unexplored at the city and neighbourhood level. Here we construct a novel method to capture the weekly trace, or "heartbeat" of events and use geotagged data capturing the time and location of more than 200,000 violent crimes and nearly one million crashes in Mexico City. On aggregate, our findings show that the heartbeats of crime and crashes follow a similar pattern. We observe valleys during the night and peaks in the evening, where the intensity during a peak is 7.5 times the intensity of valleys in terms of crime and 12.3 times in terms of road accidents. Although distinct types of events, crimes and crashes reach their respective intensity peak on Friday night and valley on Tuesday morning, the result of a hyper-synchronised society. Next, heartbeats are computed for city neighbourhood 'tiles', a division of space within the city based on the distance to Metro and other public transport stations. We find that heartbeats are spatially heterogeneous with some diffusion, so that nearby tiles have similar heartbeats. Tiles are then clustered based on the shape of their heartbeat, e.g., tiles within groups suffer peaks and valleys of crime or crashes at similar times during the week. The clusters found are similar to those based on economic activities. This enables us to anticipate temporal traces of crime and crashes based on local amenities.