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
| #!/usr/bin/env python3 | |
| """ | |
| parquet_schema.py — Quick column (schema) lister for Parquet files or partitioned folders. | |
| Usage: | |
| python parquet_schema.py /path/to/file.parquet | |
| python parquet_schema.py /path/to/folder # infers dataset schema across files | |
| python parquet_schema.py /path --raw # print raw Arrow schema | |
| python parquet_schema.py /path --json # JSON output |
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
| #!/usr/bin/env python3 | |
| import argparse | |
| import re | |
| from datetime import datetime | |
| # Regex to strip ANSI escape sequences (colors, cursor moves, etc.) | |
| ANSI_ESCAPE_RE = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]') | |
| # Timestamp format for lines like: | |
| # 2025-11-18T21:52:39.117949Z |
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
| #!/bin/bash | |
| # set_mtime_to_creation.sh | |
| # Sets each file's modification time to its creation time (macOS / BSD) | |
| shopt -s nullglob | |
| for file in *; do | |
| # Skip directories | |
| if [ -d "$file" ]; then | |
| continue |
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
| # Define Aurora Serverless v2 PostgreSQL cluster | |
| self.aurora_cluster = rds.DatabaseCluster( | |
| self, | |
| "AuroraServerlessCluster", | |
| engine=rds.DatabaseClusterEngine.aurora_postgres(version=rds.AuroraPostgresEngineVersion.VER_16_6), | |
| writer=rds.ClusterInstance.provisioned( | |
| "writer", instance_type=ec2.InstanceType.of(ec2.InstanceClass.R6G, ec2.InstanceSize.LARGE) | |
| ), | |
| serverless_v2_min_capacity=0, # allow auto pause | |
| serverless_v2_max_capacity=8, |
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 typing import List, Tuple | |
| def bitstrToInt(bs: str) -> int: | |
| """Convert bitstring bs to an integer""" | |
| return int(bs, 2) | |
| def countBits(d: int) -> int: | |
| """Count the bits in d and return that value""" |
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 TimeInWordsError(Exception): | |
| pass | |
| def numberToString(d: int) -> str: | |
| """Number to string""" | |
| number_look = { | |
| 1: "one", | |
| 2: "two", |
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
| const MOVES = [[1, 1], [1, 0], [1, -1], [0, 1], [0, -1], [-1, 1], [-1, 0], [-1, -1]] | |
| function queensAttack(n: number, k: number, r_q: number, c_q: number, obstacles: number[][]): number { | |
| // Write your code here | |
| let spaces = 0 | |
| const obstacleSet = new Set(obstacles.map(o => `${o[0]},${o[1]}`)) | |
| const isvalidpos = (r: number, c: number) => { | |
| return r > 0 && r <= n && c > 0 && c <= n |
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
| function migratoryBirds(arr: number[]): number { | |
| // Write your code here | |
| let birdCount: { [key: number]: number} = {} | |
| let maxId = 0 | |
| let maxIdCount = 0 | |
| arr.forEach(bid => { | |
| if (birdCount[bid] !== undefined) { | |
| birdCount[bid]++ |
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 typing import Tuple | |
| class InvalidGame(Exception): | |
| def __init__(self, message): | |
| super().__init__(message) | |
| class Board: | |
| """N x N chessboard""" |
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 sys | |
| class SinglyLinkedListNode: | |
| def __init__(self, node_data): | |
| self.data = node_data | |
| self.next = None | |
| class SinglyLinkedList: |
NewerOlder