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
From d05d3e3b95d354f5f59232ace4db24ff859a5bcd Mon Sep 17 00:00:00 2001 | |
From: Masaya TARUI <tarui@prx.jp> | |
Date: Tue, 4 Mar 2014 20:22:13 +0900 | |
Subject: [PATCH] introduce st_foreach_update, st_foreach_update_check | |
--- | |
hash.c | 47 ++++++++++------ | |
internal.h | 5 ++ | |
st.c | 177 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
3 files changed, 214 insertions(+), 15 deletions(-) |
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
DevQuiz のSlidingPuzzleを解くためのC++コードです。 | |
(C++といいつつclassでカプセル化と途中での宣言を使っている意外はCですが) | |
あらかじめproblems.txtを用意し、更にresultsフォルダを作っておく必要あり。 | |
途中で止めて再開出来る機能もあり。 | |
二重ループの値それぞれと、その時に出来てるresultsのNoを指定 | |
(多分コードを読まないと何のことだか分からないだろうけど | |
アルゴリズムはIDDFSにマンハッタン距離による枝狩りと言う事になるんでしょうか? |
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: thread.c | |
=================================================================== | |
--- thread.c (revision 38172) | |
+++ thread.c (working copy) | |
@@ -4337,6 +4337,19 @@ | |
return Qnil; | |
} | |
+static VALUE | |
+rb_mutex_lock_sure(VALUE self) |
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
# -*- coding: utf-8 -*- | |
r=:ok | |
e=Class.new(Exception) | |
th_s = Thread.current | |
begin | |
th = Thread.start{ | |
Thread.async_interrupt_timing(Object => :on_blocking){ | |
begin | |
Thread.current.raise RuntimeError | |
sleep |
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/irb/completion.rb | |
=================================================================== | |
--- lib/irb/completion.rb (revision 38221) | |
+++ lib/irb/completion.rb (working copy) | |
@@ -152,9 +152,10 @@ | |
gv = eval("global_variables", bind).collect{|m| m.to_s} | |
lv = eval("local_variables", bind).collect{|m| m.to_s} | |
+ iv = eval("instance_variables", bind).collect{|m| m.to_s} | |
cv = eval("self.class.constants", bind).collect{|m| m.to_s} |
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
$ tail -n2 *.log | |
==> 193p194_1.log <== | |
21.601350999999987 | |
31.410000 0.490000 31.900000 ( 31.928621) | |
==> 193p194_2.log <== | |
20.781295 | |
29.910000 0.330000 30.240000 ( 30.335949) | |
==> 193p194_3.log <== |
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
24689222839,0 | |
ENV: Ruby | |
※締め切り後に調べた内容で解説を再編集しています。 | |
Binary Indexed Treeとか知りませんでした(汗 | |
インデックスの振り方が大変独特ですね。。。 | |
https://twitter.com/debiru/status/374400678182928384 | |
から | |
プログラミングコンテストでのデータ構造 |
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
data=`perf annotate -svm_exec_core --show-total-period --stdio`.split(/\n/) | |
ins="before" | |
cnt=Hash.new{0} | |
total=0 | |
data.each{|line| | |
case line | |
when /INSN_ENTRY\((.*)\)/ | |
ins = $1 | |
when /END_INSN/ | |
ins = "none" |
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 'benchmark/ips' | |
f=proc{} | |
g=proc{|i| i>0 ? g.call(i-1):0 } | |
N=2000 | |
Benchmark.ips do |x| | |
x.report("f"){ f.call } | |
x.report("g"){ g.call(N) } | |
end | |
# ====== before ================================= | |
Warming up -------------------------------------- |
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
# Copy from https://github.com/docker-library/ruby/blob/752c5f7cf44870ceae77134b346d20093053c370/2.4/Dockerfile | |
FROM buildpack-deps:jessie | |
# skip installing gem documentation | |
RUN mkdir -p /usr/local/etc \ | |
&& { \ | |
echo 'install: --no-document --platform ruby'; \ | |
echo 'update: --no-document'; \ | |
} >> /usr/local/etc/gemrc |
OlderNewer