Skip to content

Instantly share code, notes, and snippets.

@karronoli
karronoli / cpanfile
Last active April 20, 2017 06:28
Import MySQL record to Elasticsearch index with japanese mappinng example.
requires 'DBI', '1.636';
requires 'DBD::mysql', '4.042';
requires 'Search::Elasticsearch', '2.03';
@karronoli
karronoli / PKGBUILD
Created April 3, 2017 06:22
Latest dictionaries for the SKK Japanese input method
pkgname=skk-jisyo-latest
pkgver=20170401
pkgrel=1
pkgdesc="Latest dictionaries for the SKK Japanese input method"
arch=('any')
url="http://openlab.ring.gr.jp/skk/"
optdepends=('skktools: Dictionary maintenance tools')
license=('GPL')
source=(http://openlab.ring.gr.jp/skk/skk/dic/SKK-JISYO.L
@karronoli
karronoli / adjust-example.ps1
Last active May 9, 2017 02:33
Example by using TinySato
# Adjust example
$dpi = 203;
$inch2mm = 25.4;
$dot2mm = $inch2mm / $dpi;
$mm2dot = 1 / $dot2mm;
[int]$height = [math]::Round(50.0 * $mm2dot);
[int]$width = [math]::Round(88.0 * $mm2dot);
[int]$sub_width = [math]::Round(85.0 * $mm2dot);
@karronoli
karronoli / dummy.sh
Last active July 7, 2016 10:56
rtmpdump + mpv on MSYS2
# Play streaming by named pipe instead of pipe that can't be used.
_live_nhk () {
cd
if [ ! -p test.live ]; then rm -f test.live && mkfifo test.live; fi
/mingw64/bin/rtmpdump \
--rtmp "$1" \
--playpath "$2" \
--swfVfy http://www3.nhk.or.jp/netradio/files/swf/rtmpe.swf \
--app "live" \
--live -o test.live&
@karronoli
karronoli / dummy.el
Last active June 15, 2016 13:43
textlint I/F by redpen-paragraph
(setq compilation-error-screen-columns nil)
(setq redpen-commands
'("textlint -f json --rule no-mix-dearu-desumasu --rule max-ten --rule spellcheck-tech-word %s"
"textlint -f json --rule no-mix-dearu-desumasu --rule max-ten --rule spellcheck-tech-word %s"))
(defun redpen-paragraph-list-errors (json)
(cl-assert (vectorp json))
;; Split window as well as usual compilation-mode.
(switch-to-buffer-other-window (current-buffer))
(set-buffer redpen-paragraph-compilation-buffer-name)
_npmname=textlint-rule-max-ten
pkgname=nodejs-$_npmname
pkgver=2.0.1
pkgrel=1
pkgdesc="The pluggable natural language linter for text and markdown."
arch=(any)
url="https://textlint.github.io/"
license=('MIT')
depends=('nodejs' 'npm' 'nodejs-textlint')
source=(http://registry.npmjs.org/$_npmname/-/$_npmname-$pkgver.tgz)
(require 'comint)
(require 'url-util)
(require 'moz)
(defun translate-google (&optional flag)
(interactive "P")
(let ((lang (if (null flag) "en/ja" "ja/en"))
(text
(let ((end (if (use-region-p) (region-end)
(forward-word) (point)))
(start (if (use-region-p) (region-beginning)
@karronoli
karronoli / PKGBUILD
Created April 30, 2016 13:13
PKGBUILD sample for redpen-paragraph.el (But M-x package-install redpen-paragraph on Emacs!)
pkgname=emacs-redpen-paragraph
pkgver=0.3
pkgrel=1
pkgdesc="RedPen interface for proofreading paragraph."
arch=('any')
url="https://github.com/karronoli/redpen-paragraph.el"
license=('Apache')
depends=('emacs' 'redpen')
source=(https://github.com/karronoli/redpen-paragraph.el/archive/v${pkgver}.tar.gz)
@karronoli
karronoli / Dockerfile
Last active April 24, 2016 13:13
Install GMT(Generic Mapping Tool) v5.2.1 on Docker
FROM ubuntu:15.10
RUN apt-get update
RUN apt-get install -y ghostscript build-essential cmake libnetcdf-dev libgdal1-dev libfftw3-dev libpcre3-dev
RUN apt-get install -y gdal-bin wget
RUN wget ftp://ftp.soest.hawaii.edu/gmt/gmt-5.2.1-src.tar.xz && \
tar xf gmt-5.2.1-src.tar.xz
RUN rm -fr ./gmt-5.2.1/build && mkdir ./gmt-5.2.1/build
RUN cd ./gmt-5.2.1/build && \
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DGSHHG_ROOT=/usr/share/gmt/coast \
@karronoli
karronoli / allow-hostaddr-httpd.go
Last active March 30, 2016 09:45
Go web server can be restricted access by ALLOW_HOST. (go build allow-hostaddr-httpd.go && env ALLOW_HOST=example.com ./allow-hostaddr-httpd )
package main
import (
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
"path/filepath"
)