Skip to content

Instantly share code, notes, and snippets.

View nginx-deployment.yaml
apiVersion: apps/v1
kind: Deployment
name: nginx
app: nginx
replicas: 2
bathtimefish /
Last active Jan 8, 2019
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>
<meta charset="UTF8">
<title>Send mail when webpage opened</title>
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>
<meta charset="UTF-8">
<title>Radio button example</title>
<form id="form1">
<input type="radio" name="target" value="1" onchange="handler()">
bathtimefish / file0.txt
Last active Aug 4, 2018
restify + TypeScript + Jestの開発環境をセットアップしてみる ref:
View file0.txt
npm i -g typescript webpack webpack-cli
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 /
Last active Mar 5, 2017
DQNをKerasとTensorFlowとOpenAI Gymで実装する のプログラムをPython3.5 & TensorFlow 1.0で動くように修正したやつ
# 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 / app.js
Created Aug 27, 2016
View app.js
* Chirimenに装着するWifiドングルは Planex GW-USNano2 動作確認済み
* WifiドングルをつけてChirimenを起動、SettingsでWifi設定を完了後、以下のソースを実行する
window.addEventListener("load", function() {
bathtimefish / chirimen-motion-led-index.html
Created Aug 19, 2016
View chirimen-motion-led-index.html
<!doctype html>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
<title>Motion Sensor</title>
<!-- -->
<script src="./bower_components/webgpio/dist/webgpio.js"></script>
<!-- -->
You can’t perform that action at this time.