Skip to content

Instantly share code, notes, and snippets.

GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
faraday (0.9.1)
@masahixixi
masahixixi / juno_multinode
Created December 23, 2014 07:37
Packstack_juno_multinode
[general]
# Path to a Public key to install on servers. If a usable key has not
# been installed on the remote servers the user will be prompted for a
# password and this key will be installed so the password will not be
# required again
# CONFIG_SSH_KEY=/root/.ssh/id_rsa.pub
# Set a default password everywhere. The default password will be
# overriden by whatever password is set for each individual service or
@masahixixi
masahixixi / .tmux.conf
Last active August 29, 2015 14:02
.tmux.conf
# 256色対応
set-option -g default-terminal xterm-256color
# 設定リロード
bind r source-file ~/.tmux.conf \; display-message "Reload Config!!"
# デフォルトの Prefix(C-b)を解除
unbind C-b
# Prefix を設定
"---------------------set---------------------
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,euc-jp,iso-2022-jp,cp932
set autoindent
set smartindent
set tabstop=2
set shiftwidth=2
set expandtab
set number
@masahixixi
masahixixi / gist:8857807
Created February 7, 2014 05:36
ProjectEuler #19
#month_hash = {"1"=>31, "2"=>28, "2u"=>29, "3"=>31, "4"=>31, "5"=>31, "6"=>30, "7"=>31, "8"=>31, "9"=>30, "10"=>31, "11"=>30, "12"=>31}
#youbi_hash = {"1"=>"Mon", "2"=>"Tue", "3"=>"Wed", "4"=>"Thr", "5"=>"Fri", "6"=>"Sat", "7"=>"Sun"}
ad = 1900
month = 1
day = 1
youbi = 1
count = 0
while ad <= 2000
while month <= 12
@masahixixi
masahixixi / gist:4136613
Created November 23, 2012 17:42
ProjectEuler #17
num_english = Hash.new
num_english = {
0 => "",
1 => "one",
2 => "two",
3 => "three",
4 => "four",
5 => "five",
6 => "six",
@masahixixi
masahixixi / gist:4134431
Created November 23, 2012 07:54
ProjectEuler #20
ans = 0
def fact num
(1..num).to_a.inject(1){|prd, n| prd * n}
end
num_ary = fact(100).to_s.split("").map{|i| i.to_i}
ans = num_ary.inject(0){|sum, n| sum + n}
p ans
@masahixixi
masahixixi / gist:4134371
Created November 23, 2012 07:29
ProjectEuler #16
ans = 0
num = (2**1000).to_s.split("").map{|i| i.to_i}
ans = num.inject(0){|sum, n| sum + n}
p ans
@masahixixi
masahixixi / gist:4134288
Created November 23, 2012 06:56
ProjectEuler #15
def fact num
(1..num).to_a.inject(1){|prd, n| prd * n}
end
p fact(40) / (fact(20) * fact(20))
@masahixixi
masahixixi / gist:4134229
Created November 23, 2012 06:20
ProjectEuler #14
tmp = 0
ary_size = 0
ans = 0
1000000.downto(1) do |num|
num_ary = Array.new
tmp = num
while num != 1
if num % 2 == 0
num = num / 2