Skip to content

Instantly share code, notes, and snippets.

@kashitan
kashitan / Dockerfile
Created August 10, 2020 06:39
IMI 住所変換コンポーネント Herokuデプロイ用Dockerfile
FROM node:14-alpine
ENV VERSON=2.0.0
ENV COMPONENT=imi-enrichment-address
WORKDIR /usr/local/${COMPONENT}
RUN apk --no-cache --virtual .build-deps add curl \
&& curl -o imi-enrichment-address-${VERSON}.tgz \
https://info.gbiz.go.jp/tools/imi_tools/resource/${COMPONENT}/${COMPONENT}-${VERSON}.tgz \
@kashitan
kashitan / choropleth_demo.Rmd
Created June 14, 2017 07:46
{flexdashboard}と{leaflet}で簡易GIS
---
title: "Choropleth Demo"
output:
flexdashboard::flex_dashboard:
orientation: rows
runtime: shiny
---
```{r global, include=FALSE}
# load data in 'global' chunk so it can be shared by all users of the dashboard
@kashitan
kashitan / reverse_geocoding.R
Last active November 4, 2016 02:29
逆ジオコーディング結果を地図にプロット
library(RPostgreSQL)
library(leaflet)
# データベースに接続
con <- dbConnect(PostgreSQL(), host="host_name", port=port_number, dbname="database_name", user="user_name", password="password")
# クエリ文字列を定義
query <- paste("SELECT pref, city, town, block,",
"ST_Y(ST_Transform(the_geom, 4326)) AS lat,",
"ST_X(ST_Transform(the_geom, 4326)) AS lon",
-- 位置参照情報ダウンロードサービス(http://nlftp.mlit.go.jp/isj/)から
-- ダウンロードしたをデータを格納するテーブル
CREATE TABLE loc_ref_info(
pref varchar(100) -- 都道府県名
, city varchar(100) -- 市区町村名
, town varchar(100) -- 大字・町丁目名
, block varchar(100) -- 街区符号・地番
, coord_no integer -- 座標系番号
, x numeric -- X座標
, y numeric -- Y座標
@kashitan
kashitan / Dockerfile.rstudio
Last active September 30, 2016 09:40
nvidia-docker上でTensorFlow for Rを実行するDockerfile
FROM kashitan/tensorflow:latest
MAINTAINER Takashi Kitano <@kashitan>
# Install R
RUN yum install -y R wget initscripts && \
yum clean all
# Install RStudio-Server
RUN wget https://download2.rstudio.org/rstudio-server-rhel-0.99.903-x86_64.rpm && \
@kashitan
kashitan / Dockerfile.tensorflow
Last active September 30, 2016 08:34
nvidia-docker上でTensorFlowを実行するDockerfile
FROM nvidia/cuda:7.5-cudnn5-devel-centos7
MAINTAINER Takashi Kitano <@kashitan>
RUN yum install -y epel-release && \
yum install -y gcc \
gcc-c++ \
initscripts \
libcurl-devel \
make \
@kashitan
kashitan / docker.conf
Created September 30, 2016 08:02
CentOS7でDockerのイメージ・コンテナの保存先を変更する設定
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --graph="/mnt/docker-data" --storage-driver=overlay
@kashitan
kashitan / geojson4bulkapi.R
Last active January 29, 2016 07:46
GeoJSON形式のファイルをelastic searchのBulk API用に変換
library(dplyr)
library(jsonlite)
l <- read.csv("shapes.csv", header = TRUE, colClasses = c("character", "character", "character"))
fix_str <- '{"index":{"_index":"towns", "_type":"town"}}'
for(i in 1:nrow(l)) {
s <- fromJSON(paste0("geojson/", l$city_cd[i], ".json"))
f <- s$features
@kashitan
kashitan / shapes.csv
Last active January 29, 2016 02:05
世界測地系緯度経度・shape形式のリスト
city_cd dir shape
01101 A002005212010DDSWC01101 h22ka01101
01102 A002005212010DDSWC01102 h22ka01102
01103 A002005212010DDSWC01103 h22ka01103
01104 A002005212010DDSWC01104 h22ka01104
01105 A002005212010DDSWC01105 h22ka01105
01106 A002005212010DDSWC01106 h22ka01106
01107 A002005212010DDSWC01107 h22ka01107
01108 A002005212010DDSWC01108 h22ka01108
01109 A002005212010DDSWC01109 h22ka01109
@kashitan
kashitan / shp2geojson.R
Last active January 29, 2016 06:47
ShapeファイルからGeoJSONに変換するサンプル
library(rgdal)
library(sp)
library(maptools)
l <- read.csv("shapes.csv", header = TRUE, colClasses = c("character", "character", "character"))
P4S.latlon <- CRS("+proj=longlat +datum=WGS84")
for(i in 1:nrow(l)) {
shp <- readShapePoly(paste0("shapes/", l$dir[i], "/", l$shape[i]) ,