Day 19 solved
This commit is contained in:
		
							parent
							
								
									2bc1b72260
								
							
						
					
					
						commit
						1039666f65
					
				
							
								
								
									
										1
									
								
								Day 19/d19.utf8.emojic
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										1
									
								
								Day 19/d19.utf8.emojic
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| 🏁🍇🎶🔤🐇🦁🍟🗞🍰📘🥖🖼🚩🥩😵⛺❗️🥐😀🍉🥞🏁👉️🧀🍎🍪🚀🙋🏔🍊😛🐔🚇🔷🎶📄🍦📩🍋💩⁉️🍄🥜🦖💣🎄🥨📺🥯📽🍖🐠📘👄🍔🍕🐖🌭🍷🦑🍴⛪🤧🌟🔓🔥🎁🧦🤬🚲🔔🕯🥶❤️💎📯🎙🎚🎛📻📱🔋😈🔌💻🐬🖨🖱🖲💾💿🧮🎥🎞🔎💡🔦🏮📔📖🏙😁💤👻🛴📙📚🥓📓🛩📜📰😂🍇🚕🔖🏷💰⛴💴💸🚁🥶💳😎🖍🚎🥳📝📁🗂🥴📅📇📈📉📊🔒⛄🌰🕷⏳📗🔨🛠🧲🐧🚑🧪🐋🧬🔬🔭📡🤪🚒💉💊🛏🛋🚽🚿🧴🧷🍩🧹🧺😺🧻🚚🧯😇🚬🗜👽🔗🧰🎿🛷🥌🎯🎱🎮🎰🎲🏎🥵🧩🎭🎨🧵🧶🎼🎤🥁🎬🏹🎓🍾💐🍞🔪💥🐉🚛🦕🔐🍗🤠🐳🧫🐟🖥🐡🌼🤢🌷🌍🌈✨🎍🌖🤯🐝🦠🦋🤮🌋🏥🏭🗽⛲💯🌁🌃🚌📕🚜🛁🛵🚦🚧⛵🛳💺🚠🛰🎆🤕💀🤓🤡👺🤖👌👎🧠👀😴🖤🔤 ❗️➡️ ㉓ 🆕🍯🐚🔢🍆🐸❗️➡️ 🖍🆕㊷ 🔂 ⌘ 🆕⏩⏩ 🐔🍨🍆❗️ 🐔㉓❗️❗️ 🍇 ⌘ ➡️🐽 ㊷ 🐽 ㉓ ⌘❗️❗️🍉 🎶🔤🍴🎙🦖📺🍉📘🍖📜🔔🌟🦑❤️💩🔋❤️🔔🍉📩🎞🏮🌟💾⛪📺🥯🥳🔤 ❗️➡️ 🅜 🎶🔤💐🐡🧰🎲🤓🚚🧩🤡🔤 ❗️➡️ 🅼 😀 🔤 🔒 ➡️ 🎅🏻⁉️ ➡️ 🎄🚩 🔤❗️📇🔪 🆕 🔡 👂🏼❗️🐔🍨🍆❗️🐔🍨👎🍆❗️❗️❗️ ➡️ 🄼 ↪️🐔🄼❗️🙌 🐔🍨🍆❗️🍇🤯🐇💻🔤👎🔤❗️🍉 ☣️🍇🆕🧠🆕🐔🅜❗️❗️➡️ ✓🔂 ⌘ 🆕⏩⏩🐔🍨🍆❗️🐔🅜❗️❗️🍇🐽 ㊷ 🐽 🅜 ⌘❗️❗️ ➡️ ⌃🐽 🄼 ⌘ 🚮🐔🄼❗️❗️➡️ ^💧🍺⌃➖🐔㉓❗️➗🐔🍨👎👍🍆❗️❗️❌^❌💧⌘❗️➡️ ⎈ ↪️ ⌘ ◀ 🐔🅼❗️🤝❎🍺🐽 ㊷ 🐽 🅼 ⌘❗️❗️➖ 🤜🤜 🐔🅜❗️➕🐔🅜❗️➖🐔🄼❗️➖🐔🅼❗️➕🐔🍨👍🍆❗️🤛✖🐔🍨👎👎👎🍆❗️🤛 🙌 🔢⎈❗️❗️🍇 🤯🐇💻🔤👎🔤❗️🍉✍✓ ⎈ ⌘ 🐔🍨👎🍆❗️❗️🍉🔡🆕📇🧠✓ 🐔🅜❗️❗️❗️➡️ ⌘↪️⌘ 🙌 🤷♀️🍇🤯🐇💻🔤👎🔤❗️🍉😀🍺⌘❗️🍉 🍉 | ||||
							
								
								
									
										56
									
								
								Day 19/decode.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										56
									
								
								Day 19/decode.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,56 @@ | ||||
| #!/usr/bin/python | ||||
| 
 | ||||
| import requests | ||||
| import subprocess | ||||
| import sys | ||||
| import threading | ||||
| import queue | ||||
| import time | ||||
| from bs4 import BeautifulSoup as bs | ||||
| 
 | ||||
| # get unicode list | ||||
| print("Downloading full emoji unicode list…") | ||||
| res = requests.get("https://unicode.org/emoji/charts/full-emoji-list.html") | ||||
| if res.status_code != 200: | ||||
|     print("Server returned: %d %s" % (res.status_code, res.reason)) | ||||
|     exit(1) | ||||
| 
 | ||||
| print("Parsing…") | ||||
| unicodes = set() | ||||
| html = bs(res.text, 'lxml') | ||||
| elements = html.find_all("td", {"class": "chars"}) | ||||
| for e in elements: | ||||
|     unicodes.add(e.text.encode("UTF-8")) | ||||
| 
 | ||||
| initialSize = len(unicodes) | ||||
| print("Loaded %d unicodes" % initialSize) | ||||
| 
 | ||||
| def tryUnicode(unicode): | ||||
|     process = subprocess.Popen(["./test"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) | ||||
|     process.stdin.write(unicode) | ||||
|     process.stdin.write(b'\n') | ||||
|     process.stdin.flush() | ||||
|     return process.stdout.read() | ||||
| 
 | ||||
| queue = queue.Queue() | ||||
| for u in unicodes: | ||||
|     queue.put(u) | ||||
| 
 | ||||
| def doWork(): | ||||
|     while not queue.empty(): | ||||
|         u = queue.get() | ||||
|         output = tryUnicode(u) | ||||
|         if not b"Program panicked" in output: | ||||
|             print() | ||||
|             print("Input:", u.decode("UTF-8"), "Output:", output.decode("UTF-8").replace("\n", "\\n")) | ||||
| 
 | ||||
| threads = [] | ||||
| for n in range(10): | ||||
|     t = threading.Thread(target=doWork) | ||||
|     t.start() | ||||
|     threads.append(t) | ||||
| 
 | ||||
| while not queue.empty(): | ||||
|     sys.stdout.write("\rTrying %04d/%04d" % (initialSize - queue.qsize(), initialSize)) | ||||
|     sys.stdout.flush() | ||||
|     time.sleep(0.5) | ||||
							
								
								
									
										
											BIN
										
									
								
								Day 19/main
									
									
									
									
									
										Executable file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										
											BIN
										
									
								
								Day 19/main
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user