Skip to content

Instantly share code, notes, and snippets.

# dots_mps_parse.py
# macOS/M1-friendly runner for dots.ocr (local, offline, SDPA on MPS)
# - Uses repo's built-in prompts via --prompt-mode (JSON-ready)
# - Harmless flash_attn shim (with valid __spec__) to avoid import crashes
# - Forces SDPA attention (not Flash-Attn)
# - Disables Sliding-Window Attention for SDPA/Qwen2
# - Avoids BF16 by forcing FP16 everywhere and monkey-patching the vision tower
# - Processes PDFs page-by-page with pixel caps to avoid OOM on 16 GB
# - Parses JSON output flexibly (array OR object) and can drop headers/footers
@pllopis
pllopis / gist:57cb7ccff93ec8ffcce4
Created October 30, 2012 16:37 — forked from anonymous/gist:8dfca128e1409cb198bf
Paravirtualized Storage Interface
// All domains need to know is container name and object names
// The domain which creates the container needs to know the groupid
// CONTAINER OPERATIONS
// Creates a new container shared with groupid
// Returns a container ID (>=0) if no error occurs.
// Returns error (<0) if resource allocation fails or if container already exists
int container_create(char *name, int groupid)
@pllopis
pllopis / deldenyhosts
Created February 3, 2012 15:34
Unblock host from denyhosts
#!/bin/bash
# Description: Remove host from denyhosts files
# This script can be run from any directory
# It requires to be run as root
#
# Pablo Llopis 2011
CONFIG='/etc/denyhosts.conf'
if [ $# -ne 1 ];
@pllopis
pllopis / Inception
Created December 21, 2011 13:07
Chroot into a device or file taking care of mounting proc, sysfs, /dev, setting mount options, umounting, etc
#!/bin/bash
function ifloop {
# If it is NOT a file in /dev, assume file loopback mount
if [[ ! $1 =~ /dev/* ]]
then
echo "-o loop"
fi
}