The total gravitational potential energy of the Earth, that is, the amount of energy necessary to disperse the planet to dust at infinity, is a bit more than 2.2x10^32 Joules. That's roughly the energy in an earthquake of magnitude 18.37 on the steeply logarithmic Richter scale (2.25 x 10^32 Joules). Phil Plait of Bad Astronomy reports that about 8 years ago, the planet got hit with the after effects of a Richter Scale magnitude 23 event.
Fortunately, it wasn't terribly close (50,000 light years):
Eight years ago today—on Dec. 27, 2004—the Earth was rocked by a cosmic blast so epic its scale is nearly impossible to exaggerate.
The flood of gamma and X-rays that washed over the Earth was detected by several satellites designed to observe the high-energy skies. RHESSI, which observes the Sun, saw this blast. INTEGRAL, used to look for gamma rays from monster black holes, saw this blast. The newly-launched Swift satellite, which was designed and built to detect bursts of gamma-ray from across the Universe, not only saw this blast but was so flooded with energy its detectors completely saturated—think of it as trying to fill a drinking glass with a fire hose. Even more amazingly, Swift wasn’t even pointed anywhere near the direction of the burst: In other words, this flood of energy passed right through the body of the spacecraft itself and was still so strong it totally overwhelmed the cameras.
It gets worse. This enormous wave of fierce energy was so powerful it actually partially ionized the Earth’s upper atmosphere, and it made the Earth’s magnetic field ring like a bell. Several satellites were actually blinded by the event. Whatever this event was, it came from deep space and still was able to physically affect the Earth itself!
The quake in question occurred on a magnetar, a rapidly spinning and highly magnetic neutron star.
The sheer amount energy generated is difficult to comprehend. Although the crust probably shifted by only a centimeter, the incredible density and gravity made that a violent event far beyond anything we mere humans have experienced. The quake itself would have registered as 23 on the Richter scale—mind you, the largest earthquake ever recorded was about 9 on that scale, and it’s a logarithmic scale. The blast of energy surged away from the magnetar, out into the galaxy. In just 200 milliseconds—a fifth of a second, literally the blink of an eye—the eruption gave off as much energy as the Sun does in a quarter of a million years.
Of course there are magnetars that are quite a bit closer.