For the Shallots –
Place the shallot slices in a small bowl. In a small saucepan over medium-low heat, bring the vinegar, sugar, salt, and chile (if using) to a simmer, swirling the pan to help the sugar dissolve. Pour the pickling liquid over the shallots and let them cool to room temperature. Use immediately or store in an airtight container in the refrigerator for up to 2 weeks.
For the Chiles –
Place the chile slices in a small bowl. In a small saucepan over medium-low heat, bring the vinegar, sugar, salt, and minced garlic to a simmer, swirling the pan to help the sugar dissolve. Pour the pickling liquid over the chiles and let them cool to room temperature. Use immediately or store in an airtight container in the refrigerator for up to 2 weeks.