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
from django import forms | |
from inventory.models import Computer | |
class ComputerForm(forms.ModelForm): | |
class Meta: | |
model = Computer | |
class ChromebookForm(forms.ModelForm): |
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
# Rootユーザに変更 | |
sudo su - | |
# virtualenvインストール | |
pip install -U virtualenv | |
virtualenv /www/sentry/ | |
source /www/sentry/bin/activate |
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
INSTALLED_APPS += ( | |
'raven.contrib.django.raven_compat', | |
) | |
MIDDLEWARE_CLASSES += ( | |
'raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware', | |
) | |
RAVEN_CONFIG = { | |
'dsn': 'http://x:y@sentry.domain.com/2', # NOQA |
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
# If following the official celery documentation for integration django | |
# you might have a `celery.py` file that looks like this. | |
from __future__ import absolute_import, unicode_literals | |
import os | |
import logging | |
from celery import Celery | |
# from celery.utils.log import get_task_logger | |
from celery import signals |
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
import sys | |
from oslo.config import cfg | |
from oslo_log import log as oslo_logging | |
CONF = cfg.CONF | |
CONF.register_opt(cfg.StrOpt('NODE_NAME'), cfg.OptGroup('HA')) | |
def main(): | |
oslo_logging.register_options(CONF) | |
CONF(sys.argv[1:], default_config_files=['app.conf']) |
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
from __future__ import print_function | |
import time | |
def query_10k(cur): | |
t = time.time() | |
for _ in range(10000): | |
cur.execute("SELECT 1,2,3,4,5") | |
res = cur.fetchall() | |
assert len(res) == 1 | |
assert res[0] == (1,2,3,4,5) |
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
/* Useful celery config. | |
app = Celery('tasks', | |
broker='redis://localhost:6379', | |
backend='redis://localhost:6379') | |
app.conf.update( | |
CELERY_TASK_RESULT_EXPIRES=3600, | |
CELERY_QUEUES=( | |
Queue('default', routing_key='tasks.#'), |
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
import io.gatling.core.Predef._ | |
import io.gatling.http.Predef._ | |
import io.gatling.jdbc.Predef._ | |
class Repeat extends Simulation { | |
val httpProtocol = http.baseURL("http://localhost").inferHtmlResources() | |
val scn = scenario("repeat test").repeat(10) { exec(http("Home").get("/")) } | |
setUp(scn.inject(rampUsers(10) over(1)).protocols(httpProtocol)) | |
} |
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
import scala.concurrent.duration._ | |
import io.gatling.core.Predef._ | |
import io.gatling.http.Predef._ | |
import io.gatling.jdbc.Predef._ | |
class RecordedSimulation extends Simulation { | |
val httpProtocol = http | |
.baseUrl("http://10.10.10.86") |
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
import scala.concurrent.duration._ | |
import io.gatling.core.Predef._ | |
import io.gatling.http.Predef._ | |
import io.gatling.jdbc.Predef._ | |
class RecordedSimulation extends Simulation { | |
val httpProtocol = http | |
.baseUrl("http://10.10.10.86") |
OlderNewer