Skip to content

Instantly share code, notes, and snippets.

View ArGxento's full-sized avatar

ArGxento ArGxento

View GitHub Profile
BEGIN MESSAGE.
vx9LaOkX71XuRUj q9wpeTTstDDarTy fxAQMKkneR3joI5 CYTuL2d31n2EGsA
T7ziy5xFtl8eXN9 Z83bxLxVM9jTCKq 6Xr2MZHgg4XMNGt hswcu9Yxi61Ix1n
rriSlNXQgOIaTXl YkS6TaiTldocDC5 xeY8ljvrnDbeyLd k3EHmVxS5dSvLMB
FiYnHsERW4CtWur RaPJxBSn4kos9Fm BiSMX0Qz5Z.
END MESSAGE.

Keybase proof

I hereby claim:

  • I am argxento on github.
  • I am agx (https://keybase.io/agx) on keybase.
  • I have a public key ASBBd9K0khDNiZdmtG8xAhsf-P_9uu6lx1lpx-TWxx6RJQo

To claim this, I am signing this object:

@ArGxento
ArGxento / gmail_replace_comma_period.js
Created October 16, 2016 17:48
GMailのメール作成時に全角句読点を全角カンマとピリオドに置換するブックマークレット
javascript:(function(){for(e of document.getElementsByClassName("editable")){e.innerHTML=e.innerHTML.replace(/、/g,",").replace(/。/g,".");}})();
@ArGxento
ArGxento / binarize.py
Last active August 29, 2015 14:09
Binarization by Ohtsu's discriminant analysis method
from PIL import Image
import sys
import os
def binarize_try(hist, t):
blist = hist[:t]
wlist = hist[t:]
if len(blist) == 0 or len(blist) == 0:
return 0
レベル 関数名 サンプル数 (子を含む) サンプル数 (関数のみ) サンプル % (子を含む) サンプル % (関数のみ) モジュール名
0 MinePanzer.exe 7,871 0 100.00 0.00
0 mainCRTStartup 7,738 0 98.31 0.00 MinePanzer.exe
1 __tmainCRTStartup 7,681 0 97.59 0.00 MinePanzer.exe
2 main 7,675 0 97.51 0.00 MinePanzer.exe
3 ?Update@Engine@ace@@SAXXZ 7,383 1 93.80 0.01 MinePanzer.exe
4 ?Draw@Scene@ace@@AAEXXZ 6,103 1 77.54 0.01 MinePanzer.exe
5 ?Draw@Layer@ace@@AAEXXZ 3,541 1 44.99 0.01 MinePanzer.exe
6 [ace_core.Debug.dll] 3,539 2 44.96 0.03 ace_core.Debug.dll
7 [ace_core.Debug.dll] 3,537 18 44.94 0.23 ace_core.Debug.dll
@ArGxento
ArGxento / pseudocoro.cpp
Created October 28, 2012 13:05
note about pseudo-coroutine in C++
#include <iostream>
#include <boost/optional.hpp>
boost::optional<int> coro (int const a)
{
#define yield(arg) ___lino = __LINE__;return boost::optional<int>(arg);case __LINE__:
#define yield_return ___lino = 0;return boost::optional<int>();case __LINE__:
static int ___lino = 0;
//decl of vars
@ArGxento
ArGxento / enum_idiom.cpp
Created October 21, 2012 02:10
enum idiom for non-c++11 environment
#include<iostream>
#include<boost/variant.hpp>
namespace E1 {
enum Type {
a,b,c
};
struct stringize:std::string {
stringize(Type e) {
switch(e) {
#define ENUM_STRINGIZE(elem) break;case elem:assign(#elem)
@ArGxento
ArGxento / xpr_chatsheet.cpp
Created October 21, 2012 01:53
cheatsheet of boost.xpressive w/ semantic actions
#include <iostream>
#include <string>
#include <stack>
#include <functional>
//xpressiveのうち、staticのためのヘッダ
#include <boost/xpressive/xpressive_static.hpp>
// セマンティックアクションのためのヘッダ
#include <boost/xpressive/regex_actions.hpp>
namespace xpr = boost::xpressive;
@ArGxento
ArGxento / qi_skeleton.cpp
Created August 30, 2012 20:50
skeleton of boost.spirit.qi with semantic action
// 最もシンプルな文法構造体のサンプル
#include <boost/spirit/include/qi.hpp>
#include <iostream>
#include <string>
namespace qi = boost::spirit::qi;
// qi::grammarクラスを継承して文法クラスを作ります。
// テンプレート引数には入力用のイテレータを書く必要があります
template <typename itrT>