Skip to content

Instantly share code, notes, and snippets.

View masayang's full-sized avatar

Masa Nakamura masayang

View GitHub Profile
@masayang
masayang / virtualenv.sh
Created December 8, 2012 23:21
Preparing Virtualenv for Bootcamp
#! /bin/sh
source virtualenvwrapper.sh
mkvirtualenv bootcamp
cat << EOF > requirements.txt
Baker==1.3
Fabric==1.5.1
boto==2.6.0
paramiko==1.9.0
pycrypto==2.6
EOF
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation Sample Template vpc_multiple_subnets.template: Sample template showing how to create a VPC with multiple subnets. The first subnet is public and contains the load balancer, the second subnet is private and contains an EC2 instance behind the load balancer. **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": {
"NetCIDR": {
"Description": "VPC Subnet, like 10.0.0.0/16",
"Type": "String",
"Default": "10.0.0.0/16"
},
"PublicSubnetCIDR": {
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Create a Server in specified VPC subnet",
"Parameters": {
"InstanceType": {
"Description": "EC2 instance type",
"Type": "String",
"Default": "t1.micro",
"AllowedValues": [
"m1.small",
@masayang
masayang / creativecommons.txt
Created March 8, 2013 20:15
MapReduce原理説明用
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modif
@masayang
masayang / mapper_with_LongValueSum.py
Created March 9, 2013 01:19
LongValueSumを指定したMapper
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
# 標準入力から読み込む
for line in sys.stdin:
# strip()を呼び出して余分な空白や改行コードを取り除く
line = line.strip()
# split()を呼び出して、単語ごとに分ける
@masayang
masayang / installation_procedure.txt
Created March 9, 2013 07:19
MrJob設置手順・環境切り替え
# 設置手順
source virtualenvwrapper.sh
mkvirtualenv mrjob
pip install mrjob
# MrJob環境の開放
deactivate
#MrJob環境への切り替え
workon mrjob
@masayang
masayang / mapper.py
Created March 9, 2013 07:28
MrJobを使ったMapReduce処理記述と実行
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from mrjob.job import MRJob
class MRWordCounter(MRJob):
def mapper(self, key, line):
for word in line.split():
yield word, 1
@masayang
masayang / friends.list
Created March 10, 2013 22:50
共通友達を数えるMrJob
W, A, B, C
X, A, B, C, D, Z
Y, A, B, E
Z, A, B, D, E
@masayang
masayang / longerfriends.list
Created March 10, 2013 23:48
友達推奨MrJob
foo, bar, masayang, steve, nakamura, ryoma, corbert
bar, foo, chibi, loki, ichikawa
masayang, foo, steve, loki, corbert, ichikawa, moraimon, sada, matsuno
steve, bar, nakamura, micky, samuel, chibi, ryoma, moses, anko, moraimon
nakamura, foo, bar, masayang, steve, wendy, ryoma, ichikawa, moraimon, matsuno
micky, steve, loki, corbert, ichikawa, regan, moraimon, sada
samuel, bar, chester, loki, regan
wendy, foo, bar, samuel, chibi, ryoma, loki, moses, matsuno
chester, foo, samuel, loki, regan, sada
chibi, masayang, steve, anko
@masayang
masayang / D-Wave
Created January 5, 2015 07:45
TD D-Wave for StockFinder
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:TD D-Wave
'|*** Example: plot = price.close - price.close(1)
'|******************************************************************
Static Wave As Integer
Static MinA As Single