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
| // Credit goes to https://haqr.eu/tinycompiler/afterword/ | |
| /* | |
| * CONCEPT: | |
| * 1. Sign Bit Handling (MSB): | |
| * Since standard integers are signed (2's complement), negative numbers | |
| * would break the 'while (a > 0)' loop condition. We treat the 32nd bit | |
| * (the sign bit, value 2^31 or 2147483648) separately. We manually check | |
| * it, strip it to make the numbers positive, and re-apply it to the result | |
| * if necessary. |
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
| class Tag { | |
| constructor(level, text) { | |
| this.level = level; | |
| this.text = text; | |
| }; | |
| }; | |
| function extractHeaders() { | |
| const headers = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| console.log(headers); |
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
| # gnome_to_kitty.py | |
| import subprocess | |
| import re | |
| import ast | |
| import sys | |
| def get_profile_uuid(): | |
| try: | |
| cmd = ["gsettings", "get", "org.gnome.Terminal.ProfilesList", "default"] | |
| result = subprocess.check_output(cmd).decode("utf-8").strip() |
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
| import socket | |
| import subprocess | |
| import click | |
| from threading import Thread | |
| def run_cmd(cmd): | |
| output = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | |
| return output.stdout | |
| def handle_input(client_socket): |
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
| import os | |
| import re | |
| import uuid | |
| TARGET_DIR = "content" | |
| FRONTMATTER_PATTERN = re.compile(r"^---\n(.*?)\n---", re.DOTALL) | |
| PERMALINK_PATTERN = re.compile(r"permalink:\s*(.+?)\s*$", re.MULTILINE) | |
| TEMPLATE_PATTERN = re.compile(r".*content/templates.*") |