Handlebars and seat posts are just tubes. That means that if you can fill the two halves of the tube with something solid enough, the tube sections will slide together again.
Whittle a stick to insert into the inside of the two tube halves. Choose a stick which is bigger than the tubes so that you can make its cross-section hexagonal (or octagonal – you get the idea) with the “flats” of the hexagon the same size as or slightly smaller than the inner diameter of the tube.
Now, hammer one third of the stick into one side of the tube, then place the other side of the tube over the free end of the stick and hammer this in place. The “points” of the hexagon will compress or be cut off, holding the stick firmly against the inside of the tube.
This repair will not be very strong. Don’t lean or pull up on the handlebar, and use the seat post more for control than for sitting on.
If the seat post is beyond repair, check whether there is sufficient length to insert the remainder and ride with a short post. If not (it broke off at the saddle end), then protect your rear end by finding a T-shaped stick to insert into the seat tube so that the top of the T is perpendicular to the top tube. Lashing this or some item of clothing in place with an inner tube will provide a small amount of comfort for your long stand home.