Wash the gherkins or cucumbers. Leave gherkins whole, but if using cucumbers, cut in half lengthways and remove any seeds by running a teaspoon down the length of each half. Cut each half into 2 quarters lengthwise. If still a bit thick then slice in half lengthwise again.
Place in a shallow dish, sprinkle with the salt lightly and toss to distribute the salt. Cover the surface with baking paper and weigh it down with a plate. Leave in a cool place for 12 hours.
Tip into a colander and rinse the gherkins or cucumbers under cold water. Drain well, tossing to encourage any excess water to drain away. Leave for 5–10 minutes to dry.
Place a dill head (or fronds) into each sterilised jar. Add a teaspoon of dill and mustard seeds and a garlic clove to each jar.
Put the vinegar, sugar, peppercorns and dried chillies, if using, in a large saucepan. Heat gently, stirring all the time, until the sugar has dissolved. Remove from the heat and allow to cool until warm.
Pack the gherkins or cucumber spears into the prepared jars as snugly as you can. Pour the infused vinegar into the jars, making sure the liquor completely covers the contents. Screw the lid tightly and invert the jar for a minute or so, to ensure the lids are sterilised, then turn the right way up and leave to cool.