Skip to content

Instantly share code, notes, and snippets.

View t-abe's full-sized avatar

Takashi Abe t-abe

  • Preferred Networks, Inc.
  • Tokyo, Japan
View GitHub Profile
class A(object):
def __init__(self, ar = []):
self.ar = ar
a = A()
b = A()
a.ar.append(1)
b.ar.append(2)
print a.ar # => [1, 2]
@t-abe
t-abe / dictor.pl
Created October 24, 2010 11:10
perl script to use weblio.jp's dictionary
#! /usr/bin/perl
use strict;
use warnings;
use Web::Scraper;
use LWP::UserAgent;
use URI;
use URI::Escape;
use Encode;
use utf8;
#include <useopencv.h>
template <typename T>
class BoxMat {
public:
const cv::Mat_<T>& mat;
int offsetX, offsetY;
int rows, cols;
BoxMat(const cv::Mat_<T>& mat, const int offsetY, const int offsetX, const cv::Size size)
#pragma once
#pragma warning ( disable : 4819 )
#pragma warning ( disable : 4996 )
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/calib3d/calib3d.hpp>
// use opencv
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#ifdef _DEBUG
#pragma comment( lib, "opencv_core229d.lib" )
#pragma comment( lib, "opencv_imgproc229d.lib" )
#pragma comment( lib, "opencv_highgui229d.lib" )
@t-abe
t-abe / hog.hpp
Created July 10, 2011 10:20
implementation of HoG
/*
// prepare
HoG hog(PATCH_SIZE, cv::Size(8, 8), cv::Size(2, 2), cv::Size(8, 8), 9);
// ...or...
MultiScaleHoG hog;
hog.add(PATCH_SIZE, cv::Size(4, 4), cv::Size(2, 2), cv::Size(4, 4), 9);
hog.add(PATCH_SIZE, cv::Size(16, 16), cv::Size(2, 2), cv::Size(8, 8), 9);
hog.add(PATCH_SIZE, cv::Size(32, 32), cv::Size(2, 2), cv::Size(16, 16), 9);
@t-abe
t-abe / wbl.hpp
Created July 10, 2011 10:25
BLASとLAPACKのラッパー
/* the wrapper of BLAS and LAPACK (MKL) */
#pragma once
#include "blas.hpp"
#include <cstring>
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef MIN
@t-abe
t-abe / blas.hpp
Created July 10, 2011 10:26
BLASのラッパー
#pragma once
/* using MKL10 */
#pragma comment(lib, "mkl_intel_lp64.lib")
#pragma comment(lib, "mkl_intel_thread.lib")
#pragma comment(lib, "mkl_core.lib")
#pragma comment(lib, "libiomp5md.lib")
#include <mkl.h>
#include <cmath>
@t-abe
t-abe / pls.hpp
Created July 10, 2011 10:27
Partial Least Squares
/********
// Multi-class
const int N; // number of samples
const int D; // dimension of feature
const int M; // number of classes
const int P; // number of reduced domensions
double* X = new double[D * N]; // features
double* Y = new double[M * N]; // labels
double* W = new double[D * P]; // projection matrix
@t-abe
t-abe / emacs.rb
Last active December 14, 2015 10:10 — forked from rfkm/emacs.rb
require 'formula'
class Emacs < Formula
homepage 'http://www.gnu.org/software/emacs/'
url 'http://ftp.yz.yamagata-u.ac.jp/pub/GNU/emacs/emacs-24.2.tar.gz'
sha1 '5fc4fe7797f821f2021ac415a81f5f190c52c0b2'
depends_on "autoconf" => :build
if ARGV.include? "--use-git-head"