macOS Live Text has a very good quality/speed tradeoff.
Compared to Tesseract, it has much higher quality and is up to 3x as fast.
import Foundation | |
import Photos | |
func requestPhotoLibraryAccess(completion: @escaping (Bool) -> Void) { | |
PHPhotoLibrary.requestAuthorization { status in | |
completion(status == .authorized) | |
} | |
} | |
func fetchFavoritePhotos(startDate: Date) -> PHFetchResult<PHAsset> { |
macOS Live Text has a very good quality/speed tradeoff.
Compared to Tesseract, it has much higher quality and is up to 3x as fast.
3.5 fps, Paperwhite 3
@adtac_
mobileread.com is your best resource here, follow the instructions from the LanguageBreak thread
I didn't really follow the LanguageBreak instructions because I didn't care about most of the features + I was curious to do it myself, but the LanguageBreak github repo was invaluable for debugging
-- Export images from Photos via automated GUI manipulation | |
-- It's an unsavory approach, but no other means of automation seems to yield higher quality edited image exports (so far) | |
-- Arguments are passed in their order of appearance in the GUI, and expect values exactly matching the UI strings in Photos.app | |
-- Accepts an individual photo UUID, or an album UUID (use osxphotos query to look up UUIDs) | |
on run { uuid, exportDirectory, photoKind, jpegQuality, tiffBitDepth, colorProfile, photoSize, maxSizeType, maxSizeValue, includeMetadata, includeLocation , fileName, sequentialPrefix, subfolderFormat} | |
tell application "System Events" | |
set wasRunning to (name of processes) contains "Photos" | |
end tell |
import mmap | |
def get_last_lines(path: str, count: int) -> list[str]: | |
"""Get count last lines from a file.""" | |
with open(path, "r+b") as text_file: | |
text_mmap = mmap.mmap(text_file.fileno(), 0, mmap.ACCESS_READ) | |
position = len(text_mmap) | |
while count and (position := text_mmap.rfind(b"\n", 0, position)) != -1: | |
count -= 1 |
import os | |
from collections import deque | |
from collections.abc import Iterator, Sequence | |
from typing import Final, Protocol | |
class SeekableBytesFile(Protocol): | |
def seek(self, position: int, whence: int = ..., /) -> int: ... | |
def read(self, amount: int, /) -> bytes: ... |
"""Copy a file on macOS using native API. | |
This allows copied files to use copy-on-write when used on a volume formatted with APFS. | |
When used on an APFS volume, a file copied with this function will be copied almost instantly | |
and will not use any additional disk space until the file is modified. | |
To use, you will need to install pyobjc-core and pyobjc-framework-Cocoa: | |
`python3 -m pip install pyobjc-core pyobjc-framework-Cocoa` |
import pandas as pd | |
# Load the data | |
df = pd.read_excel('pnas.2118631119.sd01.xlsx') | |
import matplotlib.pyplot as plt | |
# Filter the data for ages 22-35 | |
df_filtered = df[(df['AGE'] >= 22) & (df['AGE'] <= 35) & (df['YEAR'] >= 1955) & (df['YEAR'] <= 2040)] |
# Clone llama.cpp | |
git clone https://github.com/ggerganov/llama.cpp.git | |
cd llama.cpp | |
# Build it | |
make clean | |
LLAMA_METAL=1 make | |
# Download model | |
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin |
#include <stdio.h> | |
#include <stdint.h> | |
// Philips Sonicare NFC Head Password calculation by @atc1441 Video manual: https://www.youtube.com/watch?v=EPytrn8i8sc | |
uint16_t CRC16(uint16_t crc, uint8_t *buffer, int len) // Default CRC16 Algo | |
{ | |
while(len--) | |
{ | |
crc ^= *buffer++ << 8; | |
int bits = 0; | |
do |