Nothing in sections 29-356 to 29-366, inclusive, shall be construed to prohibit the sale by any resident manufacturer, wholesaler, dealer or jobber, at wholesale, of such fireworks as are not herein prohibited, or the sale of any kind of fireworks, provided the same are to be shipped directly out of state, in accordance with United States Department of Transportation regulations covering the transportation of explosives and other dangerous articles by motor, rail and water; or the possession, sale or use of signals necessary for the safe operation of railroads or other classes of public or private transportation, or of illuminating devices for photographic use, or of illuminating torches for parades or ceremonial events, nor shall the provisions of said sections apply to the military or naval forces of the United States or the armed forces of the state, or to peace officers in the performance of their official duties, nor prohibit the sale or use of blank cartridges for ceremonial, theatrical or athletic events or for training dogs, or the use of fireworks solely for agricultural purposes under conditions approved by the Commissioner of Emergency Services and Public Protection or the local fire marshal.