ln -s ~/Dropbox/dev/env/vim/.vimrc ~/.vimrc
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
# -*- coding: utf-8 -*- | |
import StringIO | |
import math | |
import boto3 | |
# custom hash function that hashes the filename | |
from generator import generate_file_hash |
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
# -*- coding: utf-8 -*- | |
import hashlib | |
import boto3 | |
class ETSManager: | |
""" | |
@todo: manages and provides the ets services |
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
# -*- coding: utf-8 -*- | |
import StringIO | |
import time | |
import boto | |
from boto.cloudfront.distribution import Distribution | |
class CloudFrontManager(object): |
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
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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
# config.py | |
DATABASE_CONFIG = { | |
'host': 'localhost', | |
'dbname': 'company', | |
'user': 'user', | |
'password': 'password', | |
'port': 3306 | |
} | |
# main.py |
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
# config.py | |
class Config: | |
APP_NAME = 'myapp' | |
SECRET_KEY = 'secret-key-of-myapp' | |
ADMIN_NAME = 'administrator' | |
AWS_DEFAULT_REGION = 'ap-northeast-2' | |
STATIC_PREFIX_PATH = 'static' | |
ALLOWED_IMAGE_FORMATS = ['jpg', 'jpeg', 'png', 'gif'] |
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
; config.ini | |
[DEFAULT] | |
SECRET_KEY = secret-key-of-myapp | |
ADMIN_NAME = administrator | |
AWS_DEFAULT_REGION = ap-northeast-2 | |
MAX_IMAGE_SIZE = 5242880 | |
[TEST] | |
TEST_TMP_DIR = tests | |
TEST_TIMEOUT = 20 |
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
// config.json | |
{ | |
"DEFAULT": { | |
"SECRET_KEY": "secret-key-of-myapp", | |
"ADMIN_NAME": "administrator", | |
"AWS_DEFAULT_REGION": "ap-northeast-2", | |
"MAX_IMAGE_SIZE": 5242880 | |
}, | |
"TEST": { | |
"TEST_TMP_DIR": "tests", |
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
# main_with_ini.py | |
import configparser | |
config = configparser.ConfigParser() | |
config.read('config.ini') | |
secret_key = config['DEFAULT']['SECRET_KEY'] # 'secret-key-of-myapp' | |
ci_hook_url = config['CI']['HOOK_URL'] # 'web-hooking-url-from-ci-service' | |
# main_with_json.py |
OlderNewer