Skip to content

Instantly share code, notes, and snippets.

View kobake's full-sized avatar

KOBAYASHI Keiichi kobake

View GitHub Profile
@kobake
kobake / agg.php
Last active December 17, 2015 03:09
凝集型クラスタリング
<?php
/*
実行例
php agg.php 0,1,3,5.5,10,7,8.8
*/
// 区切り文字
$IN_DELIM = ','; // クラスタ内区切り文字
$OUT_DELIM = ' | '; // クラスタ間区切り文字
@kobake
kobake / sample.csproj&nbsp;(after)
Created June 12, 2013 08:54
Partialクラスのファイルを元クラスの子として表示 ref: http://qiita.com/items/87239e4d50fe0031513c
<Compile Include="Forms\Form1.Hoge.cs">
<DependentUpon>Form1.cs</DependentUpon>
<SubType>Code</SubType>
</Compile>
@kobake
kobake / hello world 2
Created June 12, 2013 09:50
hello world
test
@kobake
kobake / aaa.cpp
Last active December 18, 2015 09:49
hogehoge
hogehoge;
@kobake
kobake / PrintFunctions実行結果
Last active December 18, 2015 11:19
APIフック (Cライブラリ関数やWindowsAPIの書き換え) と、その応用例 ref: http://qiita.com/items/8d3d3637c7af0b270098
Module:KERNEL32.dll Hint:234, Name:EncodePointer
Module:KERNEL32.dll Hint:532, Name:GetModuleFileNameW
Module:USER32.dll Hint:526, Name:MessageBoxA
Module:imagehlp.dll Hint:18, Name:ImageDirectoryEntryToData
Module:MSVCR100D.dll Hint:289, Name:_CRT_RTC_INITW
Module:MSVCR100D.dll Hint:1289, Name:_wassert
Module:MSVCR100D.dll Hint:1499, Name:getchar ← 今回はこれを書き替えてみます
Module:MSVCR100D.dll Hint:1474, Name:fopen
@kobake
kobake / redmine_hide_status_when_new_ticket_form.patch
Last active December 18, 2015 17:49
(For redmine 2.3.1) Hide status field in new ticket form.
diff --git app/views/issues/_attributes.html.erb app/views/issues/_attributes.html.erb
index 0e29701..830dfc6 100644
--- app/views/issues/_attributes.html.erb
+++ app/views/issues/_attributes.html.erb
@@ -2,7 +2,8 @@
<div class="splitcontent">
<div class="splitcontentleft">
-<% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
+<% if params[:action] == 'new' %>
@kobake
kobake / QiitaApiAgent1.php
Last active December 18, 2015 19:59
Qiita API を使うときには User-Agent を設定しないと 500 Internal Server Error が発生する ref: http://qiita.com/kobake@github/items/d256fd1665284fd3c65a
<?php
ini_set('user_agent', 'OreOreAgent');
$url = 'https://qiita.com/api/v1/items';
$response = file_get_contents($url);
@kobake
kobake / dom_charset.php
Created June 23, 2013 11:22
DOMDocument::loadHTML が meta の charset を解釈してくれない問題と対策 ref: http://qiita.com/kobake@github/items/3c5d09f9584a8786339d
<?php
$url = "http://qiita.com/";
$body = file_get_contents($url);
$dom = new DOMDocument();
@$dom->loadHTML($body);
$title = $dom->getElementsByTagName('title')->item(0)->textContent;
print "$title\n";
@kobake
kobake / ssd_bench
Created July 19, 2013 18:44
SSDベンチマーク結果
-----------------------------------------------------------------------
CrystalDiskMark 3.0.2 x64 (C) 2007-2013 hiyohiyo
Crystal Dew World : http://crystalmark.info/
-----------------------------------------------------------------------
* MB/s = 1,000,000 byte/s [SATA/300 = 300,000,000 byte/s]
Sequential Read : 434.949 MB/s
Sequential Write : 141.902 MB/s
Random Read 512KB : 355.272 MB/s
Random Write 512KB : 152.722 MB/s
@kobake
kobake / gist:6344947
Last active December 21, 2015 18:08
trueになる。
hoge = 0
if hoge then
print "true"
else
print "false"
end