Skip to content

Instantly share code, notes, and snippets.

View nownabe's full-sized avatar
💪
Yeah!!

Shogo Watanabe nownabe

💪
Yeah!!
View GitHub Profile
@nownabe
nownabe / .commit_template
Created July 5, 2016 06:54
Emojiで楽しく綺麗なコミットを手に入れる
# ==== Emojis ====
# 🐛 :bug: バグ修正
# 👍 :+1: 機能改善
# ✨ :sparkles: 部分的な機能追加
# 🎉 :tada: 盛大に祝うべき大きな機能追加
# ♻️ :recycle: リファクタリング
# 🚿 :shower: 不要な機能・使われなくなった機能の削除
# 💚 :green_heart: テストやCIの修正・改善
@nownabe
nownabe / detect_invalid_certificate.rb
Created March 30, 2016 01:17
Detect valid or invalid certificate
require "openssl"
pem = DATA.read
begin
OpenSSL::X509::Certificate.new(pem)
puts "Valid!"
rescue
puts "Invalid!"
end
@nownabe
nownabe / sleep_server.rb
Last active March 29, 2016 09:22
Simple Sleep Web Server
#!/usr/bin/env ruby
#
# Usage:
# ruby sleep_server.rb [options]
#
# Options:
# -p port (default: 80)
# -b bind_address (default: 0.0.0.0)
# -s sleep_seconds (default: 5)
@nownabe
nownabe / test_spec.rb
Created March 2, 2016 00:47
Defference between allow_any_instance_of and expect_any_instance_of
class SomeClass
def greet
"Hello."
end
end
describe "allow_any_instance_of" do
before { allow_any_instance_of(SomeClass).to receive(:greet).and_call_original }
context "when calling Command#greet" do
it "pass the test" do
yum install -y httpd mariadb-server mariadb-devel php-mysql php php-gd php-mbstring
curl -O https://ja.wordpress.org/wordpress-4.1.1-ja.tar.gz
tar zxf wordpress-4.1.1-ja.tar.gz -C /var/www/html
chown -R apache. /var/www/html/wordpress
systemctl start httpd
systemctl start mariadb
mysql -uroot -e 'create database wordpress'
#!/usr/bin/bash
set -eux
sudo yum install -y gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel
git clone https://github.com/riywo/anyenv ~/.anyenv
echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(anyenv init -)"' >> ~/.bashrc
source ~/.bashrc
mkdir ~/.anyenv/plugins
git clone https://github.com/znz/anyenv-update.git ~/.anyenv/plugins/anyenv-update
#!/bin/bash
set -eux
yum install -y gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel
git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv
git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build
cat <<EOF > /etc/profile.d/rbenv.sh
export RBENV_ROOT="/usr/local/rbenv"
export PATH="\${RBENV_ROOT}/bin:\${PATH}"
@nownabe
nownabe / Vagrantfile
Last active April 29, 2019 16:11
Vagrantfile for Percona XtraDB Cluster on CentOS 7
# -*- mode: ruby -*-
# vi: set ft=ruby :
PXC_CLUSTER_SIZE = 3
IP = "10.6.3.%d"
Vagrant.configure(2) do |config|
config.vm.box = "centos7"
config.vm.box_url = "https://f0fff3908f081cb6461b407be80daf97f07ac418.googledrive.com/host/0BwtuV7VyVTSkUG1PM3pCeDJ4dVE/centos7.box"
@nownabe
nownabe / Vagrantfile
Last active August 29, 2015 14:06
Percona ExtraDB Cluster
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "cent65"
config.vm.network "public_network", ip: "192.168.0.31", bridge: "Qualcomm Atheros AR8161/8165 PCI-E Gigabit Ethernet Controller (NDIS 6.20)"
config.vm.provider "virtualbox" do |vb|
@nownabe
nownabe / file0.txt
Last active August 29, 2015 14:05
Apacheのチューニングメモ ref: http://qiita.com/nownabe/items/1111cc32da9fe63289f0
StartServers 500
MaxClients 500
MinSpareServers 500
MaxSpareServers 500
ServerLimit 500
MaxRequestsPerChild 0