Skip to content

Instantly share code, notes, and snippets.

@shunsukeaihara
shunsukeaihara / .eslintignore
Last active June 1, 2019 10:37
vscode +eslint + prettier + react-native + typescriptの設定群. vscodeにはeslintとprettierだけを入れる. このあたり標準決めて欲しい
node_modules/
@shunsukeaihara
shunsukeaihara / to_elasticsearch.js
Last active June 15, 2020 03:48
lambda script for kinesis firehose with cloudwatch logs
'use strict';
const zlib = require('zlib');
const AWS = require('aws-sdk');
function transformLogEvent(payload, logEvent) {
var source = buildSource(logEvent.message, logEvent.extractedFields);
source['@id'] = logEvent.id;
source['@timestamp'] = new Date(1 * logEvent.timestamp).toISOString();
source['@message'] = logEvent.message;
@shunsukeaihara
shunsukeaihara / upsampling.ipynb
Last active September 15, 2018 11:46
upsampling with biquad low-pass filter
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shunsukeaihara
shunsukeaihara / estimate_alpha.pyx
Last active August 29, 2015 14:27
cython translation of the estimating alpha parameter for mel-cepstrum in go (https://bitbucket.org/happyalu/mcep_alpha_calc)
# -*- coding: utf-8 -*-
# distutils: language = c++
import numpy as np
cimport numpy as np
cimport cython
from libc.stdlib cimport malloc, free
from libc.math cimport log, M_PI, sin, cos, atan
from libc.float cimport DBL_MAX
@shunsukeaihara
shunsukeaihara / gist:eec6bb9e6f721dbd9c61
Last active August 29, 2015 14:25
Global contrast based salient region detectionをベースにいろいろいじったり
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# (WIP)画像から主題っぽい領域を判定"
]
},
{
@shunsukeaihara
shunsukeaihara / salient region detection.ipynb
Last active August 29, 2015 14:23
salient region detection from superpixles
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shunsukeaihara
shunsukeaihara / main.go
Last active December 20, 2018 09:09
long poll chat server in go and redis
// chatserver project main.go
package main
import (
"encoding/json"
"flag"
"fmt"
"github.com/golang/glog"
"github.com/zenazn/goji"
"github.com/zenazn/goji/web"
@shunsukeaihara
shunsukeaihara / blog.ipynb
Last active August 29, 2015 14:03
IPython Notebookをアドホック分析環境として使う
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shunsukeaihara
shunsukeaihara / changefinder.py
Last active August 14, 2023 06:28
Change finder algorithm
# -*- coding: utf-8 -*-
import numpy as np
import math
def LevinsonDurbin(r, lpcOrder):
"""
from http://aidiary.hatenablog.com/entry/20120415/1334458954
"""
a = np.zeros(lpcOrder + 1,dtype=np.float64)
@shunsukeaihara
shunsukeaihara / crawl.py
Last active April 22, 2016 10:42
rongorongoのThomas Barthel's Transliteration Systemのデータをクローリングしてファイルに保存したり、文字の正規化や分解を行うスクリプト。詳細は以下 http://argmax.jp/index.php?ron
# -*- coding: utf-8 -*-
from BeautifulSoup import BeautifulSoup
import urllib2
import re
URL = "http://kohaumotu.org/rongorongo_org/translit/%s.html"
for i in range(97,123):
url = URL % chr(i)
html = urllib2.urlopen(url).read()