ec2 cloud-init LAMP例
※ MySQLはRDSを使うのでmysql-serverは入れない
#cloud-config repo_upgrade: all packages: - httpd - httpd-devel - mysql ###- mysql-server - memcached - php - php-devel - php-mysql - php-pecl-apc - php-gd - php-pecl-memcache - php-mbstring - php-pdo - php-mcrypt runcmd: - [cp, /usr/share/zoneinfo/Asia/Tokyo, /etc/localtime] - [sed, -i, 's/LANG="en_US.UTF-8"/LANG="ja_JP.UTF-8"/', /etc/sysconfig/i18n] - [/sbin/chkconfig, httpd, on] - [/sbin/chkconfig, memcached, on] - [/etc/init.d/httpd, start] - [/etc/init.d/memcached, start]
macのsedがおかしいのでmacportsでgsed (GNU sed)に代える
port install gsed #.bashrc alias sed='gsed'
macports python envs path
#.bashrc export VIRTUALENV_USE_DISTRIBUTE=true VIRTUALENVWRAPPER_VIRTUALENV="virtualenv-2.7" if [ -f /opt/local/bin/virtualenvwrapper.sh-2.7 ]; then export WORKON_HOME=$HOME/.virtualenvs source /opt/local/bin/virtualenvwrapper.sh-2.7 fi export PATH=$PATH:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/
Chef knife cookbook create
knife cookbook create $packpage -o .
vimrc smartindent ruby python
autocmd FileType python setl autoindent autocmd FileType python setl smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class autocmd FileType python setl tabstop=8 expandtab shiftwidth=4 softtabstop=4 autocmd FileType ruby setl autoindent autocmd FileType ruby setl smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class autocmd FileType ruby setl tabstop=2 expandtab shiftwidth=2 softtabstop=2
C++0x C++11 random
#include <iostream> #include <random> #include <chrono> using namespace std; int main() { std::mt19937 engine(std::chrono::system_clock::now().time_since_epoch().count()); std::uniform_int_distribution<int> distribution( 1, 100000000 ) ; int array[1000000 + 1]; for (int i = 0; i < 1000000; i++) { array[i] = distribution(engine); } for (int j = 0; j < 100; j++) { cout << array[j] << endl; } return 0; }
NODE_ENV node.js運用環境変更
NODE_ENV=production node app.js