This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Generates pattern animation table from | |
; * image width/height | |
; * cell row/column/width/height. | |
(let (cw ch iw ih cc cr y) | |
(setq cw 240) (setq ch 296) (setq iw 1440) (setq ih 1480) (setq cc 6) (setq cr 5) | |
(setq y 0) | |
(while (< y cr) | |
(let (x) | |
(setq x 0) | |
(while (< x cc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; [2012-07-21] grep / grep-find のデフォルト引数。文字コードが混在していても使えるよう lv を利用している。 | |
(setenv "LC_CTYPE" "ja_JP.UTF-8") | |
(setq grep-use-null-device nil) | |
(setq grep-command "lv -g -Au8 -Kej -Ou8 -Ia -n ") | |
(setq grep-find-command '("find . ! -name '*~' -type f -print0 | xargs -0 lv -g -Au8 -Kej -Ou8 -Ia -n ")) | |
(defadvice grep (around grep-coding-setup activate) | |
(let ((coding-system-for-read 'utf-8)) | |
ad-do-it)) | |
; [OS X 対策] grep.el にある '(setenv "TERM" "emacs-grep")' という記述のせいで grep の検索結果バッファに | |
; tput: unknown terminal "emacs-grep" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; -*- coding:euc-jp-unix; -*- | |
;;; close-open-paren.el : insert appropriate closing parenthesis. | |
;;; Ref.: http://www.emacswiki.org/emacs/UniversialCloseParen | |
;;; http://emacswiki.org/emacs/EmacsSyntaxTable | |
;;; skk/skk-tankan.el | |
(defconst close-open-paren-syntax-table | |
(let ((table (make-syntax-table))) | |
(modify-syntax-entry ?{ "(}" table) | |
(modify-syntax-entry ?} "){" table) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2011 Google Inc. All Rights Reserved. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# makefile_libzopfli : builds libzopfli.a from library codes. | |
# Usage : | |
# $ make -> libzopfli.a | |
# $ make command -> ./zopfli (test command) | |
SRCS = \ | |
blocksplitter.c \ | |
cache.c \ | |
deflate.c \ | |
gzip_container.c \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef unsigned int uint32; | |
#define FNV1_32A_INIT 0x811c9dc5 | |
#define FNV_32_PRIME 0x01000193 | |
uint32 fnv32a( const char* str ) | |
{ | |
uint32 hval = FNV1_32A_INIT; | |
while ( *str ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Hashcode | |
FNV1_32A_INIT = 0x811c9dc5 | |
FNV_32_PRIME = 0x01000193 | |
UINT32_MAX = 2 ** 32 | |
module_function | |
def fnv32a( str ) | |
hval = FNV1_32A_INIT | |
str.bytes.each do |s| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun fnv32a (s) | |
"Calculates FNV-1a 32-bit hash of given string s." | |
(let (hval) | |
(setq hval 2166136261) ; hval = FNV1_32A_INIT | |
(loop for c across s do | |
(setq hval (logxor hval c)) ; hval ^= c | |
(setq hval (* 16777619 hval)) ; hval *= FNV_32_PRIME | |
(setq hval (mod hval 4294967296))) ; hval %= UINT32_MAX | |
hval)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 32 bit FNV-1a hash | |
// Ref.: http://isthe.com/chongo/tech/comp/fnv/ | |
function fnv32a( str ) | |
{ | |
var FNV1_32A_INIT = 0x811c9dc5; | |
var hval = FNV1_32A_INIT; | |
for ( var i = 0; i < str.length; ++i ) | |
{ | |
hval ^= str.charCodeAt(i); | |
hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; // TextReader,TextWriter,StreamReader,StreamWriter | |
using System.Text; // Encoding | |
using System.Text.RegularExpressions; // Regex, Match | |
/* | |
$ /Library/Frameworks/Mono.framework/Commands/mcs fnv32a.cs | |
$ /Library/Frameworks/Mono.framework/Commands/mono ./fnv32a.exe > tmp_cs.txt | |
*/ | |
public class Hashcode | |
{ |