Skip to content

Instantly share code, notes, and snippets.

View Ajido's full-sized avatar
🏠
Working from home

Daiki Kuriyama Ajido

🏠
Working from home
  • Tokyo, Japan
View GitHub Profile
const util = require('util')
const stream = require('stream')
const pipeline = util.promisify(stream.pipeline)
async function saveImage(rs, ws) {
await pipeline(rs, ws)
}
@Ajido
Ajido / script.md
Created November 26, 2019 11:38
Minimum Hands-On Node.js
const fs = require(‘fs');

fs.readFile(__filename, function(err, data) {
  console.log(data);
});
@Ajido
Ajido / tweetdeck.twitter.com.js
Last active January 8, 2017 11:58
TweetDeckにデスクトップ通知の内容を喋らせる + 通知音変更
Notification.prototype.__defineSetter__('onshow', function(callback) {
setTimeout(() => this.close(), 8000);
var speech = new SpeechSynthesisUtterance(this.body.replace(/@[a-z_]+\s?/gi, ''));
speech.lang = 'ja-JP';
speech.voice = 'Kyoko';
speechSynthesis.speak(speech);
});
$$('#update-sound source').forEach((audio) => {
// https://notificationsounds.com/terms-of-use
@Ajido
Ajido / athena.md
Last active November 26, 2019 11:47
Amazon Athena メモ

データベース作って

CREATE DATABASE s3_logs;

テーブル作って

CREATE EXTERNAL TABLE IF NOT EXISTS s3_logs.mybucket(
@Ajido
Ajido / ioredis-sample.js
Last active August 4, 2022 14:30
Node.js Redis Sentinel
'use strict';
let Redis = require('ioredis');
let redis = new Redis({
sentinels: [
{ host: '127.0.0.1', port: 15379 },
{ host: '127.0.0.1', port: 15380 },
{ host: '127.0.0.1', port: 15381 }
],
name: 'mymaster'
@Ajido
Ajido / app.js
Created August 18, 2014 15:20
nodejs express4 cluster graceful restart / shutdown
...
app.use(function(req, res, next){
if (app.get('graceful_shutdown') === true) {
res.set('Connection', 'close');
}
next();
});
app.set('graceful_shutdown_start', function() {
@Ajido
Ajido / default.rb
Created June 25, 2014 14:49
Install FFmpeg on Amazon Linux
yum_repository "atrpms" do
baseurl "http://dl.atrpms.net/el6.5-$basearch/atrpms/stable"
gpgkey "http://atrpms.net/RPM-GPG-KEY.atrpms"
enabled false
end
yum_repository "centos-base" do
baseurl "http://mirror.centos.org/centos/6.5/os/$basearch/"
gpgkey "http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6"
enabled false