Skip to content

Instantly share code, notes, and snippets.

水越明哉 Akiyah

Block or report user

Report or block Akiyah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:2b08be2f562cfc6bc2fb
set.seed(0) # 同じ値を再現できるようにしておく
data <- c(
rep( 100000, 10),
rep( 10000, 100),
rep( 1000, 1000),
rep( 100, 10000),
rep( 0, 100000 - 11110)
)
@Akiyah
Akiyah / jsdoit.css
Created Jan 24, 2015
forked: PeerJS chat demo(chat-old.html)
View jsdoit.css
* {
margin: 0;
padding: 0;
border: 0;
}
body {
background: #ddd;
font: 30px sans-serif;
}
@Akiyah
Akiyah / jsdoit.css
Created Jan 24, 2015
2015-01-24 1st
View jsdoit.css
* {
margin: 0;
padding: 0;
border: 0;
}
body {
background: #ddd;
font: 30px sans-serif;
}
@Akiyah
Akiyah / function_dsl.r
Created Dec 16, 2014
jibanyan_equation_edit
View function_dsl.r
# plus
"%+%" <- function(f, g) {
return(paste0("(", f, ") * (", g,")"))
}
# minus
m <- function(f) {
paste0( "-(", f, ")" )
}
@Akiyah
Akiyah / gist:e8e0e3be7e98ae0eaabf
Created Dec 10, 2014
二項分布と正規分布とポアソン分布のずれをアニメーションにする
View gist:e8e0e3be7e98ae0eaabf
s <- 100
index_h <- 500^(((1:s)-1)/(s-1))
index <- as.integer(c(index_h, rev(index_h)))
for (i in 1:length(index)) {
png(sprintf("plot_%04d.png", i), width=500, height=500)
np <- index[i]
n <- 1000
p <- np/n
q <- 1 - p
x <- 0:n
View jibanyan_equation
jibanyan_equation <- function(x,y) {
min(max(min(1-(x/108)^2-(y/94)^2,y),min(1-((abs(x)-119)/103)^2-((y-56)/86)^2,1-((abs(x)-15)/77)^2-((y-119)/100)^2),1-((abs(x)-42)/66)^2-(y/55)^2,min(55+y,51-abs(x),-y)),3*abs(y-100)-2*(x-75)) *
min(min(max(min(1-(x/106)^2-(y/92)^2,y),min(1-((abs(x)-119)/101)^2-((y-56)/84)^2,((abs(x)-99)/40)^2+((y-54)/86)^2-1,92-abs(x)),1-((abs(x)-42)/64)^2-(y/53)^2),min(((abs(x)-52)/26)^2+((y+28)/26)^2-1,((abs(x)-51)/13)^2+(y/13)^2-1,max(abs(x)-51,y))),abs(x/51+10/51*sin(abs(y/61.2)^(1.2)*pi*(7/2)))^(2/3)+abs(y/61.2)^(2/3)-1) *
min(1-(x/32)^2-((y+30)/32)^2,1-((abs(x)+5)/22)^2-((y-18)/22)^2) *
min(1-((abs(x)-18)/20)^2-((y+10)/20)^2,((abs(x)-20)/22)^2+((y+7)/20)^2-1) *
(1-((abs(x)-51)/11)^2-(y/11)^2)
}
x <- seq(-150, 150, length=400)
z <- outer(x,x, Vectorize(jibanyan_equation))
@Akiyah
Akiyah / gist:deec63e776b23322066d
Created Nov 6, 2014
override operator "+" in R
View gist:deec63e776b23322066d
"+" <- function(e1, e2=NA) {
if (is.character(e1) & is.character(e2)) {
return(paste0(e1, e2))
}
ifelse(is.na(e2), base::"+"(e1), base::"+"(e1, e2))
}
1+2+3
#=> [1] 6
"f"+"g"+"h"
View negative_correlation.r
x <- rnorm(20)
y <- rnorm(20)
p <- -0.9
u <- x + 2
v <- p * x + sqrt(1 - p**2) * y + 2
u <- (u - min(u)) / (max(u) - min(u))
v <- (v - min(v)) / (max(v) - min(v))
@Akiyah
Akiyah / README
Last active Aug 29, 2015
forked: レイトレーシング練習
View README
todo:
* -影をぼんやりさせる-
* 押しているモノも表示する
* へこみ関数の最適化(押した感じにする)
* シワをつける(丸くする)
* -倍精度で計算する-
@Akiyah
Akiyah / jsdoit.css
Created Sep 3, 2014
forked: レイトレーシング練習
View jsdoit.css
html {
height:100%;
}
body {
background: gray;
width:100%;
height:100%;
overflow : hidden;
}
You can’t perform that action at this time.