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
def memprof | |
def vmsize | |
IO.readlines("/proc/self/status").grep(/VmSize/)[0].scan(/\d+/)[0].to_i | |
end | |
GC.start | |
GC.disable | |
before = vmsize | |
begin | |
yield | |
after = vmsize |
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
.file "tmp.c" | |
.section .rodata | |
.LC0: | |
.string "hello world" | |
.text | |
.globl main | |
.type main, @function | |
main: | |
leal 4(%esp), %ecx | |
andl $-16, %esp |
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
/* | |
* ffsc - far faster scala compiler, omit booting time of fsc(1) | |
* | |
* Copyright (c) 2010 Tadashi Saito | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
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
require "decimal" | |
require "bigdecimal" | |
require "bigdecimal/math" | |
N = 100 | |
STEP = 10 | |
TRY = 10 | |
result = { | |
n: (0..N).map{|m|m * STEP}, |
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
sqrt | Decimal | BigDecimal | |
---|---|---|---|
0 | 0 | 0 | |
30 | 0.124887 | 0.028016 | |
60 | 0.168286 | 0.050961 | |
90 | 0.193021 | 0.089924 | |
120 | 0.244228 | 0.120451 | |
150 | 0.284446 | 0.152398 | |
180 | 0.328916 | 0.18304 | |
210 | 0.392945 | 0.316898 | |
240 | 0.460614 | 0.386293 |
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
require "decimal" | |
y = Decimal::Math.sqrt(2, 50) | |
puts "sqrt(2) = #{y}" #=> sqrt(2) = 1.41421356237309504880168872420969807856967187537694 | |
include Decimal::Math # you can include the module, same as ::Math | |
y = log(10, 50) | |
puts "log(10) = #{y}" #=> log(10) = 2.30258509299404568401799145468436420760110148862848 |
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
--- bernoull.c~ 1991-01-20 18:43:42.000000000 +0900 | |
+++ bernoull.c 2010-08-02 23:06:40.000000000 +0900 | |
@@ -21,6 +21,7 @@ int main() | |
int i, n; | |
double q, b1, b2, d; | |
static double t[N + 1]; | |
+ int s = -1; | |
q = 1; | |
t[1] = 1; |
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
(1996/4: 中学入学) | |
1998/10: 第二種情報処理技術者試験合格 | |
(1999/4: 高校入学) | |
1999/8: www.linux.or.jp にて「オープンソースソフトウェア」ブックレビュー | |
http://www.linux.or.jp/bookreview/OpenSrcSoftware.html#issue3 | |
(2002/4: 大学入学) |
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 <cstdlib> | |
using namespace std; | |
int operacion(int x) | |
{ | |
int y; | |
static const int primes[] = { | |
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, | |
43, 47, 53, 59, 61, 67, 71, 79, 83, 89, 97 | |
}; |
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
Index: lib/csv.rb | |
=================================================================== | |
--- lib/csv.rb (revision 29897) | |
+++ lib/csv.rb (working copy) | |
@@ -1198,6 +1198,7 @@ | |
encoding = options.delete(:encoding) | |
mode = "rb" | |
mode << ":#{encoding}" if encoding | |
+ return open(path, mode, options).to_enum if block.nil? | |
open(path, mode, options) do |csv| |
OlderNewer