Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,| import os, hashlib, urllib2, optparse | |
| def get_remote_md5_sum(url, max_file_size=100*1024*1024): | |
| remote = urllib2.urlopen(url) | |
| hash = hashlib.md5() | |
| total_read = 0 | |
| while True: | |
| data = remote.read(4096) | |
| total_read += 4096 |
| -- DESCRIPTION -- | |
| If you accidentally commit a huge file, you have a problem. Sure, you can remove it from the working tree and commit, | |
| but the file is still reachable from your history and therefore causes every clone to be as huge as the commented | |
| binary file. | |
| Fixing this can be very ugly, time consuming and might not even work as you wish. Luckily, this script can protect | |
| you from committing such monsters in the first place. | |
| It looks through the staged files (the ones that are added with the "git add"-command) and checks for their file-size. | |
| If they are larger then the given size, the commit is aborted and you get a message telling you what file takes so |
| #!/usr/bin/env python | |
| import argparse | |
| import sys | |
| import jinja2 | |
| import markdown | |
| TEMPLATE = """<!DOCTYPE html> | |
| <html> |
| #!/bin/bash | |
| NAME="hello_app" # Name of the application | |
| DJANGODIR=/webapps/hello_django/hello # Django project directory | |
| SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket | |
| USER=hello # the user to run as | |
| GROUP=webapps # the group to run as | |
| NUM_WORKERS=3 # how many worker processes should Gunicorn spawn | |
| DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use | |
| DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name |
Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,На этой странице описывается процесс настройки нагрузочного тестирования внешних ресурсов.
Для тестирования поведения сервиса под нагрузкой используется утилита Yandex Tank.
Танку можно указать патроны (HTTP-запросы, которые будут отправлены на целевой сервер) и расписание (количество запросов в секунду к целевому серверу в каждый момент времени стрельб, а также продолжительность стрельб). Также к танку можно подключить плагин мониторинга, позволяющий снимать показатели (например, количество свободной памяти или загрузку процессора) с целевого сервера.
| import warnings | |
| from skimage.measure import compare_ssim | |
| from skimage.transform import resize | |
| from scipy.stats import wasserstein_distance | |
| from scipy.misc import imsave | |
| from scipy.ndimage import imread | |
| import numpy as np | |
| import cv2 | |
| ## |