Skip to content

Instantly share code, notes, and snippets.

@nozma
nozma / Main.py
Last active August 16, 2017 13:25
# coding: utf-8
s = input().split()
target = [1, 5, 6, 7, 8, 9, 15, 16, 19]
result ={}
for i in range(len(s)):
if i + 1 in target:
result[i+1] = s[i][:1]
@nozma
nozma / Main.py
Last active August 16, 2017 13:15
# coding: utf-8
import re
s = input()
# カンマとコンマを除外してから単語毎のリストに分解
s = re.sub('[,.]', '', s)
s = s.split()
# 文字数をカウントしてリスト化
@nozma
nozma / Main.py
Last active August 16, 2017 14:27
# coding: utf-8
s1 = 'パトカー'
s2 = 'タクシー'
s = ''.join([i+j for i, j in zip(s1, s2)])
print(s)
@nozma
nozma / file0.txt
Last active July 26, 2017 15:06
AOL Reader向けの.vimperatorrc設定 ref: http://qiita.com/nozma/items/8e38c94943f616279f86
lazy fmaps -u='https?://reader\.aol\.co\.jp/.*' gh gs gd ga go gx ? r = - f u j k <Space> <S-Space> t v <Return> m 1 2 3 4 5 /
lazy fmaps -u='https?://reader\.aol\.co\.jp/.*' -events=vkeydown J K N P X O A
@nozma
nozma / file0.r
Created July 25, 2017 12:23
デンドログラムのラベル操作や回転 ref: http://qiita.com/nozma/items/b6924a96f838f485f89b
data("UScitiesD")
hc <- hclust(UScitiesD)
plot(hc)
@nozma
nozma / file0.r
Created May 17, 2017 03:55
RからExcelで文字化けしないCSVを出力する ref: http://qiita.com/nozma/items/6de3e636d175cc3d6e3f
df <- data.frame(a = letters[1:3],
b = c("あ", "い", "う"))
@nozma
nozma / file0.r
Last active April 30, 2017 10:40
Rで緯度経度から都道府県を求める ref: http://qiita.com/nozma/items/808bce2f496eabd50ff1
library(sf)
# 日本地図のシェープファイルを読み込む
f <- "N03-160101_GML/N03-16_160101.shp"
japan <- st_read(f)
runner:
scopes:
python: "python3"
@nozma
nozma / file0.r
Last active January 22, 2017 14:16
ggplot2における2軸プロットの使いみち ref: http://qiita.com/nozma/items/c50a8d45c73bf8b84794
library(ggplot2)
library(dplyr)
# hwy : highway miles per gallon
# 1mile == 1.60934km
# 1gallon == 3.78541L
# ∴ mile / gallon = 1.60934 / 3.78541 km / L
mpg2kpl <- function(x) x * 1.60934 / 3.78541
@nozma
nozma / file0.r
Created January 22, 2017 13:13
ggplot2で分割したグラフ毎に異なるtableGrobを書き込む ref: http://qiita.com/nozma/items/a87bbca80b77b3abd161
p <- ggplot(mpg, aes(displ, hwy)) +
geom_point() +
facet_wrap(~drv) +
theme_bw() +
theme(panel.grid = element_blank()) +
geom_smooth(method = "lm")