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
#!/usr/local/bin/ruby | |
# I'm novice. | |
$ARGS = ARGV.size | |
def option_arg(argv) | |
optq = [] | |
optnumq = argv.size - 2 | |
i = 0 |
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
#include<iostream> | |
#include<cstdio> | |
#include<cstdlib> | |
#include<string> | |
#include<db_cxx.h> | |
using namespace std; | |
//BerkeleyDBの練習... | |
//db51のlibdb_cxx.aなどとリンクする必要があります。 |
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
#!/usr/bin/env ruby | |
#-*- encoding:utf-8 -*- | |
# コマンドライン引数は 第一引数 >= 第二引数 でなければならない。 | |
if ARGV.size != 2 then | |
STDERR::puts "Arguments error." | |
exit 1 | |
end |
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
#!/usr/bin/ruby -Ku | |
class Pdir | |
def initialize(dirnameArray,optionArray) | |
@AllPrintDirPATH = dirnameArray | |
@Alloptions = optionArray | |
@diro = Array.new | |
dirnameArray.each do |x| | |
if File.exists?(x) == true && File.directory?(x) == true then | |
@diro << Dir.open(x) |
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
#!/usr/bin/env ruby | |
#-*- encoding:utf-8 -*- | |
def eukeides(m,n) | |
loop do | |
r = m % n | |
if r == 0 then | |
return n | |
end | |
m = n |
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
#!/usr/local/bin/ruby --1.9 | |
#-*- encoding: utf-8 -*- | |
require 'java' | |
import 'javax.swing.JFrame' | |
import 'javax.swing.JButton' | |
import 'javax.swing.JTextField' | |
import 'javax.swing.JTextArea' | |
import 'javax.swing.JPanel' | |
import 'java.awt.BorderLayout' |
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
#!/usr/bin/env ruby | |
#-*- encoding:utf-8 -*- | |
=begin | |
Question. | |
The prime factors of 13195 are 5, 7, 13 and 29. | |
What is the largest prime factor of the number 600851475143 ? | |
超へっぽこコード クラスにした意味がわからない。 |
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
#!/usr/bin/env ruby | |
#-*- encoding:utf-8 -*- | |
# * へっぽこコード | |
def isPnum?(a) #素数か判定する | |
sa = (Math::sqrt(a)).truncate | |
return true if a == 2 or a == 3 | |
return false if a < 2 | |
2.upto(sa) do |x| | |
if a % x == 0 then |
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
#!/usr/bin/env ruby | |
#-*- encoding:utf-8 -*- | |
=begin | |
カレントディレクトリにある .から始まるdotfile(ディレクトリも可)をHOME以下にシンボリックリンクします。 | |
Dropboxにdotfile用のdirectoryを作りその中にこのスクリプトを入れておけば、OS(のユーザー)のセットアップ時に実行すればリンクを作ってくれます。 | |
Ruby1.9用 (JRuby --1.9 でも動作可能) | |
=end | |
puts "このスクリプトはDropbox/DotFilesの中で実行してください。" |
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
/**************************************************************************** | |
** | |
http://d.hatena.ne.jp/opamp_sando/20110921/1316594257 | |
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). | |
** All rights reserved. | |
** Contact: Nokia Corporation (qt-info@nokia.com) | |
** | |
** This file is part of the examples of the Qt Toolkit. |
OlderNewer