Skip to content

Instantly share code, notes, and snippets.

View keichan34's full-sized avatar
👋
Hello!

Keitaroh Kobayashi keichan34

👋
Hello!
View GitHub Profile
@keichan34
keichan34 / index.ts
Created January 26, 2024 01:11
政令指定都市の自治体コード
// 政令指定都市 (元データでは行政区になっているが、私達は区域全体でまとめたい(東京23特別区以外))
// この配列は、行例指定都市の公共団体コードの頭3または4桁を含む
const DESIGNATED_CITIES = [
/^011/, // 北海道札幌市
/^041/, // 宮城県仙台市
/^111/, // 埼玉県さいたま市
/^121/, // 千葉県千葉市
/^141(?!3|5)/, // 神奈川県横浜市
/^1413/, // 神奈川県川崎市
/^1415/, // 神奈川県相模原市
@keichan34
keichan34 / build.sh
Last active March 13, 2023 06:46
Shapefileが入ったディレクトリを一括で一つのmbtilesにアーカイブする
#!/bin/bash -e
input=${1}
outdir=$(mktemp -d)
echo "Output: $outdir"
for shp in $(find "$input" -name '*.shp'); do
name=$(basename "$shp" .shp)
out_geojson="${outdir}/${name}.ndgeojson"
@keichan34
keichan34 / README.md
Created January 31, 2023 02:22
地図タイルとそのタイルの子孫を

tile_children

あるタイルの子孫の一覧を取得する

USAGE

chmod +x tile_children.py
./tile_children.py [parent tile] [maxzoom] [suffix]
@keichan34
keichan34 / README.md
Last active February 10, 2023 07:47
法務省データもろもろ
cp -r moj_data/ ./
mkdir all_zips
find . -name '*.zip' -maxdepth 1 | xargs -P 16 -I '{}' unzip '{}' -d ./all_zips

ここで all_zips に展開されたzipがある 次は任意座標と公共座標系を分ける

@keichan34
keichan34 / App.tsx
Created April 27, 2021 08:08
normalize-japanese-addresses のサンプル React App
import React, { useCallback, useState } from 'react'
import { normalize, NormalizeResult } from '@geolonia/normalize-japanese-addresses'
interface Result {
input: string
normalized: NormalizeResult
}
const App: React.FC = () => {
const [ result, setResult ] = useState<Result | undefined>(undefined)
@keichan34
keichan34 / NewWindowPortal.tsx
Created September 11, 2020 02:03
Open a new window with a React portal
import React, { useEffect, useMemo, useRef } from "react"
import { createPortal } from "react-dom"
const NewWindowPortal: React.FC = ({children}) => {
const containerEl = useMemo(() => document.createElement("div"), [])
useEffect(() => {
if (!containerEl) {
return
}
@keichan34
keichan34 / config.fish
Created April 17, 2020 01:24
My Fish-shell config
function fish_greeting
echo "! COMPUTER_NAME"
end
set -x EDITOR vim
set -x LESS -asrRix8
set -x LANG en_US.UTF-8
set -x LC_ALL en_US.UTF-8
set -x LANGUAGE en_US.UTF-8
@keichan34
keichan34 / package.json
Created July 23, 2018 11:56
hacking CRA to work with babel-plugin-relay
{
"scripts": {
"build": "node ./setup && react-scripts build"
}
}
@keichan34
keichan34 / blurb.fish
Last active March 12, 2017 01:19 — forked from jeremy-w/blurb.fish
Fish function to create or reply to a social post on 10 Centuries. MPLv2
function blurb --description Post\ to\ 10C.\\nblurb\ post\ MESSAGE\\nblurb\ POST_ID\ REPLY --argument reply_id message
set -l token $TEN_CENTURIES_API_TOKEN
set -l endpoint https://api.10centuries.org/content/write
set -l usage 'blurb: post or reply to a message on 10C
Usage:
blurb post MESSAGE
Post a new blurb

Keybase proof

I hereby claim:

  • I am keichan34 on github.
  • I am sleepy_keita (https://keybase.io/sleepy_keita) on keybase.
  • I have a public key ASASuKTnKfWXIiwyRu4jyTDn-i8LUj1qZLrKHeNPRBtlsAo

To claim this, I am signing this object: