This file contains hidden or 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
#!/usr/bin/ruby -Ku | |
# -*- coding: utf-8 -*- | |
r = /\A(([あいうえおか-もやゆよら-ろわ-んアイウエオカ-モヤユヨラ-ロワ-ヴ]|う゛)[ぁぃぅぇぉゃゅょゎァィゥェォャュョヮ]?){2}[×☆]?(([あいうえおか-もやゆよら-ろわ-んアイウエオカ-モヤユヨラ-ロワ-ヴ]|う゛)[ぁぃぅぇぉゃゅょゎァィゥェォャュョヮ]?){2}っ?!?\z/ | |
while l = gets | |
l.chomp! | |
if r.match(l) | |
puts "#{l}は4文字タイトルなんじゃないかなあ" | |
else | |
puts "#{l}は4文字タイトルじゃないんじゃないかなあ" |
This file contains hidden or 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
if exists("loaded_autots") | |
finish | |
endif | |
function! AutoTS() | |
setlocal ts=8 | |
if search("^\t","nw") > 0 | |
setlocal noexpandtab | |
if search("^ ","nw") > 0 | |
setlocal sts=2 sw=2 |
This file contains hidden or 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
#compdef irb | |
typeset -A opt_args | |
local context state line | |
_arguments -s -S \ | |
"-f[suppress read ~/.irbrc]" \ | |
"-m[bc mode (fraction or matrix are available)]" \ | |
"-d[set \$DEBUG to true (same as \`ruby -d']" \ | |
"-r+[same as \`ruby -r']:load-module:_files -/" \ |
This file contains hidden or 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
#!/usr/bin/env python | |
# mp810.py | |
# Fixes your image imported by Canon MP810, Linux, SANE | |
# using GIMP's Python-fu. | |
# Throw it to ~/.gimp-2.6/plug-ins directory, make it executable, | |
# import image, and select "Filters"->"Generic"->"MP810 Scanner fix" menu. | |
import math | |
from gimpfu import * |
This file contains hidden or 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
//This source code is for C99 | |
//Pseudo default-argument feature for C99 | |
#include <stdio.h> | |
#define func(...) func_impl(__VA_ARGS__, -1) | |
void func_impl(int arg1, int arg2, int arg3, ...); | |
int main(int argc, char *argv[]); | |
void func_impl(int arg1, int arg2, int arg3, ...) |
This file contains hidden or 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
#!/usr/bin/ruby1.9 | |
# -*- coding: utf-8 -*- | |
# RtNumber: handles sum of rational numbers' sqrt | |
require "rational" | |
class RtNumber < Numeric | |
def self.numrt(target) | |
@@rttable ||= {} | |
return @@rttable[target] if @@rttable[target] | |
ret = 1 |
This file contains hidden or 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
メニューバー | |
ブックマークバーはメニューバーの横に移動 | |
はてなブックマークツールバーとブックマークツールバーは隠す | |
小さいアイコン | |
DownThemAll! | |
「操作→コンテキストメニュー」はぜんぶオフ | |
Download Statusbar | |
「ミニモード」 | |
Hatena Bookmark | |
検索機能は無効にする |
This file contains hidden or 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 java.awt.*; | |
import java.awt.event.*; | |
import java.awt.geom.*; | |
import java.util.*; | |
import javax.swing.*; | |
public class CoinTower extends JFrame { | |
private ArrayList<Coin> tower; | |
public CoinTower() { | |
super("Rolling Coin Tower Demo"); |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
/* | |
* 部分和のうち一つを挙げる | |
* numsはn個の正整数 | |
* sumは求めたい和 | |
* 部分和が存在する場合、使わないnumsの要素を0にし、使う要素の数を返す | |
* 部分和が存在しない場合、0を返す | |
*/ |
This file contains hidden or 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 subssum(nums, sum) | |
dp = Array.new(nums.size+1){Array.new(sum+1)} | |
dp[0][0] = [] | |
nums.size.times do|i| | |
dp[i].each_index do|j| | |
if dp[i][j] | |
dp[i+1][j] = dp[i][j] | |
if j+nums[i] <= sum | |
dp[i+1][j+nums[i]] = dp[i][j]+[nums[i]] | |
end |