This file contains hidden or 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 node | |
// Needs `npm install yargs connect request superstatic firebase-tools` as prerequisites. | |
const stream = require('stream'); | |
const yargs = require('yargs'); | |
const connect = require('connect'); | |
const request = require('request'); | |
const superstatic = require('superstatic'); |
This file contains hidden or 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
window.addEventListener('message', function(e) { | |
const data = e.data || {}; | |
if (data.type !== 'item') | |
return; | |
const message = data.message || {}; | |
const obj = { detail: { command: message.command, body: message.body, from: message.from }}; | |
const synth = window.speechSynthesis; | |
if (obj.detail.command === 'PRIVMSG') { | |
var utter = new SpeechSynthesisUtterance(obj.detail.body); |
This file contains hidden or 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
const API_KEY = 'ここにAPIキーを貼る'; | |
const url = `https://api.apigw.smt.docomo.ne.jp/aiTalk/v1/textToSpeech?APIKEY=${API_KEY}`; | |
document.addEventListener('onEventReceived', async function(obj) { | |
if (obj.detail.command == 'PRIVMSG') { | |
play(obj.detail.body, 'maki'); | |
} | |
}); | |
async function play(text, who) { |
This file contains hidden or 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 | |
set -e | |
# PROJECT_FROM="firebase-project-from" | |
# PROJECT_TO="firebase-project-to" | |
function getParam() { | |
echo $(cat .hashParameter | grep ${1}: | sed 's/.*: \(.*\),/\1/') | |
} |
This file contains hidden or 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
(defun change-font-size (size) | |
"Change font size (clearly `:height` in `face-attribute`) to given SIZE." | |
(interactive | |
(list | |
(read-number | |
(format "Input font size (current=%d): " (face-attribute 'default :height)) | |
nil))) | |
(set-face-attribute 'default nil :height size) |
This file contains hidden or 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
module.exports = { | |
'extends': [ | |
'plugin:@typescript-eslint/recommended' | |
], | |
'plugins': ['@typescript-eslint'], | |
"parser": "@typescript-eslint/parser", | |
"parserOptions": { | |
"sourceType": "module", | |
"project": "./tsconfig.json" | |
}, |
This file contains hidden or 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 | |
set -e | |
atexit() { | |
[[ -n ${temp_file1-} ]] && rm -f "$temp_file1" | |
[[ -n ${temp_file2-} ]] && rm -f "$temp_file2" | |
} | |
trap atexit EXIT | |
trap 'rc=$?; trap - EXIT; atexit; exit $?' INT PIPE TERM |
This file contains hidden or 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
type AnyFunc = (...args: any[]) => any; | |
function wrapFuncToCode<T extends () => any>(func: T): string; | |
function wrapFuncToCode<T extends AnyFunc>(func: T, args: Parameters<T>): string; | |
function wrapFuncToCode<T extends AnyFunc>(func: T, args: any[] = []): string | |
{ | |
return `(${func.toString()}).apply(this, ${JSON.stringify(args)})`; | |
} | |
async function executeScript<T extends () => any>(tabId: number, injection: { func: T }): Promise<ReturnType<T>>; |
OlderNewer