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
require 'rubygems' | |
require 'levenshtein' | |
require 'shellwords' | |
def similar(s1, s2, threshold = 2) | |
d = Levenshtein.distance(toKatakana(s1), toKatakana(s2)) | |
d <= threshold | |
end | |
def toKatakana(str) |
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
import java.util.Random; | |
public class RandomChars | |
{ | |
private final static String answer = "あいうえ"; | |
public static int count = 0; | |
public static void main(String[] args) | |
{ | |
char[] chars = answer.toCharArray(); |
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
answer = "ABABCD" | |
chars = answer.split('').uniq | |
str = "" | |
count = 0 | |
while not str.end_with? answer | |
count += 1 | |
c = chars.sample | |
print c | |
str += c |
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
# -*- encoding: utf-8 -*- | |
for n in 0...gets.to_i | |
print "「てら#{"あり" * n}w」" | |
end |
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
answer = "ABABCD" | |
str = "" | |
while not (print (str += answer.split('').uniq.sample)[-1] or str.end_with? answer) do end | |
puts "\ncount = #{str.length} |
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
package io.github.kazoo04.palindrome | |
import scala.annotation.tailrec | |
object NextPalindrome { | |
@tailrec | |
def next(num: Int): Int = { | |
val n = num + 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
#include <iostream> | |
#include <fstream> | |
#include <opencv2/core/core.hpp> | |
#include <opencv2/imgproc/imgproc.hpp> | |
#include <opencv2/features2d/features2d.hpp> | |
#define IMAGE_SIZE 280 | |
int main(int argc, char* argv[]) | |
{ |
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
# encoding: utf-8 | |
require 'date' | |
@dic = {'朝' => 'first', '昼' => 'second', '夜' => 'third'} | |
def meshi(str) | |
today = Date.today |
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
# encoding: utf-8 | |
dic = {'朝' => 'first', '昼' => 'second', '夜' => 'third'} | |
# キーから対応する値を取れる | |
# 逆(値からキーを取る)はできない | |
puts dic['朝'] # first | |
puts dic['昼'] # second | |
puts dic['夜'] # third |
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
# encoding: utf-8 | |
require 'date' | |
require './timer.rb' | |
@last_update = nil | |
def tweet | |
d = DateTime.now |
OlderNewer