This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import sys | |
import chainer | |
from chainer.utils import conv | |
class ComputationalCostHook(chainer.function.FunctionHook): | |
name = 'ComputationalCostHook' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******** | |
// 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 |
NewerOlder