Skip to content

Instantly share code, notes, and snippets.

@Shikugawa
Shikugawa / GeneticAlgorithm.pde
Created April 3, 2017 12:07
GeneticAlgorithm.pde
class DNA{
float[] x = new float[1000];
float[] y = new float[1000];
DNA(){
for(int i = 0; i < x.length - 1; i++){
x[i+1] += x[i] > 0 ? random(-1, 1) : random(0, 1);
y[i+1] += y[i] > 0 ? random(-1, 1) : random(0, 1);
}
}
Z <- sqrt(input$dispersion)*sqrt(-2*log(runif(sample)))*cos(2*pi*runif(sample))+input$mean
@Shikugawa
Shikugawa / ui.R
Last active July 3, 2017 01:08
正規分布シミュレータのUI部分
#
# This is the user-interface definition of a Shiny web application. You can
# run the application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
@Shikugawa
Shikugawa / server.R
Last active July 3, 2017 02:03
正規分布シミュレータのロジック部分
#
# This is the server logic of a Shiny web application. You can run the
# application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
@Shikugawa
Shikugawa / blog.py
Last active December 7, 2017 16:19
ブログ記事用
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.layers.recurrent import LSTM
from keras.utils import np_utils
from keras.callbacks import ModelCheckpoint
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
import GPy, GPyOpt
import pandas as pd
import numpy as np
from keras.models import Sequential
from keras.layers import Convolution2D, MaxPooling2D
from keras.layers import Dense, Dropout, Flatten
from keras.utils import np_utils
from keras.datasets import mnist
from keras.callbacks import TensorBoard
import keras.backend.tensorflow_backend as KTF
import tensorflow as tf
import numpy as np
@Shikugawa
Shikugawa / image2slack.js
Last active July 29, 2018 12:50
image2slack
const fs = require('fs');
const twitter = require('twitter');
const redis = require('redis');
class RedisClient {
constructor() {
this.client = redis.createClient();
this.key = "medium";
}
@Shikugawa
Shikugawa / advent_calendar.cpp
Last active December 18, 2018 09:29
アドカレ用
#include <iostream>
#include <array>
#include <cmath>
template<typename T, typename U, size_t DATA_NUM>
using dataType = std::array<std::pair<T, U>, DATA_NUM>;
template<typename Array = std::array<double, 2>>
using Array = Array;
@Shikugawa
Shikugawa / sorts.rb
Created December 25, 2018 08:25
ソート
def merge(left, right)
merged = []
first_index = 0
second_index = 0
while first_index < left.length || second_index < right.length
if first_index == left.length
merged << right[second_index]
second_index += 1
next
end
#include <bits/stdc++.h>
using namespace std;
template <class T>
class Node
{
public:
Node(T value_, Node *parent_ = nullptr) : value(value_), parent(parent_)
{