2018-05-01から1ヶ月間の記事一覧

$! は最後に実行したバックグラウンドプロセスID

$1, $2, $3, ... are the positional parameters. "$@" is an array-like construct of all positional parameters, {$1, $2, $3 ...}. "$*" is the IFS expansion of all positional parameters, $1 $2 $3 .... $# is the number of positional parameters.…

GremlinでSample作成

TinkerPop3 Documentation graph = TinkerGraph.open() marko = graph.addVertex(T.label, "person", T.id, 1, "name", "marko", "age", 29) vadas = graph.addVertex(T.label, "person", T.id, 2, "name", "vadas", "age", 27) lop = graph.addVertex(T.lab…

二次元の分類結果を plot

機械学習の結果、2 個の特徴の座標と分類結果をわかりやすく図で出力している import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap def plot_dicision_regions(X, y, classifier, test_idx=None, resolusions…

.tgz のファイルを開いて読み取る方法

tarfile はZipとは違うアプローチが必要 import tarfile workpath = '/tmp/test.tgz' filename = 'test1.tsv' with tarfile.open(workpath) as tfile: if filename not in tfile.getnames(): raise Exception('No such file %s' % filename) with tfile.extr…

テンソルの勉強について

以下のサイトで、テンソル積やその他諸々の解説をしてた。 http://www.mm.civil.tohoku.ac.jp/renzokutai/0_suugaku.pdf

curl でファイルから --data-urlencodeを指定

通常の場合は、ファイルから値を指定するときは以下 ## http://example.com?name=[test.txtの中身] curl http://example.com --data-urlencode name@filename < test.txt 標準入力から入力するときは、以下を使う ## 標準入力での -(ハイフン) の使い方 $ …

CentOS6 に cassandra を yum install する方法

centos6だと、yum install datastax での install をする必要があった $ java -version java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) # vi /etc/yum.re…

janusgraph+cassandra で graph database を構築

Cassandra の yum install /etc/yum.repos.d/cassandra.repo [cassandra] name=Apache Cassandra baseurl=https://www.apache.org/dist/cassandra/redhat/311x/ gpgcheck=1 repo_gpgcheck=1 gpgkey=https://www.apache.org/dist/cassandra/KEYS yum -y insta…

Python での S3 からファイル取得(boto3)

boto3というモジュールが存在して、それを使ってS3 のファイルが取得できる。 ファイルのキー取得 In [1]: import boto3 In [7]: import botocore In [21]: s3 = boto3.resource('s3', aws_access_key_id=S3_ACCESS_KEY, aws_secret_access_key=S3_SECRET_KE…

Sparkの...Typeってどれが対応しているのか調べた

private static DataType parseDataType(Config fieldsConfig) { String type = fieldsConfig.getString(FIELD_TYPE_CONFIG); switch (type) { case "string": return DataTypes.StringType; case "byte": return DataTypes.ByteType; case "short": return …