fio is an I/O tool meant to be used both for benchmark and stress/hardware verification.
Linux:
#!/usr/bin/env ruby | |
class String | |
def levenshtein(other) | |
range_self_end = self.size | |
range_other_end = other.size | |
data = | |
(0..range_self_end).map {|s| | |
(0..range_other_end).map {|t| | |
t + s unless t>0 && s>0 |
#include <iostream.h> | |
#include <stdlib.h> | |
/**/ | |
const int NUM = 6; | |
void Swap(int &a,int &b) | |
{ | |
int t = 0; | |
t = a; | |
a = b; | |
b = t; |
module Decorator | |
def initialize(decorated) | |
@decorated = decorated | |
end | |
def method_missing(method,*args) | |
# empty? is a method; ?: is a tri-operator | |
args.empty? ? @decorated.send(method):@decorated.send(method,args) | |
end |
# create a new object | |
object = Object.new | |
# dup this object, dog is a object | |
dog = object.clone | |
# define a function ONLY for this object | |
def dog.sit | |
print "I`m sitting\n" | |
end |
class SortAlogrithm | |
def quick_sort | |
#... | |
puts "quick_sort" | |
end | |
def bubble_sort | |
#... | |
puts "bubble_sort" | |
end | |
end |
class List | |
include Enumerable | |
def each | |
yield 1 | |
yield 2 | |
end | |
#... | |
end |
require 'singleton' | |
class Single | |
include Singleton | |
#... | |
end | |
single = Single.instance | |
# private method `new' called for Single:Class (NoMethodError) |
class Newspaper | |
include Observable | |
def deliver(news) | |
changed | |
@news = news | |
notify_observers @news | |
end | |
end | |
class Subscriber | |
def update(news) |
/* | |
MERGE(A, p, q, r) | |
1 n1 ← q - p + 1 | |
2 n2 ← r - q | |
3 create arrays L[1...n1 + 1] and R[1...n2 + 1] | |
4 for i ← 1 to n1 | |
5 do L[i] ← A[p + i - 1] | |
6 for j ← 1 to n2 | |
7 do R[j] ← A[q + j] | |
8 L[n1 + 1] ← ∞ |