Skip to content

Instantly share code, notes, and snippets.

View chartjes's full-sized avatar

Chris Hartjes chartjes

View GitHub Profile
(venv) ~/mozilla-services/ailoads-syncto (master ✘)✹✭ ᐅ make setup_existing
/Users/chartjes/mozilla-services/ailoads-syncto/venv/bin/fxa-client --browserid --auth "ailoads-bitchin@mailinator.com" --account-server "https://api.accounts.firefox.com/v1" --env stage --out loadtest.env
Please enter a password for ailoads-bitchin@mailinator.com:
ERROR:fxa-client:Unknown account
make: *** [setup_existing] Error 1
<?php namespace OpenCFP\Provider;
use Silex\Application;
use Silex\ServiceProviderInterface;
class DatabaseServiceProvider implements ServiceProviderInterface
{
/**
* {@inheritdoc}
*/
import base64
import datetime
import re
import requests
import time
import unittest
class Kinto_Sync(unittest.TestCase):
"""
Tests that given two Kinto servers you can successfully sync data
Here is my scenario:
* using docker-compose to spin up 4 containers: master, read-only, db1, db2
* all four containers are succesfully spun up
* once all the containers are up and running, I need to run the same two commands on master and read-only, one after the other
I have no idea how I can automate this and I prefer to NOT have folks manually do 'docker run blah blah blah'
Here is my current Docker compose file
@chartjes
chartjes / sample.py
Created December 30, 2015 15:45
There must be a more idiomatic way
for container in containers:
p1 = re.compile('.*?kinto_read-only_(\d)$')
p2 = re.compile('.*?kinto_master_(\d)$')
print container['Names']
if container['Names']:
for name in container['Names']:
if p1.match(name):
ports = container['Ports']
for port in ports:
self.read_only['ip'] = port['IP']
@chartjes
chartjes / gist:5acf166de83f1e8ef776
Last active December 22, 2015 20:43
Regex challenge
I have three strings
/kinto_read-only_1
/kinto_read-only_1/db1
/kinto_read-only_1/db1_1
* I want matches only on the first string
* the digit after a _ could be any number (ie only_1, only_2, only_3)
* the number after db1 could be any number (ie db1, db2)
##################################################
# Generated by phansible.com
##################################################
#If your Vagrant version is lower than 1.5, you can still use this provisioning
#by commenting or removing the line below and providing the config.vm.box_url parameter,
#if it's not already defined in this Vagrantfile. Keep in mind that you won't be able
#to use the Vagrant Cloud and other newer Vagrant features.
Vagrant.require_version ">= 1.5"
PHPUnit 4.8.15 by Sebastian Bergmann and contributors.
PHP Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'Closure' is not allowed' in /vagrant/vendor/phpunit/phpunit/src/Util/GlobalState.php:170
Stack trace:
#0 /vagrant/vendor/phpunit/phpunit/src/Util/GlobalState.php(170): serialize(Object(Zend_Application))
#1 /vagrant/vendor/phpunit/phpunit/src/Util/GlobalState.php(142): PHPUnit_Util_GlobalState::exportVariable(Object(Zend_Application))
#2 /vagrant/vendor/phpunit/phpunit/src/Framework/TestCase.php(641): PHPUnit_Util_GlobalState::getGlobalsAsString()
#3 /vagrant/vendor/phpunit/phpunit/src/Framework/TestSuite.php(747): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#4 /vagrant/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(440): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#5 /vagrant/vendor/phpunit/phpunit/src/TextUI/Command.php(149): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)
protected function _initTranslator()
{
$translate = new \Zend_Translate('array', APPLICATION_PATH . '/../languages/en.php');
\Zend_Registry::set('Zend_Translate', $translate);
\Zend_Validate_Abstract::setDefaultTranslator($translate);
}
$application = new \Zend_Application(
APPLICATION_ENV,
array(
'config' => array (
APPLICATION_PATH . '/configs/application.ini',
APPLICATION_PATH . '/configs/local.ini'
)
)
);
$application->bootstrap()