piece of clothe (sorry husband your pyama's are a little shorter, ;) )
I used superglue, but you'd better use: SILICONE GLUE
place a long piece of clothe on your working space
place pencils the way you want them to be arranged.
put glue the hairpin and place onto pencils.
Wait till the glue is dry.
Remove the piece that holds all together and that's it.