Skip to content

Instantly share code, notes, and snippets.

@doraTeX
doraTeX / onepage-aj16-KozMin.tex
Created August 3, 2014 09:21
小塚明朝で Adobe-Japan 1-6 の全グリフを1ページに
\documentclass[uplatex,dvipdfmx]{jsarticle}
\usepackage[papersize={580pt,7410pt},margin=10pt,noheadfoot,dvipdfm]{geometry}
\usepackage{otf}
\usepackage{color}
\usepackage{pgffor}
\pagestyle{empty}
\usepackage{numprint}
\npthousandsep{}
\nplpadding{5}
@doraTeX
doraTeX / Gauche_the_Cellist.tex
Last active August 29, 2015 14:04
upLaTeX + Source Han Sans による縦書き実験 http://doratex.hatenablog.jp/entry/20140803/1407072636
\documentclass[uplatex,a5paper,twoside]{jsarticle}
\usepackage{pxrubrica}
\pagestyle{myheadings}
\usepackage[margin=15mm,headsep=5mm]{geometry}
\makeatletter
% 縦組にする
\AtBeginDocument{\tate\adjustbaseline}
% \textheight と \textwidth を逆転
@doraTeX
doraTeX / plist2atok.rb
Last active August 29, 2015 14:06
iOS標準キーボードの登録単語をMac経由でATOK for iOSへインポートする ref: http://qiita.com/doraTeX/items/3d2bfd2622286c0aca72
#!/usr/bin/ruby
require 'rexml/document'
dict = REXML::Document.new(open("ユーザ辞書.plist"))
open("user_word.txt","w:UTF-16LE"){|f|
f.print "\uFEFF!!ATOK_TANGO_TEXT_HEADER_1\r\n\r\n"
dict.elements.each('plist/array/dict') do |element|
phrase = element.elements[2].text
shortcut = element.elements[4].text
@doraTeX
doraTeX / make10.rb
Last active August 29, 2015 14:07
Ten Puzzle Solver
#!/usr/bin/ruby
operators = ['+','-','*','/']
patterns = ["((%f %s %f) %s %f) %s %f",
"(%f %s %f) %s (%f %s %f)",
"(%f %s (%f %s %f)) %s %f",
"%f %s ((%f %s %f) %s %f)",
"%f %s (%f %s (%f %s %f))"]
NOTFOUND = "NOT FOUND"
@doraTeX
doraTeX / pdfPageCount.swift
Last active August 31, 2018 06:22
指定したディレクトリ内の全PDFファイルのページ数をカウントするSwiftスクリプト
#!/usr/bin/swift
import Cocoa
import Quartz
var openPanel = NSOpenPanel()
openPanel.canChooseDirectories = true
openPanel.canChooseFiles = false
let returnCode = openPanel.runModal()
@doraTeX
doraTeX / DictionaryServiceManager-Test.swift
Last active August 31, 2018 06:08
Swiftでシステム内蔵辞書を検索する方法 ref: http://qiita.com/doraTeX/items/9b290f4e39f1e100558b
let wisdomPath: String
if #available(OSX 10.13, *) {
wisdomPath = "/System/Library/Assets/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/65c5f4f22827dba6b0a6bc85755863317890953b.asset/AssetData/Sanseido The WISDOM English-Japanese Japanese-English Dictionary.dictionary"
} else {
wisdomPath = "/Library/Dictionaries/Sanseido The WISDOM English-Japanese Japanese-English Dictionary.dictionary"
}
// "swift" の意味を取得
let word = "swift"
if let content = DictionaryServiceManager().lookUp(word, inDictionary: wisdomPath) {
@doraTeX
doraTeX / upjcode-test.tex
Last active April 28, 2016 15:05
upTeX で文字コードを調べる upjcode パッケージ http://doratex.hatenablog.jp/entry/20150218/1424257261
\documentclass[uplatex]{jsarticle}
\usepackage[margin=1.5cm]{geometry}
\pagestyle{empty}
\usepackage{otf} %% BMP外文字を出力したいので
\usepackage{upjcode}
%%% \kutenTable{区}{点}
%%% 与えられた JIS X 0208 の区点位置に関する文字情報の表を作成する。
\def\kutenTable#1#2{\texttt{%
\begin{tabular}{|l|l|} \hline
@doraTeX
doraTeX / wordweight
Last active August 29, 2015 14:18
「ことばのおもみ」自動測定スクリプト http://doratex.hatenablog.jp/entry/20150331/1427755389
#!/usr/bin/ruby -W0
# coding: utf-8
#
# This software is derived from bmp.rb provided by Yoichi Yokogawa.
# https://github.com/yoyoichi/bmp-ruby
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
### BitMap class
@doraTeX
doraTeX / pageboxinfo.swift
Last active August 31, 2018 06:42
Show page box info of PDF by using Swift and Quartz ( http://doratex.hatenablog.jp/entry/20150909/1441748482 )
// How to compile:
// swiftc -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -o pageboxinfo pageboxinfo.swift
import Foundation
import Quartz
extension CGPDFBox {
var title: String {
switch self {
case .mediaBox:
return "MediaBox: "
@doraTeX
doraTeX / lnsysfnt.sh
Last active September 21, 2015 17:31 — forked from munepi/lnsysfnt.sh
#!/bin/bash
# This program is licensed under the terms of the MIT License.
#
# Copyright (c) 2014 Munehiro Yamamoto <munepixyz@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell