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 time | |
| from contextlib import contextmanager | |
| from datetime import timedelta | |
| from rich.align import Align | |
| from rich.columns import Columns | |
| from rich.console import Console | |
| from rich.padding import Padding | |
| from rich.style import Style | |
| from rich.text import Text |
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 argparse | |
| import copy | |
| import mlx.core as mx | |
| from pathlib import Path | |
| from mlx_lm import load, stream_generate | |
| from mlx_lm.generate import generate_step | |
| from mlx_lm.models.cache import make_prompt_cache | |
| DEFAULT_MAX_TOKENS = 2048 |
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 python | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Standalone Asynchronous RolmOCR Inference Script using vLLM and PyMuPDF. | |
| This script processes PDF files from an input directory using the | |
| reducto/RolmOCR model served locally by vLLM via its OpenAI-compatible API. | |
| It renders each page, sends API requests concurrently for OCR, extracts plain | |
| text, and saves the combined text for each PDF into a corresponding .txt file | |
| in the specified output directory. |
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 | |
| """ | |
| Dynamic and Adaptive Python Environment in a Bubblewrap Sandbox | |
| Overview: | |
| This project demonstrates a minimal, safe, and self-contained Python execution | |
| environment using bubblewrap (bwrap) and uv. The goal is to provide a lightweight | |
| alternative to Docker for running agent code—in this case, dynamically generated | |
| Python code along with its dependencies—within an isolated sandbox. |
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 tweepy | |
| import os | |
| from typing import List, Optional | |
| class TwitterClient: | |
| def __init__( | |
| self, | |
| consumer_key: str, | |
| consumer_secret: str, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 duckdb | |
| import fabduckdb | |
| import gspread | |
| import pandas as pd | |
| def read_gsheet(service_account_json_path: str, gsheets_url: str, worksheet_name: str) -> pd.DataFrame: | |
| gc = gspread.service_account(filename=service_account_json_path, scopes=gspread.auth.READONLY_SCOPES) | |
| gsheet = gc.open_by_url(gsheets_url) | |
| data = gsheet.worksheet(worksheet_name).get_all_records() |
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
| def lerp(a, b, t): | |
| return (b - a) * t + a | |
| def bias(i, x, beta): | |
| return 1 - jnp.asarray(beta, x.dtype) ** (i + 1) | |
| @optimizer | |
| def adam(step_size, b1=0.9, b2=0.999, eps=1e-8) -> OptimizerResult: | |
| """Construct optimizer triple for Adam. |
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 video_to_gif { | |
| local input_video_path="$1" | |
| local output_gif_path="$2" | |
| local fps="${3:-10}" | |
| local scale="${4:-1080}" | |
| local loop="${5:-0}" | |
| ffmpeg -i "${input_video_path}" -vf "setpts=PTS/1,fps=${fps},scale=${scale}:-2:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop $loop "${output_gif_path}" | |
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder