Skip to content

Instantly share code, notes, and snippets.

View nginx-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
@bathtimefish
bathtimefish / get_sliding_window.py
Last active Jan 8, 2019
配列からスライス窓を生成する
View get_sliding_window.py
import numpy as np
def getSlidingWindow(a, size, step=1):
if not ((type(size) == type(0)) and (type(step) == type(0))):
raise Exception("type(size) and type(step) must be int.")
if step > size:
raise Exception("step must not be larger than size.")
if size > len(a):
raise Exception("size must not be larger than array length.")
a = np.asarray(a)
View sendmail_when_webpageopened.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF8">
<title>Send mail when webpage opened</title>
</head>
<body>
<script>
window.onload = function() {
var event_name = 'webpage_opened';
View nodejs-ibeacon-example.js
var bleacon = require('bleacon');
var uuidSeed = 'e279e48e-5b42-401d-b3ac-8289017070e6';
var uuid = uuidSeed.replace(/-/g,'');
var major = 0;
var minor = 0;
var measuredPower = -59;
console.log('Start iBeacon...');
bleacon.startAdvertising(uuid, major, minor, measuredPower);
View radiobutton-checker-example.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Radio button example</title>
</head>
<body>
<form id="form1">
<div>
<input type="radio" name="target" value="1" onchange="handler()">
@bathtimefish
bathtimefish / file0.txt
Last active Aug 4, 2018
restify + TypeScript + Jestの開発環境をセットアップしてみる ref: https://qiita.com/bathtimefish/items/82f886f6d2353af14e7a
View file0.txt
npm i -g typescript webpack webpack-cli
@bathtimefish
bathtimefish / espruino-pico-puressure-sensor.js
Created Oct 30, 2017
Espruino Picoで圧力センサーの値を取得する
View espruino-pico-puressure-sensor.js
var i = setInterval(function() {
var val = analogRead(B1);
console.log(val); //圧力センサーの値
if(val < 0.5) { //値が0.5以下になるとLEDが点灯する
digitalWrite(A8, 1);
} else {
digitalWrite(A8, 0);
}
}, 100);
@bathtimefish
bathtimefish / dqn.py
Last active Mar 5, 2017
DQNをKerasとTensorFlowとOpenAI Gymで実装する https://elix-tech.github.io/ja/2016/06/29/dqn-ja.html のプログラムをPython3.5 & TensorFlow 1.0で動くように修正したやつ
View dqn.py
# coding:utf-8
import os
import gym
import random
import numpy as np
import tensorflow as tf
from collections import deque
from skimage.color import rgb2gray
from skimage.transform import resize
@bathtimefish
bathtimefish / app.js
Created Aug 27, 2016
ChirimenでHTTPリクエストするサンプル
View app.js
/**
*
* Chirimenに装着するWifiドングルは Planex GW-USNano2 動作確認済み
* https://www.planex.co.jp/product/wireless/gw-usnano2/
*
* WifiドングルをつけてChirimenを起動、SettingsでWifi設定を完了後、以下のソースを実行する
*
*/
window.addEventListener("load", function() {
@bathtimefish
bathtimefish / chirimen-motion-led-index.html
Created Aug 19, 2016
CHIRIMENで人感センサー検知LEDなサンプル
View chirimen-motion-led-index.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
<title>Motion Sensor</title>
<!-- https://github.com/club-wot/WebGPIO -->
<script src="./bower_components/webgpio/dist/webgpio.js"></script>
<!-- https://github.com/mozilla/task.js/blob/master/lib/task.js -->
You can’t perform that action at this time.