Skip to content

Instantly share code, notes, and snippets.

View akehoyayoi's full-sized avatar

Yohei Okaya akehoyayoi

View GitHub Profile
@akehoyayoi
akehoyayoi / FibTest.scala
Created March 11, 2017 02:56
Fibonacci Test
import scala.collection.mutable
/**
* Created by okayayohei on 2017/03/11.
*/
object Main {
trait Fib {
def fib(n: Long): Long
}
@akehoyayoi
akehoyayoi / file0.txt
Last active January 7, 2017 08:20
MySQLでのSpatialIndexの効かし方 ref: http://qiita.com/akehoyayoi@github/items/1cc7d5bf5b8a922aa5d9
mysql> desc shop;
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| name | varchar(100) | NO | | NULL | |
| address | varchar(100) | NO | | NULL | |
| lnglat | geometry | NO | MUL | NULL | |
+---------+--------------+------+-----+---------+-------+
3 rows in set (0.04 sec)
@akehoyayoi
akehoyayoi / file0.txt
Last active December 20, 2016 04:50
gvmでv1.4がinstallできない時の対処方法 ref: http://qiita.com/akehoyayoi@github/items/1046fb0290c976b7ad0d
gvm install go1.4
gvm use go1.4
gvm install go1.5
@akehoyayoi
akehoyayoi / file0.txt
Created August 25, 2016 07:57
Firebaseの設定ファイルをスキーマ毎に切り替える ref: http://qiita.com/akehoyayoi@github/items/ca1eea9605642e288664
#if PRODUCTION
let filePath = NSBundle.mainBundle().pathForResource("GoogleService-Info-pro", ofType: "plist")
#elseif STAGING
let filePath = NSBundle.mainBundle().pathForResource("GoogleService-Info-stg", ofType: "plist")
#else
let filePath = NSBundle.mainBundle().pathForResource("GoogleService-Info-dev", ofType: "plist")
#endif
let firebaseOption = FIROptions(contentsOfFile: filePath)
FIRApp.configureWithOptions(firebaseOption)
@akehoyayoi
akehoyayoi / gist:6102407
Created July 29, 2013 06:05
json4s(lift-json)がバグってる件
// "org.json4s" %% "json4s-native" % "3.2.4"
import org.json4s._
import org.json4s.native.Serialization._
case class AAA(a : Option[Long],b : Option[Long],c : Option[Long])
object JsonTest {
def toJson[Value <: AnyRef](any : Value) : String = {
write(any)(DefaultFormats)
@akehoyayoi
akehoyayoi / dynamoTest.py
Last active October 26, 2015 08:41
AWS LambdaのDynamoサンプルコード
# APIGateway + Lambda + DynamoDB
# sample query
# {"tableName":"performance_test","operation":"read","payload": {"test_id":"aaaaaaa"}}
# {"tableName":"performance_test","operation":"delete","payload": {"test_id":"aaaaaaa"}}
# {"tableName":"performance_test","operation":"create","payload": {"test_id":"aaaaaaa","value":"aaaaaaaaa"}}
import boto3
import json
print('Loading function')
@akehoyayoi
akehoyayoi / convert_ddl_from_sqlserver_to_mysql.rb
Created September 17, 2015 00:47
convert ddl from sqlserver to mysql
def convertLine(line)
# 可読性のため一次変数に受ける
result = line.gsub("]","").gsub("[","").gsub("UNIQUEIDENTIFIER","NVARCHAR (38)")
result = result.gsub("NVARCHAR \(MAX\)","NVARCHAR \(256\)")
result.gsub("DATETIMEOFFSET (7)","TIMESTAMP").gsub("sys.geography","geometry")
end
def convertDDL(path)
@inDDL = false
@isGEO = false
@akehoyayoi
akehoyayoi / convert_data_from_sqlserver_to_mysql.rb
Created September 17, 2015 00:44
convert data from SQLServer to MySQL
def convertLine(line)
line = line.gsub("]","").gsub("[","")
line = line.gsub(" +09:00","")
# 変換候補文字列を抽出
# ex. N'POINT (0 0)' -> GeomFromText('POINT (0 0)')
points = line.scan(/N'POINT \(.+?\)'/)
points.each do |point|
line = line.gsub(point,point.gsub("N'","GeomFromText('").gsub(")'",")')"))
end
line + ";"
@akehoyayoi
akehoyayoi / convert.sh
Last active August 29, 2015 14:28
from *.png to *.pvr
for i in *.png ; do /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool -e PVRTC --bits-per-pixel-4 -o "${i%.png}.pvr}" -f PVR $i ; done
@akehoyayoi
akehoyayoi / Program.cs
Last active August 29, 2015 14:26
Guidの部分文字列が被るかどうかのテスト(コンソールアプリ)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{