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
var usb = require('usb'); | |
var fs = require('fs'); | |
var readline = require('readline'); | |
var google = require('googleapis'); | |
var googleAuth = require('google-auth-library'); | |
// const | |
var USBRQ_HID_SET_REPORT = 0x09; | |
var USB_HID_REPORT_TYPE_FEATURE = 0x03; |
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
#include <ESP8266WiFi.h> | |
#include <ESP8266WebServer.h> | |
#include <WiFiUdp.h> | |
// time | |
uint64_t epoch = 0; | |
const char timeZoneName[] = "Asia/Tokyo"; | |
const int16_t timeZoneOffsetMinutes = 9 * 60; | |
// connection info |
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
(function () { | |
'use strict'; | |
/* | |
* Utils | |
*/ | |
// iteration | |
// https://gist.github.com/a-c-t-i-n-i-u-m/8a331f807d0329c66c5d | |
var each = function (obj, callback, thisArg) { | |
if (!obj || typeof callback !== 'function') return; | |
thisArg = arguments.length === 3 ? thisArg : obj; |
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
// polyfill/alternative method for iteration | |
// - breakable when callback 'return false;', quit iteration immediately. | |
// - capable only depends on numerical 'length' property, or iterate with keys. | |
// - flexible third argument 'thisArg' and return value | |
// make you possible to write efficient code with this method. | |
// - | |
var each = function (obj, callback, thisArg) { | |
// check object, callback function | |
if (!obj || typeof callback !== 'function') { | |
return; |
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
// obj clone | |
var clone = function(o) { | |
switch (Object.prototype.toString.call(o)) { | |
// if primitive types | |
case '[object Undefined]': | |
case '[object Null]': | |
case '[object Boolean]': | |
case '[object Number]': | |
case '[object String]': | |
case '[object Symbol]': |
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
(function () { | |
// interface | |
var ajax = function (args) { | |
return new ajaxObject(args); | |
}; | |
// object | |
var ajaxObject = function (args) { | |
// init | |
this.request = new XMLHttpRequest(); |
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
(function () { | |
// escape function | |
var escape = function (s) { | |
return (s || '').toString() | |
.replace(/&/g, '&') | |
.replace(/</g, '<') | |
.replace(/>/g, '>') | |
.replace(/"/g, '"') | |
.replace(/'/g, '''); | |
}; |
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
/* | |
* how to use: | |
* fn: filterEventHandler(selector, callback) | |
* selector: selector for querySelectorAll, filtering event source, like jQuery.on(event, selector, callback) | |
* callback: event handler function | |
* returns: filtering function which contains reference of your callback | |
* | |
* code: | |
* element.addEventListener('eventname', filterEventHandler('.filter[selector*="for querySelectorAll"]', function (e) { | |
* // this code will be called only when element matched to selector |
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
/** | |
* recpt1 http serverをtvtest BonDriver_HTTP.dllをつかって起動/停止する | |
* 目的:少ないチューナーをtvtestで見るときだけ占有するようにして精神的安定感を得る | |
* | |
* $ nohup node recpt1-http-manager.js > /dev/null 2>&1 & | |
* | |
* などでこのスクリプトを起動しておき、BonDriver_HTTP.iniに | |
* | |
* NAME_n="起動" | |
* HOST_n="[server IP address]" |
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
#!/bin/bash | |
# settings | |
# Login information of freenom.com | |
freenom_email="main@address" | |
freenom_passwd="pswd" | |
# Open DNS management page in your browser. | |
# URL vs settings: | |
# https://my.freenom.com/clientarea.php?managedns={freenom_domain_name}&domainid={freenom_domain_id} | |
freenom_domain_name="domain.name" |
NewerOlder