Skip to content

Instantly share code, notes, and snippets.

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

Ishida Yuya quiye

🏠
Working from home
  • LY Corporation
  • Kanagawa, Japan
  • 12:40 (UTC +09:00)
View GitHub Profile
@quiye
quiye / hoge.html
Created October 16, 2017 15:20
chart.jsで横の積み重ねの練習
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.js"></script>
<p>
@quiye
quiye / face.zshrc
Created November 5, 2017 21:31
promptに顔文字
PROMPT="%(?.%{${fg[green]}%}😉.%{${fg[white]}%}%{${bg[red]}%}😨)[%n@%m]%(?.😉%{${reset_color}%} %~.😨 %~%{${reset_color}%})
%# "
@quiye
quiye / average.py
Last active February 12, 2018 12:54
平均を0にする正規化のやり方
import numpy as np
from numpy.random import *
m = 5
n = 3
a = rand(m,n)
v = np.full((n,n),1)
u = np.full((m,m),1)
print('a => 入力の行列')
print(a)
@quiye
quiye / pipeline.scala
Last active February 18, 2018 13:21
scalaでパイプライン演算子(repl (amm) )
@ val nijo = (x:Int) => x*x
nijo: Int => Int = ammonite.$sess.cmd2$$$Lambda$1945/330224683@51ed2f68
@ val minus10 = (x:Int) => x-10
minus10: Int => Int = ammonite.$sess.cmd3$$$Lambda$1949/497232815@a80a896
@ 4 |> nijo |> minus10
res4: Int = 6
@ val hoge = 4 |> nijo |> minus10
@quiye
quiye / odict.py
Last active February 26, 2018 13:48
OrderedDictの継承
# -*- coding: utf-8 -*-
num=0
from collections import OrderedDict
class TestExtends(OrderedDict):
def __init__(self):
OrderedDict.__init__(self)
def append(self,key,value):
global num
self[key]=value
@quiye
quiye / a.scala
Created March 4, 2018 01:40
自分自身を出力するscalaスクリプト
import scala.io.Source
for (line <- Source.fromFile("a.scala").getLines())
println(line)
#include<iostream>
#include<fstream>
#include<sstream>
#include <k2hash/k2hash.h>
#include <k2hash/k2hshm.h>
using namespace std;
int main(){
K2HShm k;
cout << k.GetSystemPageSize() << endl;
@quiye
quiye / Type.md
Last active March 22, 2018 14:56
scala練習

キャストは慎重に

scala> val a: Any = List(1,2,3)
a: Any = List(1, 2, 3)

scala> val d=a.asInstanceOf[List[Long]]
d: List[Long] = List(1, 2, 3)

scala> val e=a.asInstanceOf[List[Int]].map(_.toLong)
e: List[Long] = List(1, 2, 3)
@quiye
quiye / ByteArrayToFloatList.scala
Created April 11, 2018 13:34
4bytes => Float
scala> import java.nio.ByteBuffer
import java.nio.ByteBuffer
scala> val b = Array(1,2,3,4,5,6,7,8,0,0,0,0).map(_.toByte)
b: Array[Byte] = Array(1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0)
scala> b.grouped(4).foldRight(Nil: List[Float])(ByteBuffer.wrap(_).getFloat::_)
res8: List[Float] = List(2.3879393E-38, 6.301941E-36, 0.0)
@quiye
quiye / k2HASHSample.cpp
Created April 11, 2018 22:09
K2HASHの使用デモ
#include <fstream>
#include <iostream>
#include <k2hash/k2hash.h>
#include <k2hash/k2hshm.h>
#include <sstream>
using namespace std;
int main() {
K2HShm k;
cout << k.GetSystemPageSize() << endl;