Skip to content

Instantly share code, notes, and snippets.

View tototoshi's full-sized avatar

Toshiyuki Takahashi tototoshi

View GitHub Profile
for (n <- 0 to 2000000000) {
val ns = for (m <- 1 to 5) yield {
(n * m).toString.sorted
}
if (ns.distinct.length == 1) println(n)
}
@tototoshi
tototoshi / gist:816218
Created February 8, 2011 10:11
anythingのバッファの開きかたを調整する
(require 'anything)
;;; (install-elisp "http://nschum.de/src/emacs/split-root/split-root.el")
(require 'split-root)
(defun my-anything-display-function (buf)
(set-window-buffer (split-root-window 10) buf))
(setq anything-display-function 'my-anything-display-function)
@tototoshi
tototoshi / gist:836494
Created February 21, 2011 01:01
conkerorで英辞郎on the webを引くwebjump
define_webjump("alc",
"javascript:location.href='http://eow.alc.co.jp/%s/UTF-8/?ref=sa';");
@tototoshi
tototoshi / .stumpwmrc
Created March 3, 2011 06:51
.stumpwmrc
(in-package :stumpwm)
(defcommand conkeror () ()
(run-or-raise "~/bin/conkeror" '(:class "Conkeror")))
(define-key *root-map* (kbd "f") "conkeror")
(defcommand conkeror-new-buffer () ()
(run-shell-command "conkeror"))
(define-key *root-map* (kbd "F") "conkeror-new-buffer")
#!/bin/sh
curl http://www.ryutsuu.biz/index.html 2> /dev/null|\
grep \<li\>\<a\ href=\"http://www |\
grep \<span |\
sed -e 's/<[a-z0-9\.:\/= \"]*>//g'
@tototoshi
tototoshi / gist:984542
Created May 21, 2011 13:56
emms便利だねってことでanything使ってごにょごにょする。すでにanything-emmsてのあるっぽいけど。
(defvar anything-emms-directory-candidates-cache nil)
(defvar anything-emms-file-candidates-cache nil)
(defun anything-my-emms-clear-cache ()
(interactive)
(setq anything-emms-directory-candidates-cache nil
anything-emms-file-candidates-cache nil))
(defun anything-get-emms-directory-candidates ()
(cond ((null anything-emms-directory-candidates-cache)
@tototoshi
tototoshi / gist:985222
Created May 22, 2011 06:22
emmsで聞いてる曲をとってくる
(defun my-emms-current-track-path ()
"get current track file as fullpath"
(emms-track-description (emms-playlist-current-selected-track)))
(defun my-insert-current-track ()
(interactive)
(multiple-value-bind (artist album song)
(last (split-string (my-emms-current-track-path) "/") 3)
(insert (format "きいてる %s - %s from %s" song artist album))))
@tototoshi
tototoshi / rsed.py
Created July 6, 2011 08:28
カレントディレクトリ以下を再帰的にsedしまくる
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import subprocess
def do_sed(fullpath, old, new):
sed_script = "s/%s/%s/g" % (old, new)
command = ["sed", "-i", fullpath, "-e", sed_script]
@tototoshi
tototoshi / ggrks_switch_lang.js
Created July 12, 2011 01:16
Googleの検索言語切り替え(en<->ja)ブックマークレット
javascript:void((function () {
var url = location.href;
var ja = url.search(/hl=ja/);
var en = url.search(/hl=en/);
if (url.search(/google\.(co\.jp|com)\/search/) < 0) return;
if (ja > 0) {
location.href = url.replace(/hl=ja/, "hl=en");
} else if (en > 0) {
@tototoshi
tototoshi / my-py-search-documentation.el
Created August 11, 2011 16:57
pythonのドキュメント検索
(defvar my-py-docs-python-org-url "http://docs.python.org")
(defun my-py-search-documentation-interactive (word)
(interactive "sSEARCH: ")
(my-py-search-documentation word))
(defun my-py-search-documentation-at-point ()
(interactive)
(let ((word (current-word)))
(when word