from time import sleep
import paho.mqtt.client as mqtt
host = 'v157-7-84-147.z1d11.static.cnode.jp'
port = 1883
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --- 最上部のブロック | |
// state を変更するメソッド | |
setShouldReload = (shouldReload) => { | |
this.setState({shouldReload}) | |
} | |
// --- 左上のブロック | |
<MessageForm setShouldReload={this.setShouldReload} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/')); | |
}); |
NewerOlder