This file contains 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
pattern = ( | |
b'(?:\\\r\\\n|\\\r|\\\n)|(?:[\x00-\x08\x0e-\x1f\x7f]|(?:\\\t|\\\x0b|\\\x0c' | |
b')|\xc2[\x80-\x9f\xad]|\xd8\x9c|\xe1\xa0\x8e|\xe2(?:\x80[\x8b\x8e\x8f\xa8' | |
b'-\xae]|\x81[\xa0-\xaf])|\xef(?:\xbb\xbf|\xbf[\xb0-\xbb])|\xf0(?:\x93\x90' | |
b'[\xb0-\xbf]|\x9b\xb2[\xa0-\xa3]|\x9d\x85[\xb3-\xba])|\xf3\xa0(?:\x80[' | |
b'\x80-\x9f]|[\x82\x83\x88-\xbf][\x80-\xbf]|\x87[\xb0-\xbf]))|(?:\xd8[\x80' | |
b'-\x85]|\xdb\x9d|\xdc\x8f|\xe0(?:\xa2[\x90\x91]|\xa3\xa2|\xb5\x8e)|\xf0' | |
b'\x91(?:\x82\xbd|\x83\x8d|\x87[\x82\x83]|\xa4\xbf|\xa5\x81|\xa8\xba|\xaa[' | |
b'\x84-\x89]|\xb5\x86|\xbc\x82))*(?:(?:(?:\xe1(?:\x84[\x80-\xbf]|\x85[\x80' | |
b'-\x9f])|\xea\xa5[\xa0-\xbc])*(?:(?:\xe1(?:\x85[\xa0-\xbf]|\x86[\x80-\xa7' |
This file contains 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
import argparse, time | |
# Instruction format: | |
# 1xxxxxxx noop | |
# 0xxxxxxx add xxxxxxx to x register as a 7-bit signed integer | |
parser = argparse.ArgumentParser() | |
parser.add_argument('subcommand', choices=['run', 'assemble', 'compile']) | |
parser.add_argument('input') | |
parser.add_argument('--out', required=False) |
This file has been truncated, but you can view the full file.
This file contains 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
addx 1 | |
addx 2 | |
addx 2 | |
addx 2 | |
addx 2 | |
addx 2 | |
addx 2 | |
addx 2 | |
addx 2 | |
addx 2 |
This file contains 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
⎕IO ← 0 | |
⍝ Day 1 | |
⍝ Input: a nested vector of numbers | |
d1p1 ← ⌈/+/¨ | |
d1p2 ← {+/ 3↑ {⍵[⍒⍵]} +/¨⍵} | |
⍝ Day 2 | |
⍝ Input: a `n 2`-shaped character matrix | |
d2p1a ← {+/ 1 {⍵ + 1 + 3 × 3 | 1 + ⍵ - ⍺}¨ ⍥ ((⍉ (3∘| 'ABCXYZ'∘⍳)¨ ⍵)∘(↑⍨)) ¯1} | |
d2p2a ← {+/ 1 {(3 × ⍵) + 1 + 3 | ⍵ + ⍺ - 1}¨ ⍥ ((⍉ (3∘| 'ABCXYZ'∘⍳)¨ ⍵)∘(↑⍨)) ¯1} | |
⍝ Alternate input: two equal-length character vectors |
This file contains 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
// Minesweeper 2.0 | |
var readline = require("readline") | |
var crypto = require("crypto") | |
var readline = require("readline") | |
readline.emitKeypressEvents(process.stdin); | |
var stdin = process.stdin | |
var stdout = process.stdout | |
stdin.setRawMode(true); | |
var width = 35 | |
var height = 15 |
This file contains 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
content = "\n".join([f"**{x.get('name')}** : {', '.join([f'{k}: `{v[0]},{v[1]}`' if isinstance(v, list) else f'{k}: `{v}`' for k, v in sorted(x.items(), key=lambda λ: λ[0]) if k not in ['name', 'tags']])}" if not isinstance(x, str) else x for x in [matches[0]] + sorted(matches[1:], key=lambda λ: (λ[sort_by], λ[secondary_sort_by]), reverse=reverse)[first_result:last_result + 1]]) |
This file contains 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
// 99 bottles of beer in babalang | |
//define variables and create some sentences | |
// string numbers | |
0_str is you and move and more and move and more and more and more and more | |
1_str is 0_str and move | |
2_str is 1_str and move |
This file contains 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
===Fibonacci=== | |
// This function prints each digit of the digits of an input's ASCII representation. | |
// This is optional, but makes the result much tidier. | |
ord is level and has input | |
// No magic numbers! Every literal has to be constructed :/ | |
// ASCII strings of each digit | |
0_str is you and move and more and move and more and more and more and more | |
1_str is 0_str and move |