Skip to content

Instantly share code, notes, and snippets.

@Shikugawa
Shikugawa / progress_bar.cpp
Created December 15, 2019 15:18
マルチスレッドな進捗バー
#include <iostream>
#include <string>
#include <thread>
#include <atomic>
#include <unistd.h>
#include <mutex>
std::atomic<bool> end_flag = false;
std::atomic<bool> out_flag = false;
std::atomic<double> current_time = 0;
#include <bits/stdc++.h>
using namespace std;
template <class T>
class Node
{
public:
Node(T value_, Node *parent_ = nullptr) : value(value_), parent(parent_)
{
@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
@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 / 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";
}
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 / 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
@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 / 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)
Z <- sqrt(input$dispersion)*sqrt(-2*log(runif(sample)))*cos(2*pi*runif(sample))+input$mean