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 compare_swap( words ) | |
| counter = 0 | |
| for i in 0..( words.size - 1 ) | |
| break if i == words.size | |
| word = words[i] | |
| puts "word: #{word}" | |
| lastchar = word[word.length - 1].bytes.first | |
| later = [] | |
| for j in ( i + 1 )..words.size | |
| compare = words[j] |
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
| length = gets.to_i | |
| str = gets | |
| result = 0.0 | |
| i = 0 | |
| str.each_byte do |s| | |
| case s | |
| when 65 # A | |
| result = result + 4.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
| require 'json' | |
| FILE = './2008_graph_mining.json' | |
| # result of http://www.dblp.org/search/api/?q=ce:year:2008*%20graph*%20mining*&h=1000&c=4&f=0&format=json | |
| def scrape | |
| file = File.open( FILE ) | |
| doc = JSON.parse( file.read ) | |
| hits = doc["result"]["hits"]["hit"] |
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
| require 'highline' | |
| def main | |
| highline = HighLine.new | |
| passwd = highline.ask( 'type your password: ' ) do |q| | |
| q.echo = '*' | |
| end | |
| puts passwd | |
| end |
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
| PATH = "/path/to/hoge" | |
| Dir.glob( PATH + '*.rb' ) do |f| | |
| puts f | |
| # doesn't work correctly | |
| exec( "rspec " + f ).to_s | |
| # work correctly | |
| result = system( 'rspec ' + f ).to_s |
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
| inohiro@inohiro-ng-mac libmemcached-0.32$ ./configure --with-gcc=clang | |
| configure: WARNING: unrecognized options: --with-gcc | |
| checking build system type... i386-apple-darwin11.2.0 | |
| checking host system type... i386-apple-darwin11.2.0 | |
| checking target system type... i386-apple-darwin11.2.0 | |
| checking for a BSD-compatible install... /usr/bin/install -c | |
| checking whether build environment is sane... yes | |
| checking for a thread-safe mkdir -p... config/install-sh -c -d | |
| checking for gawk... no | |
| checking for mawk... no |
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
| inohiro@inohiro-ng-mac ~$ gem install memcached | |
| Building native extensions. This could take a while... | |
| ERROR: Error installing memcached: | |
| ERROR: Failed to build gem native extension. | |
| /Users/inohiro/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb | |
| extconf.rb:7: Use RbConfig instead of obsolete and deprecated Config. | |
| Touching aclocal.m4 in libmemcached. | |
| touch -r libmemcached-0.32/m4/visibility.m4 libmemcached-0.32/configure.ac libmemcached-0.32/m4/pandora_have_sasl.m4 libmemcached-0.32/m4/aclocal.m4 | |
| Configuring libmemcached. |
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
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "strings" | |
| "image/png" | |
| ) | |
| type Cset struct { |
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
| Host ubuntu-master | |
| HostName 192.168.0.226 | |
| User user | |
| Host ubuntu01 | |
| HostName 192.168.10.1 | |
| User user | |
| Host ubuntu02 | |
| HostName 192.168.10.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
| d-i debian-installer/locale string en_US | |
| d-i console-setup/ask_detect boolean false | |
| d-i console-setup/layoutscode string ja106 | |
| d-i netcfg/choose_interface select auto | |
| d-i mirror/country string manual | |
| d-i mirror/http/hostname string 192.168.78,1 | |
| d-i mirror/http/directory string /ubuntu | |
| # d-i mirror/http/proxy string http://192.168.78.100:8080 |