This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import Counter | |
| from itertools import takewhile, count | |
| def playLife(layout, cycles): | |
| previous = None | |
| living = {(x, y) for x, line in enumerate(layout) for y, _ in filter(lambda c: c[1] == '@', enumerate(line))} | |
| has_changed = takewhile(lambda _: living != previous, count()) | |
| getNeighbors = lambda cell: {(cell[0] + x, cell[1] + y) for x in range(-1, 2) for y in range(-1, 2)} | |
| for _ in zip(range(cycles), has_changed): | |
| previous = living |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let thought be like truth vaccinated | |
| let wit be like jackanapes | |
| let the truth be wit | |
| let the dream be wit | |
| listen to the stream | |
| until the stream is nothing, | |
| roll it into the abyss. | |
| let the day be the abyss between "R" of 2 without 1 | |
| cast the stream with 10 | |
| let the memory be thought; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {{Front}} | |
| <div id='tags'>{{Tags}}</div> | |
| <script> | |
| let tags = document.getElementById('tags') | |
| tags.innerHTML = tags.innerHTML.split(' ').filter(function(tag){return tag.match(/^N[0-9]$/i)}).join(' '); | |
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DROP TABLE IF EXISTS day15; | |
| CREATE TABLE `day15` ( | |
| `signalX` int DEFAULT NULL, | |
| `signalY` int DEFAULT NULL, | |
| `beaconX` int DEFAULT NULL, | |
| `beaconY` int DEFAULT NULL, | |
| `radius` int GENERATED ALWAYS AS (ABS(`signalX` - `beaconX`) + ABS(`signalY` - `beaconY`)) | |
| ); | |
| LOAD DATA INFILE 'c:/ProgramData/MySQL/MySQL Server 8.0/Uploads/day15.txt' INTO TABLE day15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DROP TABLE IF EXISTS day12, graph; | |
| SET NAMES binary; | |
| CREATE TABLE day12 ( | |
| rowNum int DEFAULT 1, | |
| colNum int auto_increment, | |
| cell char(1), | |
| primary key (rowNum, colNum) | |
| ) DEFAULT CHARSET=binary ENGINE=MyISAM; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE day09 ( | |
| direction ENUM('U', 'D', 'L', 'R'), | |
| distance int | |
| ) ENGINE=BLACKHOLE; | |
| CREATE TABLE knots ( | |
| id int primary key, | |
| x int, | |
| y int | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE `day07` ( | |
| `id` int unsigned NOT NULL AUTO_INCREMENT, | |
| `parentId` int unsigned DEFAULT NULL, | |
| `name` varchar(20) DEFAULT NULL, | |
| `size` int unsigned DEFAULT NULL, | |
| PRIMARY KEY (`id`) | |
| ); | |
| CREATE TRIGGER `day07_bi` BEFORE INSERT ON `day07` FOR EACH ROW SET NEW.parentId = @curdir; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE day01 (elf int auto_increment primary key, calories JSON); | |
| LOAD DATA LOCAL INFILE 'day01.txt' INTO TABLE day01 | |
| LINES TERMINATED BY '\n\n' (@cal) | |
| SET calories = CONCAT('[', TRIM(TRAILING ',' FROM REPLACE(@cal, '\n', ',')), ']'); | |
| CREATE VIEW calories AS SELECT SUM(cal) AS cal | |
| FROM day01 | |
| JOIN JSON_TABLE(calories, '$[*]' COLUMNS(cal int path '$')) jt GROUP BY elf ORDER BY cal DESC; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Open the debug console with Ctrl+: (which is Ctrl+Shift+; on US keyboards) | |
| # (Don't have the browser window open when you do.) | |
| # Run it with Ctrl+Enter | |
| # Remove the # from the last line to actually save the changes | |
| s = r'regular expression to search for goes here' | |
| srcField = 'Source Field Name goes here' | |
| tgtField = 'Target Field Name goes here' | |
| noteType = 'Name of the Note Type goes here' |