Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- class UnicornExtension(Extension):
- """Unicorn shell"""
- def __init__(self):
- super().__init__("unicorn")
- self.text = requests.get("https://asciiman.neocities.org/MLP.html").text.split("Mattia")[1:]
- def unicorn_command(self, args=""):
- """find out yourself :)"""
- import random
- cur = self.text[random.randrange(len(self.text))]
- print(cur.replace("|\n|", "\n"))
- try:
- script = """
- (function (srcs,cfg) { var cbcount = 1; var callback = function () { -- cbcount; if (cbcount === 0) { BrowserPonies.setBaseUrl(cfg.baseurl); if (!BrowserPoniesBaseConfig.loaded) { BrowserPonies.loadConfig(BrowserPoniesBaseConfig); BrowserPoniesBaseConfig.loaded = true; } BrowserPonies.loadConfig(cfg); if (!BrowserPonies.running()) BrowserPonies.start(); } }; if (typeof(BrowserPoniesConfig) === "undefined") { window.BrowserPoniesConfig = {}; } if (typeof(BrowserPoniesBaseConfig) === "undefined") { ++ cbcount; BrowserPoniesConfig.onbasecfg = callback; } if (typeof(BrowserPonies) === "undefined") { ++ cbcount; BrowserPoniesConfig.oninit = callback; } var node = (document.body || document.documentElement || document.getElementsByTagName('head')[0]); for (var id in srcs) { if (document.getElementById(id)) continue; if (node) { var s = document.createElement('script'); s.type = 'text/javascript'; s.id = id; s.src = srcs[id]; node.appendChild(s); } else { document.write('\u003cscript type="text/javscript" src="'+ srcs[id]+'" id="'+id+'"\u003e\u003c/script\u003e'); } } callback();})({"browser-ponies-script":"https://panzi.github.io/Browser-Ponies/browserponies.js","browser-ponies-config":"https://panzi.github.io/Browser-Ponies/basecfg.js"},{"baseurl":"https://panzi.github.io/Browser-Ponies/","fadeDuration":500,"volume":1,"fps":25,"speed":3,"audioEnabled":false,"showFps":false,"showLoadProgress":true,"speakProbability":0.1,"spawn":{},"spawnRandom":9});void(0)
- """
- get_ipython().run_cell_magic('javascript', '', script)
- except:
- pass
- ext = UnicornExtension()
- debugger.extensions[ext.name] = ext
- ext.enable(debugger)
- debugger.log("[unicorn]: Extension loaded successfully!")
- debugger.log("[unicorn]: Credits for unicorns: Mattia Basaglia (http://mattbas.org/)")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement