Skip to content

Instantly share code, notes, and snippets.

View y-yu's full-sized avatar

YOSHIMURA Yuu y-yu

View GitHub Profile
@y-yu
y-yu / map.cpp
Created November 26, 2013 02:09
map
template<int N, template<class T, class...A> class F, typename... U>
auto map(const F<T(U...)> f, const std::array<U, N>&... containers) -> T
{
std::array< T, N > res;
for (std::size_t i = 0; i != N; i++) {
res[i] = f( containers[i]... );
}
return res ;
}
@y-yu
y-yu / zip.md
Last active December 29, 2015 07:39
zip

zip関数

次のような機能を満す関数zipを作ってほしい。ただし次のような制約がある。

  • C++11
  • STLはOK
  • BoostはNG

大嘘

Process: hello_fltk [49218]
Path: /Users/USER/*/hello_fltk.app/Contents/MacOS/hello_fltk
Identifier: org.fltk.hello_fltk
Version: 0
Code Type: X86-64 (Native)
Parent Process: launchd [154]
User ID: 501
Date/Time: 2013-10-15 17:43:12.216 +0900
OS Version: Mac OS X 10.8.5 (12F45)
@y-yu
y-yu / gomi.sh
Last active December 24, 2015 12:19
This is Neta!!!!!!!!!
#!/bin/sh
for i in `jot $1`
do
wget --no-verbose --post-data "_method=POST&data%5BEntry%5D%5Bid%5D=32" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0" http://124.37.251.169/cpf/stu_003/votes/index/page:1 -O /dev/null
sleep 1
done
@y-yu
y-yu / re.c.diff
Created August 22, 2013 03:15
Rubyの改造(3)
18a19,20
> #include "relex.c"
> #include "re_parse.c"
3545a3548,3554
> static VALUE
> rb_reg_parse (VALUE re)
> {
> re_parse( RREGEXP_SRC_PTR(re) );
> return re;
> }
@y-yu
y-yu / re_parse.y
Created August 22, 2013 03:14
Rubyの改造(2)
%{
#include <stdio.h>
#include <string.h>
#include "relex.h"
//---------------------------------------------------------------------------
//#define YYDEBUG 1
//#define YYERROR_VERBOSE 1
//int yydebug = 1;
@y-yu
y-yu / relex.h
Created August 22, 2013 03:13
Rubyの改造(1)
#define YYSTYPE char *
extern int yylex ();
extern void init_yyc (char **);
extern void re_parse (char *);
@y-yu
y-yu / bench.rb
Created August 19, 2013 13:53
Rubyの正規表現のベンチマーク (参考:http://blog.livedoor.jp/dankogai/archives/50533165.html) (ruby 2.1.0dev (2013-08-19 trunk 42614) [x86_64-darwin12.4.0])
require 'benchmark'
re_alt = Regexp.compile('sa|st|tw|tu')
re_opt = Regexp.compile('s[at]|t[wu]')
match = 'abcdefghijklmnopqrstuvwxyz'
not_match = 'sssstttttttttssssssssuuuuu'
ntimes = 100000;
Benchmark.bm(8) do |x|
x.report('alt') { ntimes.times{ re_alt.match(match) } }
@y-yu
y-yu / zyoutoku.md
Last active December 19, 2015 18:19
情報特別演習 中間報告

XMLによる画像生成エンジンの制作

XMLによって記述された画像には SVG があるが、 SVGはラスタ画像と同等の表現力を得ようとしてあるので、 あまりにも冗長としたものになってしまっている。

そこで、少し表現力を落とす代りにシンプルなXMLで図を生成出来るようなエンジンの開発を目指す。

概要

android-sdk freetype gradle libevent lua pcre texinfo
atk gauche grails libffi lv php theora
atkmm gd groovy libgcrypt mcrypt pidof tmux
autojump gdbm harfbuzz libgpg-error md5sha1sum pixman tree
base64 gdk-pixbuf haskell-platform libicns mecab pkg-config v8
bdw-gc gettext hevea libmpc mecab-ipadic python vimpager
cairo ghc icu4c libntlm mercurial rea