Section 34C. Whoever (1) commits a second or subsequent violation of the state building code or state fire code, including any incorporated specialized codes, or any lawful order of the marshal, the head of the fire department or a state or local building inspector or (2) continues to violate any such code or order after receipt of actual notice of such violation or order, shall be punished by a fine of not more than $1,000 or by imprisonment for 1 year in the house of correction or by both such fine and imprisonment. Notice may be provided by in-hand service, by posting the same in a conspicuous place on the premises in violation, or by the lawful issuance of a citation pursuant to chapter 148 A. This section shall not apply to such violations which are under appeal pursuant to section 100 of chapter 143, if such appeal was timely filed.