Skip to content

Instantly share code, notes, and snippets.

View adamgoucher's full-sized avatar

adam goucher adamgoucher

View GitHub Profile
@adamgoucher
adamgoucher / gist:6106512
Last active December 20, 2015 09:19
puppet 3.2.3 agent (windows 7) attempting a connection to a 3.2.3 master (osx). - names managed via host file entries - times synchronized - can ssh from agent to master
Debug: Finishing transaction 34149780
Debug: Using cached certificate for ca
Error: Could not request certificate: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/net/http.rb:799:in `connect'
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/net/http.rb:799:in `block in connect'
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/net/http.rb:799:in `connect'
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/net/http.rb:744:in `start'
@adamgoucher
adamgoucher / hotfixes.rb
Created July 18, 2013 19:34
A Puppet 'Fact' which returns a comma separated list of hotfixes installed on a windows machine.
require 'facter'
Facter.add(:hotfixes) do
confine :operatingsystem => :windows
setcode do
require 'facter/util/wmi'
fixes = []
@adamgoucher
adamgoucher / gist:5802604
Created June 18, 2013 04:01
A taste of what our webinar has in store for you
def menu(self, path):
chain = ActionChains(self.driver)
split_path = path.split('/')
for p in split_path:
# go back up?
if p == '..':
chain.send_keys_to_element(self._current_menu_item, Keys.ARROW_LEFT)
else:
e = self.driver.find_element(*locators[p.lower()])
@adamgoucher
adamgoucher / couch_provider.py
Created June 10, 2013 16:08
An example of using CouchDB within Py.Saunter ... including both parts of the setup since its not actually in Py.Saunter at the moment, but will in the future.
import ConfigParser
import couchdb.client
import random
import socket
# this will be in py.saunter
class ProviderException(Exception): pass
# as will this
class CouchProvider(object):
@adamgoucher
adamgoucher / visibility.html
Created June 4, 2013 00:39
what i think we should be looking for in terms of a test suite site
<html>
<body>
<h2>Element Visibility</h2>
<p id="explanation">WebDriver mimic's a user's ability to read text inside elements. That is,
if it is hidden, they cannot read it. There are two text elments below. The one with an id of
<i>hidden</i> has the text <i>hidden</i>. And the element with an id of <i>visible</i> has
the text <i>visible</i>
</p>
<div id="examples">
<div id="hidden">hidden</div>
@adamgoucher
adamgoucher / logs.md
Created May 22, 2013 02:33
holy wow user facing error messages are hard.

this:

    @pytest.marks('matchers')
    def test_verify_true_with_true_condition(self):
        self.matchers.verify_true(1==1, "AAAAA")
        self.matchers.verify_true(2==3, "BBBBB")
        self.matchers.verify_true(3==4)
        # self.matchers.assert_true(4==5, "CCCCC")
        self.matchers.assert_true(4 == 5)
@adamgoucher
adamgoucher / autoload.php
Created April 5, 2013 02:23
My first attempt at a PHP autoloader. Is based on the one in PSR-0, but with the added check of constraining it to just the project's namespace which is the polite thing to do since spl_autoload functions are stackable
spl_autoload_register(function($className){
$projectNamespace = "PHPWebDriver";
$className = ltrim($className, '\\');
$fileName = '';
$namespace = '';
if ($lastNsPos = strrpos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
@adamgoucher
adamgoucher / php-example.php
Created February 14, 2013 19:06
browser arrays
<?php
$sites = array(
"development" => "http://localhost",
"qa" => "http://qa.mycompany.com",
"staging" => "http://stage.mycompany.com",
"production" => "http://fashion.ebay.com"
);
$GLOBALS['settings']['webserver'] = $sites["production"];
@adamgoucher
adamgoucher / run.php
Created February 11, 2013 00:47
a parallel runner for phpunit. worked well enough, but isn't os portable
<?php
$max_sauce_concurrency = 16;
set_include_path(get_include_path() . PATH_SEPARATOR . './shared');
set_include_path(get_include_path() . PATH_SEPARATOR . './pages');
set_include_path(get_include_path() . PATH_SEPARATOR . './parallel_runner');
require_once 'PHPUnit/Autoload.php';
require_once 'parallel_runner/util.php';
@adamgoucher
adamgoucher / ClientSQLProvider.php
Last active December 12, 2015 05:38
cross-platform-ability is a pain in the butt. so saunterphp provides an abstract class that individual saunter projects much subclass (its abstract, duh), which then gets used in their scripts.
class ClientSQLProvider extends SQLServerProvider {
function get_invite_token($email) {
$sql = "select * from users where email = '$email'";
$result = $this->connection->query($sql);
return $result->fetch();
}
}