Skip to content

Instantly share code, notes, and snippets.

@ttakezawa
ttakezawa / pdf2md.py
Last active March 28, 2026 13:33
PDF to Markdown converter using docling VLM pipeline with OpenRouter API
"""PDF to Markdown converter using docling VLM pipeline with OpenRouter API."""
import argparse
import logging
import os
import sys
import time
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import VlmConvertOptions, VlmPipelineOptions
;; https://wwwtech.de/articles/2011/jul/emacs-restore-last-frame-size-on-startup
;;
;; Installation:
;;
;; Add the following to your emacs init file:
;;
;; (el-get-bundle gist:218fd80d9390845bf9dcad727237d4af:save-framegeometry
;; :features save-framegeometry)
(defun save-framegeometry ()
#!/usr/bin/env bash
# This is inspired by https://gist.github.com/xaicron/5524548, but this doesn't require mysqlenv and zsh
#
# Prepare (for CentOS):
# cpanm MySQL::Sandbox
# sudo yum install cmake ncurses-devel
# mkdir -p ~/opt/mysql
# git clone git://github.com/kamipo/mysql-build.git ~/opt/mysql/mysql-build
# ~/opt/mysql/mysql-build/bin/mysql-build -v 5.1.69 ~/opt/mysql/5.1.69
# make_sandbox 5.1.69
@ttakezawa
ttakezawa / emacs-latest.spec
Created January 3, 2013 12:21
CentOS6.3でemacs 24.2のRPM作成に使ったSPECファイル
Name: emacs-latest
Version: 24.2
Release: 1%{?dist}
Summary: GNU Emacs
#Group:
License: GPL
URL: http://www.gnu.org/software/emacs/
Source0: http://ftp.gnu.org/pub/gnu/emacs/emacs-24.2.tar.xz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ttakezawa
ttakezawa / CentOS-Base-source.repo
Last active December 10, 2015 12:48
If "http://vault.centos.org/$releasever/os/Source/" does not exist, then you should set releasever by doing the following. yumdownloader --source emacs --releasever=6.3
# CentOS-Base-source.repo
[base-source]
name=CentOS-$releasever – Base Source
baseurl=http://vault.centos.org/$releasever/os/Source/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
[updates-source]
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
# connect
my $dbh = DBI->connect(
'dbi:mysql:dbname=xyz',
'user',
'password'
@ttakezawa
ttakezawa / eRuby.rb
Created May 23, 2011 05:24
basic eRuby implementation
#!/usr/bin/ruby
# via [ruby-list:48093]
def eRuby(eruby_source)
source = eruby_source
ruby = ''
loop do
break if source.empty?
if source=~/<%=/m
text = $`
@ttakezawa
ttakezawa / tree.pl
Created May 21, 2011 10:38
tree(1) like command
#!/usr/bin/perl
use strict;
use warnings;
my $dir_cnt = -1;
my $file_cnt = 0;
sub visit {
my ($dirname, $line_prefix) = @_;
$dir_cnt++;