Skip to content

Instantly share code, notes, and snippets.

@v-p-b
Created March 11, 2021 21:19
Show Gist options
  • Save v-p-b/b3d73e4a1ebe00ddbfef0cfea9bf1d1f to your computer and use it in GitHub Desktop.
Save v-p-b/b3d73e4a1ebe00ddbfef0cfea9bf1d1f to your computer and use it in GitHub Desktop.
aW1wb3J0IHJlcXVlc3RzCmZyb20gdXJsbGliMy5leGNlcHRpb25zIGltcG9ydCBJbnNlY3VyZVJl
cXVlc3RXYXJuaW5nCmltcG9ydCByYW5kb20KaW1wb3J0IHN0cmluZwppbXBvcnQgc3lzCgoKZGVm
IGlkX2dlbmVyYXRvcihzaXplPTYsIGNoYXJzPXN0cmluZy5hc2NpaV9sb3dlcmNhc2UgKyBzdHJp
bmcuZGlnaXRzKToKICAgIHJldHVybiAnJy5qb2luKHJhbmRvbS5jaG9pY2UoY2hhcnMpIGZvciBf
IGluIHJhbmdlKHNpemUpKQoKaWYgbGVuKHN5cy5hcmd2KSA8IDI6CglwcmludCgiVXNhZ2U6IHB5
dGhvbiBQb0MucHkgPHRhcmdldD4gPGVtYWlsPiIpCglwcmludCgiRXhhbXBsZTogcHl0aG9uIFBv
Qy5weSBtYWlsLmV2aWwuY29ycCBoYXhvckBldmlsLmNvcnAiKQoJZXhpdCgpCnJlcXVlc3RzLnBh
Y2thZ2VzLnVybGxpYjMuZGlzYWJsZV93YXJuaW5ncyhjYXRlZ29yeT1JbnNlY3VyZVJlcXVlc3RX
YXJuaW5nKQp0YXJnZXQgPSBzeXMuYXJndlsxXQplbWFpbCA9IHN5cy5hcmd2WzJdCnJhbmRvbV9u
YW1lID0gaWRfZ2VuZXJhdG9yKDMpICsgIi5qcyIKdXNlcl9hZ2VudCA9ICJNb3ppbGxhLzUuMCAo
V2luZG93cyBOVCAxMC4wOyBXaW42NDsgeDY0KSBBcHBsZVdlYktpdC81MzcuMzYgKEtIVE1MLCBs
aWtlIEdlY2tvKSBDaHJvbWUvODguMC40MzI0LjE5MCBTYWZhcmkvNTM3LjM2I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UiOiAiYXBw
bGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsCiAgICAiVXNlci1BZ2VudCI6IHVzZXJfYWdl
bnQKfSwKICAgICAgICAgICAgICAgICAgIGpzb249cmVzZXRfb2FiX2JvZHksCiAgICAgICAgICAg
ICAgICAgICB2ZXJpZnk9RmFsc2UKICAgICAgICAgICAgICAgICAgICkKCmlmIGN0LnN0YXR1c19j
b2RlICE9IDIwMDoKICAgIHByaW50KCJXcml0ZSBTaGVsbCBFcnJvciEiKQogICAgZXhpdCgpCgpw
cmludCgiU3VjY2Vzc2Z1bCEiKQ==
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment