This file contains hidden or 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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "", | |
"Effect": "Allow", | |
"Principal": { | |
"Service": "ecs-tasks.amazonaws.com" | |
}, | |
"Action": "sts:AssumeRole" |
This file contains hidden or 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
hhash = {} | |
(0..10000000).each{ |i| hhash[i] = rand }; | |
parallel_sum = Parallel.map(hhash.each_slice(1000)) do |ele| # https://github.com/grosser/parallel | |
ele.sum{|value| value.last} | |
end.sum | |
puts parallel_sum |
This file contains hidden or 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
// dependencies | |
var async = require('async'); | |
var AWS = require('aws-sdk'); | |
var gm = require('gm') | |
.subClass({ imageMagick: true }); // Enable ImageMagick integration. | |
var util = require('util'); | |
// constants | |
var MAX_WIDTH = 100; | |
var MAX_HEIGHT = 100; |
This file contains hidden or 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
class MyUserManager(BaseUserManager): | |
def create(self, email, name, birthday, sex, password): | |
return self.create_user(email=email, | |
password=password, | |
name=name, | |
birthday=birthday, | |
sex=sex, | |
) | |
def create_user(self, email, name, birthday, sex, password): |
This file contains hidden or 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
$ python setup.py install | |
Extracting in /var/folders/yc/w0fp9t155fq6zwvlhf2btx340000gn/T/tmpsKtOqW | |
Now working in /var/folders/yc/w0fp9t155fq6zwvlhf2btx340000gn/T/tmpsKtOqW/distribute-0.6.28 | |
Building a Distribute egg in /Users/hgkim/Downloads/MySQL-python-1.2.4b4 | |
Traceback (most recent call last): | |
File "setup.py", line 220, in <module> | |
scripts = scripts, | |
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup | |
_setup_distribution = dist = klass(attrs) | |
File "/private/var/folders/yc/w0fp9t155fq6zwvlhf2btx340000gn/T/tmpsKtOqW/distribute-0.6.28/setuptools/dist.py", line 225, in __init__ |
This file contains hidden or 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
$ pip install MySQL-python==1.2.5 | |
Downloading/unpacking MySQL-python==1.2.5 | |
Using download cache from /Users/hgkim/.cache/pip/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2FM%2FMySQL-python%2FMySQL-python-1.2.5.zip | |
Running setup.py (path:/Users/hgkim/.virtualenvs/advance/build/MySQL-python/setup.py) egg_info for package MySQL-python | |
Installing collected packages: MySQL-python | |
Running setup.py install for MySQL-python | |
building '_mysql' extension | |
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.6.16/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.9-intel-2.7/_mysql.o -Os |
This file contains hidden or 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
from django.db import models | |
class Question(models.Model): | |
contents = models.TextField() | |
class Answer(models.Model): | |
contents = models.TextField() | |
question = models.ForeignKey(Question) |
This file contains hidden or 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
class MyUserManager(BaseUserManager): | |
def create(self, email, name, birthday, sex, password): | |
return self.create_user(email=email, | |
password=password, | |
name=name, | |
birthday=birthday, | |
sex=sex, | |
) | |
def create_user(self, email, name, birthday, sex, password): |
This file contains hidden or 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
class UserSerializer(serializers.HyperlinkedModelSerializer): | |
password2 = serializers.CharField() | |
class Meta: | |
model = VomUser | |
fields = ('url', 'id', 'email', 'sex', 'birthday', | |
'name', 'password', 'password2') | |
read_only_fields = ('email',) | |
def __init__(self, *args, **kwargs): |
NewerOlder