View bf.py
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
import sys | |
class Engine(object): | |
"""Brainf**k interpreter. | |
usage: | |
bf = Engine() | |
bf("++++++++++++++.") | |
""" | |
def __init__(self): | |
pass |
View ubiquity-alc.js
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
/* | |
* for Ubiquity 0.5 | |
*/ | |
CmdUtils.CreateCommand({ | |
names: ["alc"], | |
icon: "http://www.alc.co.jp/favicon.ico", | |
homepage: "http://d.hatena.ne.jp/bellbind/", | |
author: {name: "bellbind", email: "bellbind@gmail.com"}, | |
license: "GPL", | |
description: [ |
View ubiquity-eval.js
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
/* eval for Ubiquity 0.5 */ | |
CmdUtils.CreateCommand({ | |
names: ["eval"], | |
icon: "chrome://ubiquity/skin/icons/favicon.ico", | |
homepage: "http://d.hatena.ne.jp/bellbind/", | |
author: {name: "bellbind", email: "bellbind@gmail.com"}, | |
license: "GPL", | |
description: "evaluate script", | |
help: "evaluate script", | |
arguments: [{role:"input", nountype: noun_arb_text}], |
View ubiquity-color.js
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
/* | |
* Ubiquity 0.5 example | |
* changes from 0.1.8: | |
* - name:String -> names:[String] | |
* - takes:{String:RegExp} -> arguments:[{role:String, nountype:RegExp}] | |
* - preview&execute:function(Element, arg) | |
* -> preview&execute:function(Element, {argname:arg,...}) | |
*/ | |
CmdUtils.CreateCommand({ |
View amazon_sign_api.php
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
<?php | |
// Create Signed Amazon REST API URL from old unsigned URL | |
// Amazon API requires signature from 2009-08-15. | |
// You can get sign key from management page of your AWS Access Key. | |
// See signature spec: | |
// https://affiliate.amazon.co.jp/gp/associates/help/t126/a13?ie=UTF8&pf_rd_t=501&ref_=amb_link_84046416_5&pf_rd_m=AN1VRQENFRJN5&pf_rd_p=&pf_rd_s=center-1&pf_rd_r=&pf_rd_i=assoc_help_t126_a9 | |
// | |
function amazon_sign_api($key, $url) { | |
$pattern = '/^([^:]+):\/\/([^\/]+)([^\?]+)\?(.*)$/'; | |
preg_match($pattern, $url, $result); |
View astar.py
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
def astar(init, goal, nexts, | |
distance=lambda path: len(path), | |
heuristic=lambda pos: 0): | |
import heapq | |
queue = [] | |
init_score = distance([init]) + heuristic(init) | |
checked = {init: init_score} | |
heapq.heappush(queue, (init_score, [init])) | |
while len(queue) > 0: | |
score, path = heapq.heappop(queue) |
View wiki.py
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: utf-8 -*- | |
""" | |
One File Wiki Script for Google AppEngine | |
""" | |
import cgi | |
import re | |
import urllib | |
# use_library() from GAE 1.2.3 | |
from google.appengine.dist import use_library | |
use_library("django", "1.0") |
View add_target_of_links.user.js
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
// ==UserScript== | |
// @name Add target of links which have different domains from the page | |
// @namespace add_link_target | |
// @description Add target of links which have different domains from the page | |
// @include https://* | |
// @include http://* | |
// ==/UserScript== | |
(function () { | |
var pattern = /^(?:https?|ftp):\/\/(.*?)\//; | |
var domainDoc = document.URL.match(pattern); |
View lighting.html
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script>//<![CDATA[ | |
// WebGL example | |
top.CanvasFloatArray = top.CanvasFloatArray || WebGLFloatArray; | |
var gl; | |
var program; |
View texture.html
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script>//<!-- | |
// WebGL texture example | |
top.CanvasFloatArray = top.CanvasFloatArray || WebGLFloatArray; | |
var gl; | |
var program; |