Wouldn't it "fuck up" everything if - for example a star a few times bigger than the sun came across our solar system? Like a huge disturbance in gravity? Also chances are that something will collide with something else - what if 2 big stars (even just a few hundred times bigger than the sun) collided?
In theory that would be like 2 huge supernovas right? Over a short time that would release a huge amount of energy - probably equal to the energy they generated during their whole life spans.
Well, a star coming near enough to our sun would more likely wind up in a common orbit with it and become a binary star system rather than collide with it. Of course, earth, or life on it, would still be destroyed if that happend. But like I said, the probability of two stars coming near to each other when galaxies collide is almost zero. Astronomers have observed galaxies colliding with no destructive occurrences. In fact, this is one of the ways galaxies evolve. I can't wait for Andomeda to get here.
However it also means that the whole earth could be annihilated in less than a split second if anything (including any kind of energy) close to the speed of light was about to hit us. And that would obviously happen without any earlier warning signs - no matter how advanced the technology gets we wouldn't be able to send any info on upcoming doom, even having a probe one light year away (which is ridiculous itself) since its radio signals would still be slower than the light.
We would have some warning. The electromagnetic radiation given off by a supernova would not be given off all at once. We would see the visible light first, which would be a thousand times as bright as the full moon. Except for making street lights unnecessary, it would have little effect on us. After about a month, such a supernova would begin to dim, but even so it would remain a prominent feature of the night sky for years. The ultraviolet radiation that accompanied the visible light would not be dangerous either; most of it would be absorbed by the ozone layer of the atmosphere. The real menace, cosmic radiation, would not arrive until years or decades after the light had faded from the sky. This radiation would not fall upon us at once, but once it started, our continued survival would become problematical.
Cosmic rays consist of protons and electrons. The earth is constantly being bombarded by them from all directions. These come from billions of supernova that have exploded over time in the universe. Cosmic rays constitute a significant part of the radiation background that's present everywhere on earth. It's this background which produces genetic mutations in every living organism and which makes evolution possible.
However, cosmic radiation also produces effects that are anything but beneficial. The vast majority of the mutations which it induces are harmful. If the mutation rate was to rise to high enough levels, selection would hardly have a chance to operate at all. Mutations would proliferate, killing an increasingly large number of individuals and making it difficult for a species to reproduce.
A threefold-to-tenfold increase in radiation is sufficient to double the mutation rate in most large species. Since cosmic rays from a supernova might cause radiation levels on the surface of the earth to increase by as much as a factor of 100, it's obvious that the results would be catastrophic if the bombardment continued for any significant period of time.
Although cosmic rays travel close to the speed of light, it would take months to reach us after the visible light because they do not travel in a straight line; instead they bounce around in the magnetic fields that permeate space. This very effect, however, would ensure that they remained at peak intensity for as long as a century. Even then they would not fade away completely; cosmic radiation could remain at levels that were higher than normal for millenia.
If human beings somehow managed to live through such intense fallout and produce viable offspring, their problems would only be beginning. There would be mutations in all terrestrial species, including plants and microorganisms. Mutated viruses might create plagues against which we would have no resistance, and many of our food crops might become mutated to such a degree that they would become inedible.
So, yes, we would have a warning by the visible explosion, but a lot of good that would do. We'd probably panic ourselves to death before the first cosmic rays hit us.