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kZW50aXR5WydSYXdJZGVudGl0eSddfSIpCgogICAgIyBTZXQtT0FCVmlydHVhbERpcmVjdG9yeQogICAgTG9nLmluZm8oIlNldHRpbmcgdXAgd2Vic2hlbGwgcGF5bG9hZCB0aHJvdWdoIE9BQiIpCiAgICBxcyA9IHVybGVuY29kZSh7CiAgICAgICAgJ3NjaGVtYSc6ICdPQUJWaXJ0dWFsRGlyZWN0b3J5JywKICAgICAgICAnbXNFeGNoRWNwQ2FuYXJ5JzogY2FuYXJ5CiAgICB9KQogICAgaWYgKG5vdCAnRGlzcGxheU5hbWUnIGluIGlkZW50aXR5KToKICAgICAgICBpZGVudGl0eVsnRGlzcGxheU5hbWUnXSA9ICIiCiAgICBwYXlsb2FkID0ganNvbi5kdW1wcyh7CiAgICAgICAgJ2lkZW50aXR5JzogewogICAgICAgICAgICAnX190eXBlJzogJ0lkZW50aXR5OkVDUCcsCiAgICAgICAgICAgICdEaXNwbGF5TmFtZSc6IGlkZW50aXR5WydEaXNwbGF5TmFtZSddLAogICAgICAgICAgICAnUmF3SWRlbnRpdHknOiBpZGVudGl0eVsnUmF3SWRlbnRpdHknXQogICAgICAgIH0sCiAgICAgICAgJ3Byb3BlcnRpZXMnOiB7CiAgICAgICAgICAgICdQYXJhbWV0ZXJzJzogewogICAgICAgICAgICAgICAgJ19fdHlwZSc6ICdKc29uRGljdGlvbmFyeU9mYW55VHlwZTojTWljcm9zb2Z0LkV4Y2hhbmdlLk1hbmFnZW1lbnQuQ29udHJvbFBhbmVsJywKICAgICAgICAgICAgICAgICdFeHRlcm5hbFVybCc6ICdodHRwOi8vZi8nICsgRklMRV9EQVRBCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9KQogICAgciA9IGV4cGxvaXQoJy9lY3AvRERJL0RESVNlcnZpY2Uuc3ZjL1NldE9iamVjdCcsIHFzPXFzLCBkYXRhPXBheWxvYWQsIGNvb2tpZXM9ZXh0cmFfY29va2llcykKICAgIGFzc2VydCByLnN0YXR1c19jb2Rl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B3aGlsZSB3cml0aW5nIHNoZWxsLCBzdGF0dXMgY29kZSBpcyB7cmVzcC5zdGF0dXNfY29kZX0iKQogICAgICAgIHJldHVybgoKICAgIExvZy5pbmZvKCJDbGVhbmluZyBPQUIuLi4iKQogICAgcXMgPSB1cmxlbmNvZGUoewogICAgICAgICdzY2hlbWEnOiAnT0FCVmlydHVhbERpcmVjdG9yeScsCiAgICAgICAgJ21zRXhjaEVjcENhbmFyeSc6IGNhbmFyeQogICAgfSkKICAgIHBheWxvYWQgPSBqc29uLmR1bXBzKHsKICAgICAgICAnaWRlbnRpdHknOiB7CiAgICAgICAgICAgICdfX3R5cGUnOiAnSWRlbnRpdHk6RUNQJywKICAgICAgICAgICAgJ0Rpc3BsYXlOYW1lJzogaWRlbnRpdHlbJ0Rpc3BsYXlOYW1lJ10sCiAgICAgICAgICAgICdSYXdJZGVudGl0eSc6IGlkZW50aXR5WydSYXdJZGVudGl0eSddCiAgICAgICAgfSwKICAgICAgICAncHJvcGVydGllcyc6IHsKICAgICAgICAgICAgJ1BhcmFtZXRlcnMnOiB7CiAgICAgICAgICAgICAgICAnX190eXBlJzogJ0pzb25EaWN0aW9uYXJ5T2ZhbnlUeXBlOiNNaWNyb3NvZnQuRXhjaGFuZ2UuTWFuYWdlbWVudC5Db250cm9sUGFuZWwnLAogICAgICAgICAgICAgICAgJ0V4dGVybmFsVXJsJzogJycKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0pCiAgICByZXNwID0gZXhwbG9pdCgnL2VjcC9EREkvRERJU2VydmljZS5zdmMvU2V0T2JqZWN0JywgcXM9cXMsIGRhdGE9cGF5bG9hZCwgY29va2llcz1leHRyYV9jb29raWVzKQogICAgTG9nLmluZm8oZiJyZXNwOntyZXNwLnN0YXR1c19jb2RlfSIpCiAgICBMb2cuc3VjY2VzcyhmInNoZWxsOiBodHRwczovL3tIT1NUfS9hc3BuZXRfY2xpZW50L3tTSEVMTF9OQU1FfS5hc3B4IikKICAgIHJldHVybiAiZXhwbG9pdGVkIiwgImh0dHBzOi8vIiArIEhPU1QgKyAiL2FzcG5ldF9jbGllbnQvIiArIFNIRUxMX05BTUUgKyAiLmFzcHgiCgoKZGVmIHJ1bihydW5uZXIpOgogICAgZ2xvYmFsIEhPU1QsIE1BSUxTCiAgICBmID0gb3BlbihNQUlMUykKICAgIHRyeToKICAgICAgICB3aGlsZSBUcnVlOgogICAgICAgICAgICBtYWlsID0gbmV4dChmKVs6LTFdCiAgICAgICAgICAgIHJldHVybiBydW5uZXIobWFpbCkKICAgIGV4Y2VwdDoKICAgICAgICBMb2cud2FyaW5nKCJtYWlscyBmaWxlIGhhcyBiZWVuIHJlYWQuIikKCgpkZWYgcnVubmVyKG1haWwpOgogICAgZ2V0X2xvY2FsX25hbWUoKQogICAgc2lkID0gZ2V0X3NpZChtYWlsKQogICAgaWYgbm90IHNpZDoKICAgICAgICByZXR1cm4KICAgIHJldHVybiBleHAobWFpbC5zcGxpdCgnQCcpWzBdLCBzaWQpCgpkZWYgc3RhcnRlcl9kYXRhKGRhdGEsIGlwKToKICAgIGRhdGFfb3V0ID0gW10KICAgIGZsYWcgPSAwCiAgICBmb3IgZWxlbSBpbiBkYXRhOgogICAgICAgIGlmKGZsYWcgPT0gMCk6CiAgICAgICAgICAgIGlmKGlwICE9IGVsZW1bIklQIl0pOgogICAgICAgICAgICAgICAgcGFzcwogICAgICAgICAgICBlbGlmKGlwID09IGVsZW1bIklQIl0pOgogICAgICAgICAgICAgICAgZGF0YV9vdXQuYXBwZW5kKGVsZW0pCiAgICAgICAgICAgICAgICBmbGFnID0gMQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIGRhdGFfb3V0LmFwcGVuZChlbGVtKQogICAgcmV0dXJuIGRhdGFfb3V0CgpkZWYgbWFpbigpOgogICAgZ2xvYmFsIEhPU1QsIE1BSUxTLCBNQUlMLCBBUkdTCgogICAgc3RhcnRfaXA9ICIyMTMuMzMuMTgzLjEzOSIKCiAgICB3aXRoIG9wZW4oJ2VtYWlscy1jb21wcmVzcy5qc29uJywgZW5jb2Rpbmc9InV0Zi0xNiIpIGFzIGpzb25fZmlsZToKICAgICAgICBkYXRhID0ganNvbi5sb2FkKGpzb25fZmlsZSkKICAgICAgICBkYXRhID0gc3RhcnRlcl9kYXRhKGRhdGEsIHN0YXJ0X2lwKQogICAgICAgIGZvciB0YXJnZXQgaW4gZGF0YToKICAgICAgICAgICAgSE9TVCA9IHRhcmdldFsiSVAiXS5zdHJpcCgiICIpLnJzdHJpcCgpCiAgICAgICAgICAgIHByaW50ICgiQ1VSUiBJUCAiICsgSE9TVCkKICAgICAgICAgICAgZm9yIGVtYWlsIGluIHRhcmdldFsiRW1haWxzIl06CiAgICAgICAgICAgICAgICBNQUlMID0gZW1haWwuc3RyaXAoIiAiKS5yc3RyaXAoKQogICAgICAgICAgICAgICAgcHJpbnQgKCJDVVJSIG1haWwgIiArIE1BSUwpCiAgICAgICAgICAgICAgICByZXNwID0gIiIKICAgICAgICAgICAgICAgIHVybCA9ICIiCiAgICAgICAgICAgICAgICB0cnk6CiAgICAgICAgICAgICAgICAgICAgcmVzcCwgdXJsID0gcnVubmVyKE1BSUwpCiAgICAgICAgICAgICAgICBleGNlcHQgRXhjZXB0aW9uIGFzIGU6CiAgICAgICAgICAgICAgICAgICAgdHJhY2ViYWNrLnByaW50X2V4YygpCiAgICAgICAgICAgICAgICAgICAgI2V4Y190eXBlLCBleGNfb2JqLCBleGNfdGIgPSBzeXMuZXhjX2luZm8oKQogICAgICAgICAgICAgICAgICAgICNwcmludChleGNfdHlwZSwgZXhjX3RiLnRiX2xpbmVubykKICAgICAgICAgICAgICAgIGlmIChyZXNwID09ICJleHBsb2l0ZWQiKToKICAgICAgICAgICAgICAgICAgICB3aXRoIG9wZW4oIm91dC50eHQiLCAiYSIpIGFzIG9wOgogICAgICAgICAgICAgICAgICAgICAgICBvcC53cml0ZSh1cmwgKyAiXG4iKQogICAgICAgICAgICAgICAgICAgIGJyZWFrCgoKCmRlZiBoZWxwKCk6CiAgICBjb3V0IDw8IGYiIiJ1c2FnZToKICAgIHB5dGhvbiB7X19maWxlX199IC0taG9zdD1leGNoYW5nZS5jb20gLS1tYWlsPWFkbWluQGV4Y2hhbmdlLmNvbQogICAgcHl0aG9uIHtfX2ZpbGVfX30gLS1ob3N0PWV4Y2hhbmdlLmNvbSAtLW1haWxzPS4vbWFpbHMudHh0CmFyZ3M6CiAgICAtLWhvc3Q6IHRhcmdldCdzIGFkZHJlc3MuCiAgICAtLW1haWw6IGV4aXN0cyB1c2VyJ3MgbWFpbC4KICAgIC0tbWFpbHM6IG1haWxzIGZpbGUuCiAgICAiIiIKICAgIGNvdXQgPDwgZW5kbAoKCmRlZiBMb2dvKCk6CiAgICByZXR1cm4gJycnIAo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CgogX19fICAgICAgICAgICAgICAgICAgICAgXyAgICAgICAgICAgICAgICAgICAgICAgCnwgLiBcIF8gXyAgX19fIF9fICAgXyBfIHwgfCAgIF9fXyAgX19fICBfX18gLl8gXyAKfCAgXy98ICdfPi8gLiBcXCBcL3wgfCB8fCB8XyAvIC4gXC8gLiB8LyAuIFx8ICcgfAp8X3wgIHxffCAgXF9fXy8vXF9cYF8uIHx8X19ffFxfX18vXF8uIHxcX19fL3xffF98CiAgICAgICAgICAgICAgICAgICA8X19fJyAgICAgICAgICA8X19fJyAgICAgICAgICAKCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1dGhvcjogcDB3ZXJzaGUxMSxSR0RaCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KJycnCgoKaWYgX19uYW1lX18gPT0gIl9fbWFpbl9fIjoKICAgIGNvdXQgPDwgTG9nbygpCiAgICBtYWluKCkK
Undefined
By: Guest | Date: Oct 28 2021 13:24 | Format: None | Expires: never | Size: 16.27 KB | Hits: 279
Latest pastes
18 hours ago
21 hours ago
1 days ago
2 days ago
2 days ago