Skip to content

Instantly share code, notes, and snippets.

@hiterm
hiterm / genno-xelatex.tex
Created May 21, 2017 13:05
源ノ明朝と源ノ角ゴシックをXeLaTeXで使う
\documentclass[a4paper,xelatex,ja=standard]{bxjsarticle}
\setCJKmainfont{Source Han Serif}
\setCJKsansfont{Source Han Sans}
\begin{document}
あいうえお直雲辞間
明朝\textbf{明朝ボールド}\textsf{ゴシック}\textbf{\textsf{ボールドゴシック}}
\end{document}
@hiterm
hiterm / genno-lualatex.tex
Last active May 27, 2017 14:18
源ノ明朝と源ノ角ゴシックをluaLaTeXで使う
\documentclass{ltjsarticle}
\usepackage[no-math]{luatexja-fontspec}
\setmainjfont[BoldFont=Source Han Serif Bold]{Source Han Serif}
\setsansjfont[BoldFont=Source Han Sans Bold]{Source Han Sans}
%\setmainjfont[BoldFont=file:SourceHanSerif-Bold.ttc(0)]{file:SourceHanSerif-Regular.ttc(0)}
%\setsansjfont[BoldFont=file:SourceHanSans-Bold.ttc(0)]{SourceHanSans-Regular.ttc(0)}
\begin{document}
あいうえお直雲辞間
@hiterm
hiterm / genno-deluxe-ttc.tex
Last active May 19, 2017 13:00
源ノ明朝と源ノ角ゴシックをupLaTeXで使ってみるテスト(ttc版)
\documentclass[uplatex]{jsarticle}
\usepackage[deluxe]{otf}
\usepackage[directunicode*, noalphabet]{pxchfon}[2017/04/08]
\setminchofont[0]{SourceHanSerif-Regular.ttc}
\setboldminchofont[0]{SourceHanSerif-Bold.ttc}
\setgothicfont[0]{SourceHanSans-Regular.ttc}
\setboldgothicfont[0]{SourceHanSans-Bold.ttc}
@hiterm
hiterm / genno.tex
Last active May 5, 2017 13:45
源ノ明朝と源ノ角ゴシックをupLaTeXで使ってみるテスト(pxchfon+otfパッケージ使用)
% エラーが出る場合はフォントをTeX側から見える位置に置くか,
% export OSFONTDIR=/usr/shar/fonts とする.
% http://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=1904
\documentclass[a4paper, ja=standard, uplatex, dvipdfmx]{bxjsarticle}
\title{title}
\author{author}
\usepackage[deluxe]{otf}
@hiterm
hiterm / prime_pair.rb
Last active March 10, 2017 02:23
「プライム・ペア」問題
# phi関数の乗法性を用いる
# n!を素因数分解して、各素因数についてphi(p^e)を求めて掛け合わせる
# 階乗の素因数分解は良い求め方がある
# http://qiita.com/HirotoKagotani/items/87234e4104cb2b7fb8ff
#
# 累乗もmodで求めた方がいいかと思ったが、大丈夫だった
modulus = 1000003
# nまでの素数を配列に入れて返す
(* 累乗関数 *)
(* 数でも行列でも使える *)
let rec pow a n op un = (* opが演算子、unがunit *)
if n == 0 then un
else
let b = pow a (n/2) op un in
if n mod 2 == 0 then op b b
else op b (op b a);;
let m = pow 10 6 ( * ) 1;;
(* mod mでの計算の演算子 *)
@hiterm
hiterm / README.md
Last active February 11, 2019 12:09 — forked from shuyo/concatAozora.py
青空文庫のテキストファイルを結合するスクリプト

concatAozora

このスプリプトはshuyo/concatAozora.pyのforkです。

Kindle用に変換する方法

AozoraEpub3を使うと良い。 こんな感じに設定しておくと、目次も良い感じに生成される(細かいところは好みで)。

2019-02-11 21 03 12

# 全ての点を通るので、
# w, hに対して、距離は (w + 1)(h + 1) - 1 = wh + w + h になる
# 片方を固定して数え上げ
import math
n = int(input())
s = 0
i = 1
@hiterm
hiterm / config.py
Last active November 2, 2016 08:20
KeyhacのMacVim用設定ファイル
import sys
import os
import datetime
import subprocess
from keyhac import *
def configure(keymap):
︠ef71f22d-2e92-4007-b961-4e8fd2cc5023s︠
class MyRSCode:
def __init__(self, n, k, F, a, Fx, x):
self.n = n
self.k = k
self.field = F
self.field_generator = a
self.polynomial_ring = Fx
self.x = x
self.gen_poly = generate_gen_poly(self.n - k + 1, F, a, Fx, x)