Skip to content

Instantly share code, notes, and snippets.

View iktakahiro's full-sized avatar

Takahiro Ikeuchi iktakahiro

View GitHub Profile
@iktakahiro
iktakahiro / server4spa.py
Last active January 28, 2024 13:08
Python3 http.server for Single Page Application
#!/usr/bin/env python
# Inspired by https://gist.github.com/jtangelder/e445e9a7f5e31c220be6
# Python3 http.server for Single Page Application
import urllib.parse
import http.server
import socketserver
import re
from pathlib import Path

Publisher

送信

from time import sleep
import paho.mqtt.client as mqtt

host = 'v157-7-84-147.z1d11.static.cnode.jp'
port = 1883
@iktakahiro
iktakahiro / .gitlab-ci.yml
Created February 8, 2020 10:48
[WIP] Use Poetry on GitLab CI
image: python:3.7
before_script:
- curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
- export PATH="$PATH:$HOME/.poetry/bin/"
- source $HOME/.poetry/env
- poetry install
- source `poetry env info --path`/bin/activate
build:
@iktakahiro
iktakahiro / sample.py
Created March 10, 2016 04:40
matplotlib with Japanese font
plt.style.use('ggplot')
from matplotlib.font_manager import FontProperties
from matplotlib import rcParams
# フォントパスを指定 .ttf 形式でないと駄目な模様, 関連:https://github.com/matplotlib/matplotlib/pull/3912
fp = FontProperties(fname='/Library/Fonts/Osaka.ttf', size=14)
# get_name() で 'Osaka' が返ってきています。メソッドの代わりに = 'Osaka' としてもOK
rcParams['font.family'] = fp.get_name()
class Book:
def __init__(self, id: str, title: str):
self.id: str = id
self.title: str = title
def __eq__(self, o: object) -> bool:
if isinstance(o, Book):
return self.id == o.id
return False
@iktakahiro
iktakahiro / neumorphic_card.dart
Created January 30, 2020 02:58
Neumorphic Card on Flutter
import 'package:flutter/material.dart';
class NeumorphicCard extends StatelessWidget {
const NeumorphicCard({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: 200,
width: 200,
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="100dp"
android:layout_height="100dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".MainActivity"
tools:showIn="@layout/first_widget">
<TextView
@iktakahiro
iktakahiro / kustomization.yml
Last active January 17, 2019 18:21
exampleSecretGenerator
secretGenerator:
- commands:
pgHost: bash -euc 'echo -n "$PG_HOST"'
pgPassword: bash -euc 'echo -n "$PG_PASSWORD"'
pgUser: bash -euc 'echo -n "$PG_USER"'
name: api-secret
## output-example
##
## apiVersion: v1
// --- 最上部のブロック
// state を変更するメソッド
setShouldReload = (shouldReload) => {
this.setState({shouldReload})
}
// --- 左上のブロック
<MessageForm setShouldReload={this.setShouldReload} />
@iktakahiro
iktakahiro / file0.js
Last active September 25, 2017 09:28
gulp-ejs 2.0.0 で .html ファイルを出力する場合拡張子の指定が必須に ref: http://qiita.com/iktakahiro/items/5a6228a880a0a1321a39
import ejs from 'gulp-ejs';
gulp.task('ejs', () => {
var json = JSON.parse(fs.readFileSync("./src/html/_layout/var.json"));
gulp.src(['./src/html/_page/**/*.ejs'])
.pipe(ejs(json, {"ext": ".html"})) // "ext" の値を指定
.pipe(gulp.dest('./dist/html/'));
});