Let's go step by step
1-Your nitroglycerin spray. This idea might be a problem, since nitroglycerin is highly unstable. This will give you some additional information about how it might be more dangerous for the organism which produces and stores it than to a potential predator, unless it can be stabilized by other organic methods, which would likely take too much energy and resources to make such a defense mechanism worth it.
2-your super fart. A squirt might be a better idea, since the gas would have a harder time sticking to the agressor, thus making it only effective so long as both stay in the area, and even then, once the gas dissipates the prey would be defenseless, since such mechanisms usually require time to be used again (see how skunks can't squirt their stuff all the time, requiring 10 days before being able to use it after a full power spray).
3-your taser mechanism. It actually already exists, though it's more commonly used by predators to stun prey, as electric signals travel better in water. On land dwelling animals though it might be an issue, as it'd need to have 2 structures making contact with the agressor and likely be surrounded by fatty tissue to isolate the current. In addition, if one of the structures is harmed and made unusable the teaser will be rendered useless. The ability to shoot structures attached to organic cables/hairs is also not that likely.
Basically, while they all sound cool, it's hard to tell whether the risks of these mechanisms and the resources dedicated to them would make them worth it. As a means of helping your imagination, in here you can find some examples of peculiar defense mechanisms which already exist.