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
import sys | |
from pydub import AudioSegment, silence | |
import numpy as np | |
import matplotlib.pyplot as plt | |
SAMPLING_RATE = 44100 | |
THRESHOLD = 50 | |
CONDITION_INTERVAL = 30 | |
OFFSET = 1 |
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
import sys | |
from pydub import AudioSegment, silence | |
import numpy as np | |
import matplotlib.pyplot as plt | |
SAMPLING_RATE = 44100 | |
# THRESHOLD = 50 | |
# CONDITION_INTERVAL = 100 | |
THRESHOLD = 50 | |
CONDITION_INTERVAL = 30 |
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
#!/usr/bin/env python | |
import requests | |
import json | |
import base64 | |
URL = 'http://rospeex.ucri.jgn-x.jp/nauth_json/jsServices/VoiceTraSS' | |
def post(text): | |
params = json.dumps({'method': 'speak', 'params': ['ja', text, '*', 'audio/x-wav']}) | |
return requests.post(URL, data = params) |
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
;;; 括弧の後のインデントが深くなるのを防ぐ | |
(setq ruby-deep-indent-paren-style nil) | |
;;; save前に行末のwhitespaceを削除 | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) |
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 | |
cat $1 | while read LINE; do | |
echo $LINE | tr ' ' '\n' | uniq | tr '\n' ' '; echo | |
done |
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
#!/usr/bin/env python | |
# -*- coding:utf-8 -*- | |
import sys | |
import numpy as np | |
from scipy.interpolate import interp1d | |
# from scipy.interpolate import UnivariateSpline | |
def read_csv2(data): | |
x = data[:, 1] |
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
#!/usr/bin/env python | |
import sys | |
import numpy as np | |
import numpy.random as random | |
import scipy.stats as stats | |
import matplotlib.pyplot as plt | |
if __name__ == '__main__': | |
if len(sys.argv) < 2: | |
print "usage: $ ./gem_dist.py alpha" |
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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
require 'pit' | |
require 'twitter_oauth' | |
def convert_row(semivowel, roman, step) | |
head = semivowel.unpack("U*")[0] | |
(0..4).map{|i| [[head + step * i].pack("U*"), roman + %w(a i u e o)[i]]} | |
end |
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
#!/usr/bin/env python | |
import sys | |
import csv | |
import os | |
if __name__ == '__main__': | |
data = [[i if i == j else 0 for i in range(5)] for j in range(5)] | |
# => [[0, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 2, 0, 0], [0, 0, 0, 3, 0], [0, 0, 0, 0, 4]] | |
# dialect = 'excel' | |
# csv.writer(sys.stdout).writerows(data) |
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
#!/usr/bin/env python | |
import sys | |
from itertools import count, cycle, izip, imap | |
map(sys.stdout.write, ((str(n), "Fizz", "Buzz", "FizzBuzz")[f] + "\n" for n, f in izip(count(1), imap(sum, izip(cycle((0, 0, 1)), cycle((0, 0, 0, 0, 2))))))) |
NewerOlder