This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env ruby | |
#-*- coding: utf-8 -*- | |
def fizzbuzz(max) | |
step = 1 | |
while step <= max | |
fizbuz = step % 15 == 0 ? "FizzBuzz" : \ | |
step % 5 == 0 ? "Buzz" : \ | |
step % 3 == 0 ? "Fizz" : step | |
yield fizbuz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## http://d.hatena.ne.jp/mikeda/20120826/1345972294 | |
## http://d.hatena.ne.jp/wyukawa/20120207/1328625443 | |
## http://www.mongodb.org/pages/viewpage.action?pageId=18907495 | |
## http://taka512.hatenablog.com/entry/20110220/1298195574 | |
cat >> /etc/yum.repos.d/td.repo <<'EOF' | |
[tdrepo] | |
name=treasuredata | |
baseurl=http://packages.treasure-data.com/redhat/$basearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env ruby | |
#-*- coding: utf-8 -*- | |
fizzbuzz = Enumerator.new do |y| | |
number = 1 | |
loop do | |
fzbz = number % 15 == 0 ? "FizzBuzz" : | |
number % 5 == 0 ? "Buzz" : | |
number % 3 == 0 ? "Fizz" : number | |
number += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat >> /etc/yum.repos.d/10gen.repo <<'10GEN_REPO.EOF' | |
[10gen] | |
name=10gen Repository | |
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 | |
gpgcheck=0 | |
enable=0 | |
10GEN_REPO.EOF | |
yum -y install --enablerepo=10gen mongo-10gen-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10gen RPM | |
mongo-10gen-server-2.2.2-mongodb_1.x86_64 : 2013/01/14現在 | |
#yum-repo 追加 | |
#https://gist.github.com/raw/4528010/4453b9dff8605494185292786aab9ce1920d810b/mongo_10gen_settings.txt | |
cat >> /etc/yum.repos.d/10gen.repo <<'10GEN_REPO.EOF' | |
[10gen] | |
name=10gen Repository | |
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum -y install gcc-c++.x86_64 pcre-devel.x86_64 boost-devel.x86_64 make.x86_64 git.x86_64 | |
spmky_ver="1.7.0" | |
cd /usr/local/src/ | |
wget http://ftp.mozilla.org/pub/mozilla.org/js/js-${spmky_ver}.tar.gz | |
tar xzvf js-${spmky_ver}.tar.gz | |
cd js/src | |
export CFLAGS="-DJS_C_STRINGS_ARE_UTF8" | |
make -f Makefile.ref | |
JS_DIST=/usr make -f Makefile.ref export |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ver="1.8.4" | |
mongodUID="27017" | |
mongodGID="27017" | |
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${ver}.tgz | |
tar zxvf mongodb-linux-x86_64-${ver}.tgz | |
mv mongodb-linux-x86_64-${ver} /usr/local/ | |
cd /usr/local | |
ln -s mongodb-linux-x86_64-${ver} mongodb | |
mkdir /usr/local/mongodb/db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # | |
# http://dotinstall.com/lessons/basic_mongodb # | |
# # | |
use dtbs | |
db.dropDatabase() | |
db.createCollection("posts") | |
db.createCollection("users") | |
db.users.renameCollection("entries") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ write_target=`df -h | | |
grep 'NO NAME$' | | |
awk -F' ' '{print $1}' | | |
sed -e 's/[a-z][0-9]$//g' -e 's/disk/rdisk/g'` | |
$ diskutil unmount `df -h | | |
grep 'NO NAME$' | | |
awk -F' ' '{print $1}'` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Raspberry Pi(SD Class10) | |
time dd if=/dev/zero of=/tmp/1024M bs=1024 count=1048576 | |
1048576+0 records in | |
1048576+0 records out | |
1073741824 bytes (1.1 GB) copied, 57.3186 s, 18.7 MB/s | |
dd if=/dev/zero of=/tmp/1024M bs=1024 count=1048576 1.74s user 26.69s system 49% cpu 57.843 total | |
##MacBook Pro(SSD) | |
time dd if=/dev/zero of=/tmp/1024M bs=1024 count=1048576 | |
1048576+0 records in |