Skip to content

Instantly share code, notes, and snippets.

View k16shikano's full-sized avatar
💭
I may be slow to respond.

keiichiro shikano k16shikano

💭
I may be slow to respond.
View GitHub Profile
@k16shikano
k16shikano / fireworks.sty
Last active December 10, 2015 01:58
draw fireworks on pages using http://hanno-rein.de/archives/349 method.
%%% draw fireworks on pages using http://hanno-rein.de/archives/349 method.
\usepackage{eso-pic}
\usepackage{pstricks}
\newcommand\fireworksPS[1]{
\psset{xunit=#1,yunit=#1,runit=#1}
\begin{pspicture}(744.09448242,1052.36218262)
{
\newrgbcolor{curcolor}{1.0 0.25 0.75}
{-# LANGUAGE Arrows, FlexibleContexts #-}
module Main where
import Text.XML.HXT.Core
import Text.XML.HXT.Arrow.XmlArrow
import Control.Arrow
import qualified Text.XML.HXT.DOM.XmlNode as XN
import Data.List
@k16shikano
k16shikano / nidan.tex
Last active December 30, 2015 20:29
replace tokens
%%% replace all tokens;
%%% space -> +, leftbrace -> (, rightbrace -> ), others -> *,
%%% provided that the argument doesn' have ! and \end.
\def\length#1{\spaces{#1!}\notspaces{#1!}}
\def\notspaces#1{\beforegroup#1\iffalse{}\fi}
\def\beforegroup#1#{\recur#1!\futurelength}
\def\recur#1{%
\ifx!#1\else*\expandafter\recur\fi}
@k16shikano
k16shikano / gist:7924591
Last active December 31, 2015 02:59
listinline で前後に xkanjiskip があくようになるかもしれない内部マクロの再定義
\def\lst@Init#1{%
\begingroup
\ifx\lst@float\relax\else
\edef\@tempa{\noexpand\lst@beginfloat{lstlisting}[\lst@float]}%
\expandafter\@tempa
\fi
\ifx\lst@multicols\@empty\else
\edef\lst@next{\noexpand\multicols{\lst@multicols}}
\expandafter\lst@next
\fi
{-# LANGUAGE OverloadedStrings #-}
module CssA where
import Data.Text hiding (concat, map)
import Text.XML.HXT.Core hiding (trace)
cssA :: (ArrowList a) => (Text, Text) -> a String String
cssA ("font-family", "serif") = arr $ ("\\textsf{"++) . (++"}")
cssA ("font-size", v) = arr $
@k16shikano
k16shikano / gist:faa43d2b3963b1202fa9
Last active August 29, 2015 14:16
HXTでbodyタグだけテキストを書き換え
{-# LANGUAGE Arrows, FlexibleContexts #-}
import Text.XML.HXT.Core
import Text.XML.HXT.Arrow.XmlArrow
main :: IO [String]
main = do
runX (readString [ ] "<html><head>foo</head><body><p>bar</p></body></html>"
>>>
processBottomUp
(processBottomUp
@k16shikano
k16shikano / torikae.tex
Last active August 29, 2015 14:21
TeXマクロでオプション引数っぽいやつ
\newtoks\mytok
\def\torikae#1{\global\mytok\expandafter{#1}\futurelet\cs\dotorikae}
\def\dotorikae{\ifx\cs{\iffalse}\fi
\let\next\getoptional
\else
\let\next\relax
\the\mytok
\fi
\next}
\def\getoptional#1{%
@k16shikano
k16shikano / zundoko.tex
Created March 15, 2016 04:02
zundoko.tex
\documentclass[dvipdfmx]{jsarticle}
\usepackage{xcolor}
\usepackage[noalphabet]{pxchfon}
\setminchofont{Oradano.ttf}
\usepackage[first=1, last=3]{lcg}
\makeatletter
\newcount\LastFive
%!
<< /PageSize [520 520] >> setpagedevice
/setrandcolor {
/m exch .1 add def
/r1 {rand 5 mod 1 div m add} def
/r2 {rand 3 mod 3 div m add} def
/r3 {rand 3 mod 3 div m add} def
r1 r2 r3 setrgbcolor
} def
@k16shikano
k16shikano / result.png
Last active November 18, 2018 13:42
TeXでさくらんぼ計算
result.png