There's a poly helix primitive. Play with the settings for that and then use a bend deformer to wrap it around the hat.