Skip to content

Instantly share code, notes, and snippets.

@hkwi
hkwi / 日本国籍の公職.sparql
Created September 29, 2017 07:49
選挙関連
SELECT ?name WHERE {
?s wdt:P39 ?o ;
wdt:P27 wd:Q17 ;
rdfs:label ?name .
FILTER ( lang(?name)="ja" )
}
@hkwi
hkwi / example.json
Last active October 2, 2017 01:35
46回衆議院議員 popolo 仕様 json 抜粋(EveryPolitician)
{
"posts": [
],
"persons": [
{
"birth_date": "1954-09-21",
"contact_details": [
{
"type": "twitter",
"value": "AbeShinzo"
@hkwi
hkwi / prediction_example.html
Created November 19, 2017 16:58
Custom Vision Service demo
<html>
<section><input type="file" id="take-picture" accept="image/*"/></section>
<section id="prediction"></section>
<section><canvas id="draw-picture"/></section>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="http://caldwell.github.io/renderjson/renderjson.js"></script>
<script type="text/javascript">
var prediction_url = "https://southcentralus.api.cognitive.microsoft.com/customvision/v1.0/Prediction/___PUT_YOUR_URL___/image";
var prediction_key = "___PUT_YOUR_KEY___";
document.getElementById("take-picture").onchange=function(ev){
@hkwi
hkwi / README.md
Last active December 5, 2017 03:59
フェリーハッカソン 生データ

フェリーハッカソンというイベントで、DNS A record Query を crontab に登録して、RTT を取得しました。 フェリー内設置の Hypervisor 上の仮想サーバを送信元として、google public DNS に問い合わせを行っています。

ログは CSV で、フィールドは unix timestamp, rtt second, ok になっています。 ok は python script で exception が発生したかどうかですが、後から追加したので先頭のほうは欠損しています。

Sunflower Ivory の便で、弾丸フェリーのツアーです。

データのライセンスは public domain で配布します。

@hkwi
hkwi / 環境移行メモ_nz_20180301.md
Last active March 3, 2018 18:16
raspberry pi 2 から docker on raspberry pi 3 に環境を移行する

cronjob の移動

1 2 * * * sync
*/5 * * * * python3 wio_gas.py

旧環境での influxd backup

influxd backup nz_meta
influxd backup --database espr nz_espr
@hkwi
hkwi / Dockerfile
Last active April 9, 2018 08:10
mtail and python logging TimedRotatingFileHandler
FROM ubuntu
COPY . /tmp
RUN bash /tmp/build.sh
@hkwi
hkwi / README.md
Last active May 25, 2018 10:00
kube setup memo

raspbian stretch lite

sudo systemctl enable ssh
sudo systemctl disable dphys-swapfile
sudo apt-get install raspberrypi-kernel-headers

/boot/cmdline.txt に cgroup_enable=memory を追加。ls /sys/fs/cgroup で確認

@hkwi
hkwi / README.md
Last active July 28, 2020 11:12
libvirt + prometheus + grafana
@hkwi
hkwi / README.md
Created August 7, 2018 04:37
nginx + uwsgi + flask

nginx + uwsgi + flask

nginx -c /path/to/f.conf
uwsgi -s :3031 --ini-paste f.ini
@hkwi
hkwi / README.md
Last active August 10, 2018 06:48
FlameGraph memo