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
#include <iostream>
#include <string>
#include <fstream>
#include "../third_party/cmdline/cmdline.h"
#include "../common/exception.hpp"
#include "../storage/local_storage.hpp"
using std::vector;
using std::pair;
using jubatus::storage::local_storage;
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]
#! /bin/bash
mkdir opencv_src
cd opencv_src
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=$HOME/.local -D WITH_TBB=ON -D WITH_EIGEN=OFF -D WITH_FFMPEG=ON -D WITH_QT=OFF -DWITH_CUDA=ON -DWITH_OPENCL=OFF -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..
make -j4
class ForgetVariable(chainer.Variable):
data_cache = None
last_accessed_id = None
def __init__(self, x):
"""
:type x: chainer.Variable
"""
self.rank = x.rank
self._volatile = x._volatile
@t-abe
t-abe / computational_cost_hook.py
Created April 28, 2017 09:14
Hook implementation to calculate roughly estimated computational cost of a given network for Chainer
from __future__ import print_function
import sys
import chainer
from chainer.utils import conv
class ComputationalCostHook(chainer.function.FunctionHook):
name = 'ComputationalCostHook'
import urllib.request
import lxml.html as html
target_url = 'https://headlines.yahoo.co.jp/hl?a=20171227-00000094-dal-base'
req = urllib.request.urlopen(target_url)
tree = html.parse(req)
r = tree.xpath('//*[@id="ym_newsarticle"]/div[2]/div[1]/p')
print(r[0].text_content())
#!/bin/bash
# (c) Wolfgang Ziegler // fago
#
# Inotify script to trigger a command on file changes.
#
# The script triggers the command as soon as a file event occurs. Events
# occurring during command execution are aggregated and trigger a single command
# execution only.
#
# Usage example: Trigger rsync for synchronizing file changes.
@t-abe
t-abe / cfr.py
Created November 20, 2019 13:02
import numpy as np
import typing
from collections import OrderedDict, Callable
import random
from copy import copy
import time
class Node(object):
def __init__(self, prev=None, action=(), player=None):