code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
require "test/unit"
require "cloudsponge"
class TestCsException < Test::Unit::TestCase
def test_version_exists
end
end
| Ruby |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
def fib(n)
curr = 0
succ = 1
presucc = nil
for i in 1..n do
presucc = succ
succ = curr + succ
curr = presucc
end
curr
end
start_time = Time.now
res = fib(1000000)
end_time = Time.now
resstr = "#{res}"
len = resstr.length
cnt = 30
pos2 = len - cnt
digits1 = resstr[0,cnt]
digits2 = resstr[pos... | Ruby |
def fact (n)
tot = 1
for i in 1..n do
tot = tot * i
end
tot
end
start_time = Time.now
res = fact(100000)
end_time = Time.now
resstr = "#{res}"
len = resstr.length
cnt = 30
pos2 = len - cnt
digits1 = resstr[0,cnt]
digits2 = resstr[pos2,len]
puts("#{digits1}...<#{len - (2 * cnt)} digits>...#{digits2}")
p... | Ruby |
require 'Json.rb'
require 'CloudWar_Parameter.rb'
require 'Queries.rb'
##########
$param = Parameter.new("USER1", 1, false)
$param.set_portfw
##########
jobtype = "2chTripSearchEx"
#problem = "NAIST+AAAAAAAA+ZZZZZZZZ"
problem = "ABC+AAAAAAAA+ZZZZZZZZ"
redundancy = 1
username = "USER1"
optionst... | Ruby |
require 'rubygems'
require 'wx'
class Obj_ctl_timer
def initialize(parent, timer = 300, interval=100)
@parent = parent
@interval = interval
@time_timer = timer
# Text Timer
label3 = Wx::StaticText.new(parent, -1, 'Timer:', [50, 163], [38, 20])
@text_timer = Wx::TextCtrl.new(parent, -1, '', [90... | Ruby |
STDOUT.sync = true
require 'Json.rb'
host = "localhost"
port = 10080
#path = "/cgi-bin/Game/GameStart.cgi"
path = "/cgi-bin/Game/GameEnd.cgi"
#host = "www.yahoo.co.jp"
#path_gameend = "/"
#port = 80
#path = "/cgi-bin/Game/nodeStatus.cgi"
result = Netfunc::HTTP_GET(host, path, port)
p result.body ... | Ruby |
require 'simple-json.rb'
require 'Netfunc.rb'
class Json
def Json::parse_json(json_data)
parser = JsonParser.new
ruby_obj = parser.parse(json_data)
return (ruby_obj)
end
def Json::build_json(ruby_obj)
builder = JsonBuilder.new
json_data = builder.build(ruby_obj)
return (json_data)
en... | Ruby |
STDOUT.sync = true
require 'Json.rb'
filename = "tmp_json_status.txt"
url = "localhost"
path_status = "/cgi-bin/Game/status.cgi"
port = 10080
#url = "www.yahoo.co.jp"
#path = "/"
#port = 80
data = Json::get_json(url, path_status, port)
p data
f = open("output_cgi-status.txt", "w")
f.puts(data)
| Ruby |
STDOUT.sync = true
require 'Json.rb'
if (ARGV[0] == nil) then
filename = "tmp_json_status.txt"
url = "202.249.24.19"
path_status = "/cgi-bin/limura/Game/status.cgi"
port = 80
filename2 = "tmp_json_nodestatus.txt"
url2 = "202.249.24.19"
path2 = "/cgi-bin/limura/Game/nodeStatus.cgi"
port2 = 80
el... | Ruby |
STDOUT.sync = true
require 'Json.rb'
filename = "tmp_json_status.txt"
url = "localhost"
path_status = "/cgi-bin/Game/status.cgi"
port = 10080
filename = "output_cgi-status.txt"
#data = Json::get_json(url, path_status, port)
data = Json::get_json_from_file("output_cgi-status.txt")
#Json::write_jsonfile(fi... | Ruby |
require 'Json.rb'
require 'CloudWar_Parameter.rb'
require 'CW_query.rb'
##########
$param = Parameter.new("USER1", 1, false)
$param.set_portfw
##########
jobtype = "2chTripSearchEx"
problem = "NAIST+AAAAAAAA+ZZZZZZZZ"
redundancy = 1
username = "USER1"
optionstring = "TESTTESTQUERY"
point = 103... | Ruby |
require 'net/http'
require "socket"
class Netfunc
def Netfunc::HTTP_GET(host, path, port=80)
# printf("Netfunc::HTTP_GET: http://%s:%s%s\n", host, port, path)
response = ""
Net::HTTP.version_1_2
Net::HTTP.start(host, port) {|http|
response = http.get(path)
}
return (response)
end
def ... | Ruby |
require 'rubygems'
require 'wx'
class Obj_ctl_points
def initialize(parent)
@parent = parent
# Label
label1 = Wx::StaticText.new(parent, -1, 'Player1 - Point:', [15, 30], [70, 35], Wx::ALIGN_RIGHT)
label2 = Wx::StaticText.new(parent, -1, 'Player2 - Point:', [15,100], [70, 35], Wx::ALIGN_RIGHT)
... | Ruby |
require 'Json.rb'
# f = open("tmp_output_nodeStatus.txt", "w")
# f.puts(response.body)
#f = open("tmp_output_nodeStatus.txt")
#data = f.gets
host = "localhost"
path = "/cgi-bin/Game/nodeStatus.cgi"
port = "10080"
#data = Json::get_json(host, path, port)
#f = open("tmp_output_nodeStatus2.txt", "w")
#f.... | Ruby |
STDOUT.sync = true
require 'Json.rb'
filename = "tmp_json_status.txt"
url = "localhost"
path_status = "/cgi-bin/Game/nodeStatus.cgi"
port = 10080
#url = "www.yahoo.co.jp"
#path = "/"
#port = 80
data = Json::get_json(url, path_status, port)
p data
f = open("output_cgi-nodestatus.txt", "w")
f.puts(d... | Ruby |
require 'simple-json.rb'
require 'net/http'
class Json
def Json::get_json(url, path, port=80)
htmlresponse = ""
Net::HTTP.version_1_2
Net::HTTP.start(url, port) {|http|
htmlresponse = http.get(path)
}
parser = JsonParser.new
ruby_obj = parser.parse(htmlresponse.body)
return (r... | Ruby |
class Manager_actions
def initialize(maxsize = 5)
@maxsize = maxsize
@rate_attack = 10
@rate_calc = 20
@actionlist = Array.new
create_actions(maxsize)
end
def create_actions(number)
number.times {|n|
action = create(@rate_attack, @rate_calc)
@actionlist.push(action)
}
retur... | Ruby |
STDOUT.sync = true
require 'Json.rb'
if (ARGV[0] == nil) then
url = "202.249.24.19"
path = "/cgi-bin/limura/Game/status.cgi"
port = 80
filename = "tmp_json_status.txt"
else
puts "Option"
filename = ARGV[0]
url = ARGV[1]
path = ARGV[2]
port = ARGV[3]
filename2 = ARGV[4]
url2 = ARGV[5]
path... | Ruby |
require 'net/http'
require "socket"
class Netfunc
def Netfunc::HTTP_GET(host, path, port)
htmlresponse = ""
Net::HTTP.version_1_2
Net::HTTP.start(host, port) {|http|
htmlresponse = http.get(path)
}
return (htmlresponse.body)
end
def Netfunc::TCP_send(host, port, data)
sock = TCPSocke... | Ruby |
#
# To change this template, choose Tools | Templates
# and open the template in the editor.
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/testtask'
spec = Gem::Specification.new do |s|
s.name = 'ClusterPowerManager'
s.version = '0.0.... | Ruby |
#!/usr/bin/ruby
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#!/usr/bin/ruby
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
require 'commands'
require 'cpmonitor'
require 'set'
require 'monitor'
require 'cputil'
require 'algo'
class MIN_WIDTH < PMA
def MIN_WIDTH.get_desc
"Nodes will be powered on if there are tasks in the queue. " +
"More tasks in the queue - more active nodes."
end
#
# Performs power management decisio... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
#############################################################################
# Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
#
# This file is part of clupower (cluster power manager utility)
#
# Clupower is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | Ruby |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
#!/usr/local/bin/ruby
# $Id: ydict.rb 2 2008-04-09 09:52:02Z clsung $
# Ruby version of Y! dictionary, derived from leeym's perl script
# Author: Cheng-Lung Sung <clsung@FreeBSD.org>
# Version: 0.9
# Date: 2007/01/12
require 'term/ansicolor'
require 'net/http'
require 'iconv'
def ydict (shift)
raise ArgumentError,... | Ruby |
#!/usr/local/bin/ruby
# $Id$
# Ruby version of Y! dictionary, derived from leeym's perl script
# Author: Cheng-Lung Sung <clsung@FreeBSD.org>
# Version: 0.9
# Date: 2007/01/12
require 'term/ansicolor'
require 'net/http'
require 'iconv'
def ydict (shift)
raise ArgumentError, 'Must specify word' if shift == nil
... | Ruby |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along ... | Ruby |
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along ... | Ruby |
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along ... | Ruby |
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along ... | Ruby |
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along ... | Ruby |
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along ... | Ruby |
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along ... | Ruby |
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along ... | Ruby |
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along ... | Ruby |
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along ... | Ruby |
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along ... | Ruby |
#!/usr/bin/env ruby
# Ssimple script to generate simple cmake modules for finding
# libraries (packages)
#
# usage: generate_findpackage_file
# then you will be prompted to enter the required parameters
#
#####################################################################
#
# Copyright (c) 2006 Alexander Neundorf <n... | Ruby |
#!/usr/bin/env ruby
# Ssimple script to generate simple cmake modules for finding
# libraries (packages)
#
# usage: generate_findpackage_file
# then you will be prompted to enter the required parameters
#
#####################################################################
#
# Copyright (c) 2006 Alexander Neundorf <n... | Ruby |
module klibr
def split(filename, nlines, prefix, suffix)
n = 0
i = 1
file = nil
IO.foreach(filename) do |line|
if n % nlines == 0
file.close() if not file.nil?
file = File.new(prefix + i.to_s() + suffix, "w+")
i += 1
end
n += 1
file.puts(line)
end
file.close() if not... | Ruby |
FZILLA = 'C:\Program Files\FileZilla FTP Client\filezilla.exe'
FTP_URL = "ftp://DevUsers:Reuters123@vapftp/#{ENV['USERNAME']}"
puts "Connect to FTP: #{FTP_URL}..."
`exec "#{FZILLA}" "#{FTP_URL}"`
| Ruby |
require 'rubygems'
require 'win32console'
require 'inifile'
require 'socket'
include Win32::Console::ANSI
SCRIPT_ID = 3
SCRIPTS_ROOT = 'C:\VAPC\vaa\SDispatch\Scripts'
DEFAULT_EDIT = 'C:\Program Files\Notepad++\Notepad++.exe'
# ANSI Escape Color List
# Intensity 0 1 2 3 4 ... | Ruby |
require 'rubygems'
require 'win32console'
include Win32::Console::ANSI
# ANSI Escape Color List
# Intensity 0 1 2 3 4 5 6 7
# ------------------------------------------------------------------------------------
# Normal Black Red Green Yellow ... | Ruby |
if ARGV.size < 1
puts "lower file1 [file2 [...]]"
exit
end
i = 0
while i < ARGV.size
if File.exist?(ARGV[i])
File.rename(ARGV[i], ARGV[i].downcase)
elsif
puts "File [" + ARGV[0] + "] does not exist."
end
i = i + 1
end | Ruby |
INPUT1_NUM_ITEMS_IN_LINE = 10
TITLE_HEADER = "RIC_Name,RT_Number,PE,RDN_EXCHID,RECORDTYPE,RDN_EXCHD2,DSO_ID,VAA_Name,Channel_ID,FIDs"
class RICInfo
attr :ric, true
attr :rt_number, true
attr :pe, true
attr :rdn_exchid, true
attr :recordtype, true
attr :rdn_exchd2, true
attr :dso_id, true
attr :vaa... | Ruby |
require 'win32/registry'
keyname = 'SYSTEM\ControlSet001\Control\Session Manager\Environment'
access = Win32::Registry::KEY_ALL_ACCESS
Win32::Registry::HKEY_LOCAL_MACHINE.open(keyname, access) do |reg|
pathext = reg['PATHEXT']
exts = pathext.split(';')
if not exts.index('.RB') then
exts.push('.RB')
r... | Ruby |
def locate(path_list, to_find, info)
# replace started *. or * in pattern to a valid regex
if to_find.start_with?("*.")
to_find = to_find.gsub(/^\*\./, ".*\\.")
elsif to_find.start_with?("*")
to_find = "." + to_find
end
if info
puts "search files like `#{to_find}`"
puts "---------------------... | Ruby |
require 'win32/registry'
def set_proxy(addr, port)
cmd = "setx PROXY_ADDR #{addr} -m"
system(cmd)
if $? != 0 then return end
cmd = "setx PROXY_PORT #{port} -m"
system(cmd)
if $? != 0 then return end
cmd = "setx http_proxy http://#{addr}:#{port}"
system(cmd)
end
def get_proxy()
keyname = 'SYSTEM... | Ruby |
require 'rubygems'
require 'win32console'
include Win32::Console::ANSI
# ANSI Escape Color List
# Intensity 0 1 2 3 4 5 6 7
# ------------------------------------------------------------------------------------
# Normal Black Red Green Yellow ... | Ruby |
def split(filename, nlines, prefix, suffix)
n = 0
i = 1
file = nil
IO.foreach(filename) do |line|
if n % nlines == 0
file.close() if not file.nil?
file = File.new(prefix + i.to_s() + suffix, "w+")
i += 1
end
n += 1
file.puts(line)
end
file.close() if not file.nil?
end
| Ruby |
HOST_FILE_NAME = 'C:\WINDOWS\system32\drivers\etc\hosts'
GVIM = 'C:\Program Files\Vim\vim72\gvim.exe'
`#{GVIM} "#{HOST_FILE_NAME}"`
| Ruby |
CMDS = [
"Accessibility Options,access.cpl",
"Add/Remove Programs,appwiz.cpl",
"Add Hardware Wizard,hdwwiz.cpl",
"Automatic Updates,wuaucpl.cpl",
"Bluetooth Properties,bthprops.cpl",
"Display Properties,desk.cpl",
"Firewall Properties,firewall.cpl",
"Game Controllers,joy.cpl",
"Internet Opti... | Ruby |
VERSION_PATTERN = '\d+.\d+.\d+(.\d+){0,1}'
def compare_tag(a, b)
v1 = a.match(VERSION_PATTERN)
v2 = b.match(VERSION_PATTERN)
if (v1 != nil and v2 != nil) then
i1 = v1.to_s.split('.')
i2 = v2.to_s.split('.')
if i1.count == i2.count then
if a == b then
return 0
else
i = 0
while ... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
require "fileutils"
INPUT_PATH = "features/input_files/"
SANDBOX_PATH = "sandbox/"
def input_check file_name
relative_file_name = INPUT_PATH + file_name
file_check relative_file_name
end
def file_check full_file_name
if !File.readable? full_file_name
pending "File #{full_file_name} does not exist!"
en... | Ruby |
Given /^options of "([^"]*)"$/ do |options|
@options = options
end
Given /^no command-line arguments$/ do
# Do nothing; there are no command-line arguments!
end
Given /^key "([^"]*)" and input "([^"]*)"$/ do |key, input|
@key_file_name = INPUT_PATH + key
@input_file_name = SANDBOX_PATH + input
... | Ruby |
# CxlHelper maintains a collection of facilities for dealing with the complexity of the cxl format.
module CxlHelper
NAMESPACE = "xmlns"
NODE_PREFIX = "/#{NAMESPACE}:"
# Manufacture the full xpath from the nodes. Any arguments that are not already a valid xpath are correctly-prefixed.
def CxlHelper.create... | Ruby |
#TODO: figure out a sane build mechanism.
require "src/c_map"
require "src/debug"
require "src/output"
require "rubygems"
require "nokogiri"
# TODO: this needs significant cleanup.
def validate_arguments args
# Check that there are arguments.
if args.size == 0
Output.bad_args_exit
end
... | Ruby |
module Debug
def Debug.enable_debug
@enabled = true
end
def Debug.no_missing_edges
debug "There are no missing edges."
end
def Debug.missing_edge_between node1, node2
debug %{Missing edge between: "#{node1}" and "#{node2}"}
end
def Debug.misplaced_edge_between node1, node2, edge
deb... | Ruby |
require "src/cxl_helper"
include CxlHelper
module CMap
LEGEND_NODE_WIDTH = 60
LEGEND_NODE_HEIGHT = 28
LEGEND_LABEL_WIDTH = 46
LEGEND_LABEL_HEIGHT = 13
MISSING_EDGE_COLOR = "0,0,255,255"
MISPLACED_EDGE_COLOR = "255,0,0,255"
EXTRA_EDGE_COLOR = "128,0,128,255"
NAME_BLOCK_PREFIX = "Nam... | Ruby |
module Output
def Output.bad_args_exit
Output.wrong_args_error
Output.help_message
Output.exit
end
def Output.wrong_args_error
Output.error "malformed arguments."
end
def Output.help_message
puts "Command format:"
puts "cmap-eval [-options] key-file input-file"
puts
puts ... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.