Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=320,user-scalable=no">
<style>
body {
margin: 0;
padding: 0;
height: 3000px;
@abicky
abicky / KNB.R
Created June 2, 2013 11:20
KNB corpus parser for R
# Parser for KNB corpus (http://nlp.ist.i.kyoto-u.ac.jp/kuntt/#ga739fe2)
#
# Copyright 2012- Takeshi Arabiki
# License: MIT License (http://opensource.org/licenses/MIT)
#
# Example:
#
# # KNB コーパスを data ディレクトリ下にダウンロードして解凍
# # 返り値は解凍後のファイル名
# dir <- KNB$downloadCorpus("data")
import "js/web.jsx";
class History {
function a() : void {
History.b();
}
static function b() : void {
}
}
@abicky
abicky / id3conv.py
Created January 22, 2013 22:02
convert ID3 tags of MP3 files from Latin-1 to UTF-16
#!/usr/bin/env python
# -* - coding: utf-8 -*-
import argparse
import inspect
import eyed3
import eyed3.id3
def convertID3Encoding(audiofile, backup = False):
tag = audiofile.tag
if not tag:
@abicky
abicky / msgpack.R
Last active December 10, 2015 12:19
MessagePack for R (support only unpack)
#---------------------------------------------------------------------
# MessagePack for R (support only unpack)
#
# Copyright 2013- Takeshi Arabiki
# License: MIT License (http://opensource.org/licenses/MIT)
#
# > source("msgpack.R")
# > msgpack$unpack("\x93\x01\x02\x03")
# [1] 1 2 3
# > msgpack$unpack(c(charToRaw("\xCD\x01"), as.raw(0x00)))
(setq x-select-enable-clipboard t)
(defun copy-from-clipboard (text &optional rest)
(let ((process-connection-type nil) proc)
(if (eq system-type 'darwin)
(setq proc (start-process "pbcopy" "*Messages*" "pbcopy"))
(setq proc (start-process "xsel" "*Messages*" "xsel" "-b" "-i")))
(process-send-string proc text)
(process-send-eof proc)))
(defun paste-from-clipboard ()
@abicky
abicky / canvas_get_transform.js
Created July 23, 2012 18:50
Simple implementation of CanvasRenderingContext2D#getTransform (getTransform for HTML5 Canvas API)
/**
* Copyright 2012- Takeshi Arabiki
* License: MIT License (http://opensource.org/licenses/MIT)
*/
(function() {
CanvasRenderingContext2D.prototype._transform = [1, 0, 0, 1, 0, 0];
CanvasRenderingContext2D.prototype._transforms = [];
CanvasRenderingContext2D.prototype.getTransform = function() {
@abicky
abicky / gist:3052980
Created July 5, 2012 11:00
Create HTMLImageElement from HTMLCanvasElement and HTMLCanvasElement from HTMLImageElement
import "js/web.jsx";
class Util {
static function image2Canvas(image : HTMLImageElement) : HTMLCanvasElement {
var document = dom.window.document;
var canvas = document.createElement("canvas") as HTMLCanvasElement;
canvas.width = image.width;
canvas.height = image.height;
var ctx = canvas.getContext("2d") as CanvasRenderingContext2D;
ctx.drawImage(image, 0, 0);
@abicky
abicky / auto-complete.el.patch
Created June 19, 2012 18:03
patch for auto-complete.el (fix a bug that ac-auto-start is ignored)
diff --git auto-complete.el auto-complete.el
index 286c2d4..7a7b418 100644
--- auto-complete.el
+++ auto-complete.el
@@ -841,7 +841,8 @@ You can not use it in source definition like (prefix . `NAME')."
(eval prefix))))
(if (and point
(integerp req)
- (< (- current point) req))
+ (< (- current point)
@abicky
abicky / init.el
Created April 15, 2012 13:59
init.el for R (ESS)
;;; ~/.emacs.d/init.el
;;;---------------------------------
;;; 基本設定
;;;---------------------------------
;; 自分でダウンロードした *.el, *.elc のディレクトリ
(setq my-site-lisp (expand-file-name "~/.emacs.d/site-lisp"))
;; my-site-lisp を load-path に追加
(add-to-list 'load-path my-site-lisp)
;; 起動メッセージを表示しない
(setq inhibit-startup-message t)