Text this: Nonsmooth mechanics and convex optimization