π to 3200 digits in the Library of Babel
The decoding key is as follows:
| Character | Digit |
|---|---|
| a | 0 |
| b | 1 |
| import requests | |
| import datetime | |
| import re | |
| import pandas as pd | |
| from bs4 import BeautifulSoup | |
| import time | |
| from typing import List, Dict, Optional | |
| def get_available_years(github_username: str, headers: dict) -> List[int]: | |
| """ |
| { | |
| "Acentric_Factor": 0.5, | |
| "BO_BSW": 0.0, | |
| "BO_GOR": 0.0, | |
| "BO_OilVisc1": 0.0, | |
| "BO_OilVisc2": 0.0, | |
| "BO_OilViscTemp1": 0.0, | |
| "BO_OilViscTemp2": 0.0, | |
| "BO_PNA_A": 0.0, | |
| "BO_PNA_N": 0.0, |
| # Import packages | |
| import os | |
| import dotenv # for .env files | |
| import datetime | |
| import requests | |
| import pandas as pd | |
| # Do `pip install notion-df` first | |
| import notion_df |
| # Import packages | |
| import os | |
| import dotenv # For .env files | |
| import datetime | |
| import pandas as pd | |
| # import base64 | |
| import requests | |
| import io |
| -- Source: https://stackoverflow.com/a/33511182 | |
| -- Check if array contains a specific value | |
| local function has_value (tab, val) | |
| for index, value in ipairs(tab) do | |
| if value == val then | |
| return true | |
| end | |
| end | |
| return false |
| import re | |
| text = "Dummy text here with the cards" | |
| # Regex for Basic Card with Extra field using #flashcard | |
| basic_regex = r"((?:[^\n][\n]?)+) #flashcard ?\n*((?:\n(?:^.{1,3}$|^.{4}(?<!<!--)(?<!Extra: ).*)))(?:\nExtra: (.*))+" | |
| # Regex for Cloze Card with Extra field | |
| cloze_extra = r"((?:.+\n)*(?:.*==.*)(?:\n(?:^.{1,6}$|^.{7}(?<!<!--ID:)(?<!Extra: ).*))*)(?:\nExtra: (.*))?" |
| import re | |
| text = "[hello:: world]\n[key:: value]\n[testing::1]\n[listing::1,2,3]" | |
| # Caveat: These regex only work with one field on a line | |
| # and cannot have two or more in the same line. | |
| key_regex = r"(?!\[).*(?:(?=\:\:))" | |
| value_regex = r"(?:(?<=\:\:)(.*)(?=\]))" | |
| # Save values to a list |
| def round_up(n, decimals=0): | |
| # Move significant decimal digits to the left of the decimal point | |
| multiplier = 10 ** decimals | |
| # Truncate the unneeded digits on the right of the decimal point | |
| sig_digits = n * multiplier // 1 | |
| # Determine whether to round up or round down | |
| # Return 1 if the tenth digit is greater than or equal to 5, | |
| # else return 0 if less than 5 |
The decoding key is as follows:
| Character | Digit |
|---|---|
| a | 0 |
| b | 1 |
| # Script to parse the csv from the Forest App into a pandas dataframe | |
| #%% | |
| import pandas as pd | |
| from datetime import datetime | |
| ### Specify pattern for dates in Forest's csv export for dateparser | |
| dateparse = lambda x: datetime.strptime(x, "%a %b %d %H:%M:%S %Z%z %Y") | |
| ### Sidenote: Alternative regex patterns |