You’d create a new theme component under Admin > Customize > Themes, then paste that code in the </head>
section. From there modify and tweak as needed.
More information:
Beginner’s guide to using Discourse Themes
Developer’s guide to Discourse Themes