Skip to content

Instantly share code, notes, and snippets.

View ngtk's full-sized avatar
🕺
Being dancing to AI's tune

Kento Nagata ngtk

🕺
Being dancing to AI's tune
View GitHub Profile
@ngtk
ngtk / WordPress_within_mysql
Created July 21, 2013 01:53
AWS CloudFormation template
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation Sample Template WordPress_Single_Instance: WordPress is web software you can use to create a beautiful website or blog. This template installs a single-instance WordPress deployment using a local MySQL database to store the data. It demonstrates using the AWS CloudFormation bootstrap scripts to install packages and files at instance launch time. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
"Type" : "String"
@ngtk
ngtk / install_mahout.sh
Last active December 29, 2015 07:39
Install mahout manually
wget http://ftp.riken.jp/net/apache/mahout/0.7/mahout-distribution-0.7-src.tar.gz
tar -xzf mahout-distribution-0.7-src.tar.gz
cd mahout-distribution-0.7
mvn install -DskipTests
sudo mv ../mahout-distribution-0.7 /usr/local/mahout
echo \#\#\ Mahout >> ~/.bashrc
echo export\ PATH=/usr/local/mahout/bin:\$PATH >> ~/.bashrc
source ~/.bashrc
@ngtk
ngtk / Berksfile
Created January 14, 2014 05:05
ChefとVagrantで楽しいクッキング ref: http://qiita.com/ngtk/items/aee1de7243b1405b6568
site :opscode
cookbook 'nginx'
#!/bin/bash
# Build tools and dependencies
sudo yum install git gcc gcc-c++ make openssl-devel -y
# Install RBENV
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
@ngtk
ngtk / block_sortable.rb
Created August 25, 2015 11:16
block sortable
module BlockSortable
def encode
[
matrix.map(&:last).join,
matrix.index(self)
]
end
def matrix
str = self.dup
@ngtk
ngtk / tmux-ssh
Created August 28, 2015 02:29
tmux-ssh
#! /bin/zsh
tmux set-window-option -g window-status-current-bg yellow
ssh $1
tmux set-window-option -g window-status-current-bg default
@ngtk
ngtk / file0.txt
Last active August 30, 2015 10:06
Phoenixインストールまで ref: http://qiita.com/ngtk/items/958f35de8c48659f2463
$ brew install elixir
$ elixir -v
Elixir 1.0.5
$ brew install postgresql
$ createdb # データベース追加
$ createuser postgres # postgresユーザを追加
$ psql
(username)=\# ALTER USER postgres CREATEDB; # DB作成できるように
@ngtk
ngtk / refinements_pattern.rb
Created November 4, 2015 03:34
refinements pattern
class Human
def say
puts "hello"
end
end
module PartyPeople
refine Human do
def say
puts "hooooo!!!"
@ngtk
ngtk / monkey_patch_pattern.rb
Created November 4, 2015 04:07
monkey patch pattern
class Human
def say
puts "hello"
end
end
module AnyModule
class ::Human
def say
puts "hooooo!!!"
@ngtk
ngtk / .pryrc
Last active December 25, 2015 14:36
Pryで日本語リプサムとしてaozoraを使う ref: http://qiita.com/ngtk/items/51ebf0cc7f7b9d498c16
require 'aozora'
Aozora.titles.each do |title|
define_method(title) do |size = 100|
Aozora.public_send(title, size)
end
end