Skip to content

Instantly share code, notes, and snippets.

Mikami, Takeshi takemikami

Block or report user

Report or block takemikami

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@takemikami
takemikami / sample_575
Last active Sep 7, 2019
im@sparqlのサンプルクエリ
View sample_575
PREFIX schema: <http://schema.org/>
PREFIX imas: <https://sparql.crssnky.xyz/imasrdf/URIs/imas-schema.ttl#>
SELECT (concat(group_concat(?nm1; separator=''), ' ', group_concat(?nm2; separator=''), ' ', group_concat(?nm3; separator='')) as ?h)
WHERE {
{ SELECT (1 as ?g) (?nm as ?nm1) ("" as ?nm2) ("" as ?nm3)
WHERE { ?s imas:nameKana ?nm. FILTER (strlen(str(?nm)) = 5) }
ORDER BY RAND() LIMIT 1
} UNION { SELECT (1 as ?g) ("" as ?nm1) (?nm as ?nm2) ("" as ?nm3)
WHERE { ?s imas:nameKana ?nm. FILTER (strlen(str(?nm)) = 7) }
ORDER BY RAND() LIMIT 1
@takemikami
takemikami / imasparql2atok.py
Last active Sep 3, 2019
im@sparqlからアイドルの姓名を取り出し、ATOKに単語登録するためのスクリプト
View imasparql2atok.py
# im@sparql to atok dic
# im@sparqlからアイドルの姓名を取り出し、ATOKに単語登録するためのスクリプト
#
# 登録手順:
# 1. pip install SPARQLWrapper
# 2. python imasparql2atok.py | sort | uniq | nkf -w16 -Lw > imasparql-dic.txt
# 3. atok -> 辞書ユーティリティー
# 4. ツール -> ファイルから登録削除
# 5. 単語ファイルに、imasparql-dic.txtを選択して、登録ボタンを押す
@takemikami
takemikami / parse_techbookfest_orders.py
Last active Apr 23, 2019
技術書典: 頒布物支払い状況 をCSVにする使い捨てスクリプト
View parse_techbookfest_orders.py
# 技術書典: 頒布物支払い状況 をCSVにする使い捨てスクリプト
# わたしの場合はこれでCSV変換できましたが、
# どんなパターンがあるか分からないので、変換できるかは分からないです
#
# 1. 頒布物支払い状況をChromeで開く
# 2. ファイル→ページを別名で保存
# 3. 保存したhtmlをorder.htmlに名称変更
# 4. pip install beautifulsoup4
# 5. pip install html5lib
# 6. このファイルをorder.htmlと同じディレクトリに置く
@takemikami
takemikami / basic_sample.py
Last active Apr 11, 2019
pyspark.sql code samples
View basic_sample.py
from pyspark.sql import functions as F
df = spark.createDataFrame([(1, 1.2345), (2, 9.8765)], ["col1", "col2"])
# 型のキャスト
df.select(F.col("col2").cast("int")).show()
#
# +----+
# |col2|
# +----+
@takemikami
takemikami / .gitignore
Last active Aug 27, 2018
.gitignore setting sample for JetBrains IntelliJ IDEA
View .gitignore
# ignore all idea settings
.idea/*
*.iws
*.iml
*.ipr
# gradle project minimum
!.idea/gradle.xml
!.idea/misc.xml
@takemikami
takemikami / google_checks_old.xml
Last active Feb 27, 2018
Checkstyle configuration for Gradle 4.5.1. put 'google_checks_old.xml' to 'config/checkstyle/checkstyle.xml', and run 'gradle checkstyleMain'.
View google_checks_old.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the Google coding conventions from Google Java Style
that can be found at https://google.github.io/styleguide/javaguide.html.
Checkstyle is very configurable. Be sure to read the documentation at
@takemikami
takemikami / idioms_list_dict.py
Created Jan 19, 2018
python idioms for list[dict]
View idioms_list_dict.py
sample = [
{'name': 'hoge', 'val1': 10},
{'name': 'fuga', 'val1': 30},
]
# filter #1
filter(lambda x: x['val1'] > 20, sample)
# => [{'val1': 30, 'name': 'fuga'}]
# filter #2
@takemikami
takemikami / hyperas-rl-sample.py
Created Jul 18, 2017
hyperas with keras-rl sample program
View hyperas-rl-sample.py
# sample program - hyperas with keras-rl
# see. hyperas https://github.com/maxpumperla/hyperas
# see. keras-rl https://github.com/matthiasplappert/keras-rl
from __future__ import print_function
from hyperopt import Trials, STATUS_OK, tpe
from keras.datasets import mnist
from keras.layers.core import Dense, Dropout, Activation
from keras.models import Sequential
@takemikami
takemikami / walkman_cp.py
Last active Jul 25, 2017
itunes walkman playlist sync script
View walkman_cp.py
from xml.etree.ElementTree import *
import urllib.parse
import os
import shutil
filename = "<put your itunes library dir>/iTunes Library.xml"
walkman_music_root = '/Volumes/WALKMAN/MUSIC'
# load itunes library xml
def load_ituneslib(fname):
You can’t perform that action at this time.