[y-ito@workspace ~]$ cat test.py
class Order():
def __init__(self, name, campaigns=[]):
self.name = name
self.campaigns = campaigns
def add(self,c):
import numpy as np | |
import pandas as pd | |
np.random.seed(1234) | |
start_date = "2017-07-01" | |
end_date = "2017-07-02" | |
_date_range = pd.date_range(start_date, end_date, freq="H") | |
_size = _date_range.shape[0] |
# https://docs.python.org/3.5/library/types.html | |
from types import MethodType | |
class Base(object): | |
def __init__(self, **kwargs): | |
self.__dict__.update(kwargs) | |
def add_instance_method(self, method): | |
setattr(self, method.__name__, MethodType(method, self)) | |
[y-ito@workspace ~]$ cat test.py
class Order():
def __init__(self, name, campaigns=[]):
self.name = name
self.campaigns = campaigns
def add(self,c):
from centos:6 | |
RUN yum install -y vim git wget tar | |
# useradd | |
RUN useradd -m y-ito \ | |
&& echo "y-ito ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ | |
&& echo 'y-ito:y-ito' | chpasswd | |
# Golang (1.6.3) | |
USER root |
puts "start!" | |
bar ="->" | |
(1..5).each { | |
print "\r#{bar}" | |
sleep 0.5 | |
bar = "-"+bar | |
} | |
puts "\nend!" |
library("magrittr") | |
library("dplyr") | |
data(Titanic) | |
t <- Titanic %>% as.data.frame %>% arrange(Survived,Class,Sex,Age) | |
t %>% | |
group_by(Survived) %>% | |
summarize(ClassCount=sum(Freq)) %>% | |
group_by %>% |
# rcpp sandbox | |
gibbs_r <- function(n,thin){ | |
# R実装のギブスサンプラー | |
mat <- matrix(0,nrow=n,ncol=2) | |
x <- 0 | |
y <- 0 | |
for(i in 1:n){ | |
for(j in 1:thin){ | |
x <- rgamma(1, 3, 1/(y*y+4) ) |
library("ggplot2") | |
library("magrittr") | |
library("dplyr") | |
# midori 8 | |
# http://hosho.ees.hokudai.ac.jp/~kubo/ce/IwanamiBook.html | |
data <- c(4,3,4,5,5,2,3,1,4,0,1,5,5,6,5,4,4,5,3,4) | |
hist(data) | |
loglik <- function(q){ |