saurus12 Documentation

website·Indexed 30 days ago

https://docs.saurus12.com/

A technical knowledge base providing tutorials and guides on Python automation (Google Drive, OneDrive, Selenium), AWS services (Lambda, S3, SNS, SQS, API Gateway), Azure cloud configuration, ESP32 and XBee hardware setup, and general software tips including WSL and Minecraft MODs.

Tokens
48.3K
Snippets
202
Records
291
Agent score
54%

What's inside saurus12

  1. Architecture for BLE-based iPhone monitoring service

    A complete monitoring pipeline can be implemented using the following components:

    1. Device Setup: ESP32 running MicroPython.
    2. Identification: Use IRK to resolve random BLE addresses and RSSI for location/presence detection.
    3. Cloud Integration: Use AWS IoT to transmit detection data from the ESP32 to the cloud.
    4. Notification: Use AWS Lambda to trigger a LINE Bot for real-time alerts.
  2. Implement a remote home monitoring system using XBee and ESP32

    This system monitors home status (specifically light ON/OFF states) by combining short-range wireless communication, a microcontroller, and cloud services. The architecture consists of the following components:

    • XBee (ZigBee): Used for short-range wireless communication between the sensor and the coordinator.
    • ESP32 Microcontroller: A WiFi-enabled Arduino-compatible board that processes data and communicates with the cloud.
    • AWS (API Gateway, Lambda): Handles data processing and logic triggers.
    • Line Messaging API: Sends notifications to the user's mobile device.
  3. Set up Chrome Driver for Selenium

    To use Selenium with Google Chrome, you must download the matching version of chromedriver.exe.

    1. Check your Chrome version via 'Help' -> 'About Google Chrome'.
    2. Download the corresponding driver from the Chrome for Testing site.
    3. Place the chromedriver.exe file in a directory included in your system PATH (e.g., C:\windows\system32).
  4. Register an Azure App for OneDrive API access

    To automate OneDrive access, you must register an application in the Azure Portal.

    1. Register the app via the Azure Portal.
    2. Set the Redirect URL to http://localhost:4200/.
    3. Navigate to the 'Overview' section to retrieve the Client ID.
    4. Navigate to 'Certificates & secrets' and create a new Client Secret.

    Important: Use the 'Value' of the client secret, not the 'Secret ID'.

  5. Implement AWS Lambda integration with SNS and SQS

    To ensure system robustness and prevent message loss during high-volume event spikes, it is a best practice to route SNS events through an SQS queue before they trigger a Lambda function, rather than triggering Lambda directly from SNS.
  6. Identify iPhones using BLE IRK with ESP32 and MicroPython

    To identify a specific iPhone despite its random BLE MAC address, you must use the Identity Resolving Key (IRK). The ESP32 can be programmed with MicroPython to receive BLE advertise signals and resolve the random address using a pre-stored IRK. Proximity and movement can be tracked by monitoring the Received Signal Strength Indicator (RSSI) values of the identified device.
  7. File Furusato Nozei deductions in the NTA portal

    Once authenticated in the National Tax Agency (NTA) Tax Return Creation Corner:

    1. Select "Income Tax" (所得税).
    2. When asked about Myna Portal linkage, select "Do not link" (連携しない).
    3. Select "Create Tax Return" (申告書等を作成する).
    4. Use the "Select File" (ファイルを選択) button to upload the Donation Deduction Statement (XML file) prepared from your donation platform.
    5. Manually enter the details from your Withholding Tax Slip (源泉徴収票).
  8. Build a QR Code Generation LINE Bot using AWS Lambda and Python

    This project implements a serverless LINE Bot that automatically generates QR codes from text messages sent by users. The architecture uses Python for the generation logic, AWS Lambda for compute, and API Gateway to expose the endpoint to the LINE Messaging API. The system is designed to be low-cost and requires no infrastructure management.
  9. Get started with Google Colaboratory

    Google Colaboratory (Colab) is a browser-based Python development environment that requires no local setup. Key features include free access to GPUs, the ability to install additional libraries, and a Jupyter Notebook format that allows mixing Markdown text with executable Python code.
  10. List files and folders in Google Drive

    Retrieve a list of files and folders from the root directory or a specific folder using the Google Drive API. The Authorization header must include the Bearer access token.
    import urllib.parse
    import urllib.request
    import json
    
    def get_googledrive_item(access_token: str, item_id: str):
        # Get metadata for a specific file/folder
        url = f"https://www.googleapis.com/drive/v3/files/{item_id}"
        headers = {'Authorization': 'Bearer ' + access_token}
        request = urllib.request.Request(url, method="GET", headers=headers)
        with urllib.request.urlopen(request) as res:
            print(res.read().decode('utf-8'))
    
    def get_googledrive_list(access_token: str):
        # List children of the root folder
        url = "https://www.googleapis.com/drive/v2/files/root/children"
        headers = {'Authorization': 'Bearer ' + access_token}
        request = urllib.request.Request(url, method="GET", headers=headers)
        with urllib.request.urlopen(request) as res:
            dat = json.loads(res.read().decode('utf-8'))
            if "items" in dat:
                for item in dat["items"]:
                    print(f"ID: {item['id']} Name: {item['name']}")
                    get_googledrive_item(access_token, item["id"])
    
    if __name__ == '__main__':
        access_token = "YOUR_ACCESS_TOKEN"
        get_googledrive_list(access_token)
  11. Integrate Algolia DocSearch into a React/Next.js project

    Install the @docsearch/react library and its associated CSS to add a search bar to your React application. The <DocSearch /> component requires the appId, indexName, and apiKey retrieved from the Algolia dashboard.
    # Install the DocSearch React library
    npm install @docsearch/react@3
    import { DocSearch } from '@docsearch/react'
    import '@docsearch/css'
    
    export default function Home() {
      return (
        <div>
          <DocSearch
            appId="YOUR_APP_ID"
            indexName="YOUR_INDEX_NAME"
            apiKey="YOUR_SEARCH_API_KEY"
          />
        </div>
      );
    }
  12. Create and authenticate with Azure Container Registry (ACR)

    Create an Azure Container Registry with admin user enabled, retrieve the credentials, and log in via the Docker CLI.
    # Create the ACR
    az acr create \
     --name <registry_name> \
     --resource-group <resource_group> \
     --sku Basic \
     --admin-enabled true
    
    # Get registry credentials
    az acr credential show \
     --resource-group <resource_group> \
     --name <registry_name>
    
    # Login to the registry
    docker login <registry_name>.azurecr.io --username <registry_name>