Skip to content

Instantly share code, notes, and snippets.

@yuzu441
yuzu441 / express-pino-logger.d.ts
Created January 18, 2019 04:17
definition express-pino-logger typed
declare module "express-pino-logger" {
import { LoggerOptions, Logger, Level } from "pino"
import { IncomingMessage, ServerResponse } from "http"
function ExpressPinoLogger(opts?: Options): HttpLogger;
export = ExpressPinoLogger;
type HttpLogger = (req: IncomingMessage, res: ServerResponse) => void;
interface Options extends LoggerOptions {
@yuzu441
yuzu441 / ormconfig.json
Created October 28, 2018 14:15
20181102発表用資料
{
"type": "mysql",
"host": "db",
"port": 3306,
"username": "root",
"password": "test",
"database": "test",
"synchronize": true,
"logging": false,
"entities": [
@yuzu441
yuzu441 / RetryPromise.js
Created April 19, 2017 14:18
雑に実装したRetryできるPromise。もうちょっと綺麗に書き直したい。。
function RetryPromise(maxRetry, interval) {
this._maxRetry = maxRetry || 3
this._interval = interval || 1000
}
RetryPromise.prototype.do = function (fn) {
var _this = this
var retryCount = 0
return new Promise(function (resolve, reject) {
(function self() {
@yuzu441
yuzu441 / zaim_bookmarklet.js
Last active June 29, 2016 12:59
zaim集計-履歴画面で範囲選択とかできるのに集計出ない不思議
(function(){
const prices = document.querySelectorAll(".list tr:not(:first-child) .price a");
sumPrice = Array.prototype.reduce.call(prices, function(a, b) {
const priceText = b.innerText;
return a + parseInt(priceText.replace(/¥|,/g,""));
},0);
alert("合計: " + sumPrice);
})();
@yuzu441
yuzu441 / gist:41c99cc196fc331fbe2a
Created December 26, 2014 02:40
android --help
Usage:
android [global options] action [action options]
Global options:
-s --silent : Silent mode, shows errors only.
-v --verbose : Verbose mode, shows errors, warnings and all messages.
--clear-cache: Clear the SDK Manager repository manifest cache.
-h --help : Help on a specific command.
Valid
actions
@yuzu441
yuzu441 / parse.php
Last active August 29, 2015 14:09
ことえり dictionary to GoogleIME dictionary
<?php
if($argc != 3) {
exit("引数の数が正しくありません".PHP_EOL
."サンプル".PHP_EOL
."php parse.php 辞書データファイル名 出力先ファイル名".PHP_EOL);
}
$xml = simplexml_load_file($argv[1]);
$outputData = "";
foreach($xml->array->dict as $item) {
@yuzu441
yuzu441 / camera.rb
Last active August 29, 2015 14:03
Ruby-Opencvを使用して、顔が検出されると音楽が流れる
require 'opencv'
include OpenCV
def play
Thread.new do
puts `afplay\ fami.mp3`
sleep 3;
$flag = false
end
end
@yuzu441
yuzu441 / get_bijintokei.rb
Last active August 29, 2015 14:02
余りにも授業が暇だったので美人さん見て暇潰そうとしたら、プログラム書くのに時間かかって授業が終わった
require 'open-uri'
require 'fileutils'
#保存する地域設定
#地域のディレクトリ名を調べて追加してください
#取得したくない地域の先頭に#を付けるとその地域を取得しない
#例(kobeを取得しない) #"kobe", という感じ
areaArr = [
"kobe",
"kyoto",
@yuzu441
yuzu441 / .bash_profile
Last active August 29, 2015 14:01
Setting java for Mac
#設定用のJAVA_HOMEを作成
export JAVA_HOME=`/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java_home -v "1.7"`
#パスに書き出す
PATH=$PATH:${JAVA_HOME}/bin
export PATH