Skip to content

Instantly share code, notes, and snippets.

View hayamiz's full-sized avatar

Yuto Hayamizu hayamiz

View GitHub Profile
// Ubiquity plugin
// Tokyo amesh.
CmdUtils.CreateCommand({
name: "amesh",
author: { name: "Y. Hayamizu", email: "[email protected]"},
description: "Check weather around Tokyo.",
help: "Just type \"amesh\", and then you get weather information.",
_zeropad: function(num, width){
if (width - num.toString().length > 0){
// Ubiquity plugin
// ALC(eijiro)
var eijiro_waitqueue = [];
var word_var = {
_name: "search word",
suggest: function( text, html ) {
var suggestions = [CmdUtils.makeSugg(text)];
if(window.foxytunesGetCurrentTrackTitle){
// Ubiquity plugin
// delicious
CmdUtils.CreateCommand({
name: "delicious",
icon: "http://delicious.com/favicon.ico",
author: {name: "Y. Hayamizu", email: "[email protected]"},
description: "An Ubiquity plugin for bookmarking on delicious",
takes: {notes: noun_arb_text},
execute: function(directObject){
// Ubiquity plugin
// Latest earth quake information by tenki.jp
CmdUtils.CreateCommand({
name: "quake",
author: {name: "Y. Hayamizu", email: "[email protected]"},
description: "Check latest earthquake information in Japan.",
preview: function(pblock){
jQuery.ajax({
url: "http://tenki.jp/earthquake/",
;;;
;;; Shell - '*shell*' will be renamed '*shell ($PWD)*'
;;;
(defun my-rename-buffer-with-pwd ()
(let ((cur-buffername (buffer-name))
(new-buffername (concat "*shell (" (pwd) ")*")))
(unless (equal cur-buffername new-buffername)
(rename-buffer new-buffername t))))
(defadvice comint-send-input (after rename-if-cd)
@hayamiz
hayamiz / gist:26919
Created November 20, 2008 03:17
undefined
CmdUtils.CreateCommand({
name: "otwitter",
synonyms: ["tweet"],
icon: "http://assets3.twitter.com/images/favicon.ico",
takes: {status: noun_arb_text},
modifiers: { "as" : noun_type_twitter_user },
description: "Update your twitter status and Outputz records.",
help: "You'll need a <a href=\"http://twitter.com\">Twitter account</a>. If you're not already logged in you'll be asked to log in.",
preview: function(previewBlock, directObj, mods) {
// these are converted in the Twitter database anyway, and counted as 4 characters
// ==UserScript==
// @name OutputzGraphNicer
// @namespace hayamiz
// @include http://outputz.com/*
// ==/UserScript==
(function(){
var ret = document.evaluate("//img[contains(@src,'cht=p3')]", document, null, 7, null);
for(i=0;i < ret.snapshotLength;i++){
var graph = ret.snapshotItem(i);
(defvar r5rs-keywords
'("abs" "acos" "and" "angle"
"append" "apply" "asin" "assoc"
"assq" "assv" "atan" "begin"
"boolean?" "caar" "cadr" "call-with-current-continuation"
"call-with-input-file" "call-with-output-file" "call-with-values" "car"
"case" "cdddar" "cddddr" "cdr"
"ceiling" "char->integer" "char-alphabetic?" "char-ci<=?"
"char-ci<?" "char-ci=?" "char-ci>=?" "char-ci>?"
"char-downcase" "char-lower-case?" "char-numeric?" "char-ready?"
require 'thread'
$queue = Queue.new
workers = Array.new(100).map do
Thread.new do
block = $queue.pop
block.call()
end
end
The art of multiprocessor programming: TM元祖のHerlihyとSTM元祖のShavitが書いた並列プログラミング本。後ろのほうでTMが扱われているけど読んでない。
http://www.cs.rochester.edu/u/scott/papers/2004_TR839.pdf : 2004年時点でのSTMについてよくまとまっている印象。
http://queue.acm.org/detail.cfm?id=1454466: ACMの雑誌の記事。冒頭のTMまとめがわかりやすかったような印象。
http://www.logos.ic.i.u-tokyo.ac.jp/~haya/files/papers/bachelor_final_thesis.pdf の参考文献
[1] transactional memoryの原論文。キャッシュラインに手を加えるハードウェアによる実装。アイディアはとてもシンプルでわかりやすい。背景知識として、Herlihyのやってきたlock-free系の話がわかるとよいかもしれない。