Skip to content

Instantly share code, notes, and snippets.

View taisyo7333's full-sized avatar

Daisuke Inoue taisyo7333

View GitHub Profile
@taisyo7333
taisyo7333 / memo.md
Created October 31, 2016 01:43
Mac 設定
@taisyo7333
taisyo7333 / memo.md
Last active October 28, 2016 07:16
Nginx SSL設定

Nginx のconfファイルでの設定

ssl_session_tickets というものがありDefaultはON;

ONの場合に考慮すること

Nginx が複数台構成になっている場合を考慮する必要がある。 特に複数のNginxでチケットを共有する場合 AWSなどでオートスケールアウトを考慮するとしたら、2台以上になったら挙動が変になる可能性が出てくる。 下記のディレクティブを設定必要

@taisyo7333
taisyo7333 / memo.md
Last active October 28, 2016 03:51
Ruby (rails) + Redis

Initializers

# config/initializers/redis.rb
Redis.current = Redis.new(:url => ENV['REDIS_URL'])

docker-compose.yml

 web:
@taisyo7333
taisyo7333 / memo.md
Last active October 28, 2016 01:51
Mac httperf

http://macappstore.org/httperf/

mac httperf は homebrewでインストールできる

ただし、あまり接続数などに大きい数値を割り当てられない。 エラーになる

ulimit -n の上限も10000くらいが上限っぽい。 これの数値がFD_SETSIZEのようだ。

@taisyo7333
taisyo7333 / memo.md
Last active October 27, 2016 01:42
Docker 作業メモ : could not translate host name "db" to address: Name or service not known

Issue - 1

docker-compose run web rake db:create とコマンドを打ったら、下記のエラーが出てこまった件

could not translate host name "db" to address: Name or service not known

調査したところ。。。

$ docker-compose build

@taisyo7333
taisyo7333 / output.log
Last active October 26, 2016 00:19
C++ split : Code Interview
#include<iostream>
#include<string>
#include<vector>
/*
“If developers want their applications to make it into Google’s app store, Google Play, they have to make sure they adhere to the company’s policies. Google has policies on restricted content, intellectual property, privacy, security, ads, promotion, age-appropriate content, and updates. Violating any one of those policies could cause an app to be suspended or rejected.”
This text is refered to SD Times.(http://sdtimes.com/)
上記の問題を単語ごとにわけて出力せよ。
ただし、splitは仕様禁止
@taisyo7333
taisyo7333 / insert_sort.c
Created October 23, 2016 01:03
Language C : Insert Sort
#include<stdio.h>
#include<stdlib.h>
#define DATA_NUM 10
void InsertSort(int data[], int data_num)
{
for (int pos = 1; pos < data_num; ++pos)
{
int ins_pos = pos;
@taisyo7333
taisyo7333 / factorial.cpp
Last active October 22, 2016 11:46
C++ Factorial loop recursion
#include<iostream>
int RecursiveFactorial(int number)
{
if (number < 0) throw std::invalid_argument("Negative number is not allowed.");
if (number == 0) return 1;
return number * RecursiveFactorial(number - 1);
}
int LoopedFactorial(int number)
@taisyo7333
taisyo7333 / bubble_sort.cpp
Last active October 22, 2016 14:19
C++ : Bubble Sort
#include<vector>
#include<iostream>
#include<utility> // from C++11
std::vector<int> bubble_sort(const std::vector<int>& input)
{
std::vector<int> work(input);
for (int i = work.size() - 1; i >= 0; i--) {
for (int j = 0; j < i; j++) {