Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#http://gist.github.com/gists/315136
SSHAGENT=/usr/bin/ssh-agent
SSHAGENTARGS="-s"
PARENT_JOB=pstat_master_unittest
KEY_PATH=$HOME/policystat/fabric/pstat_dev.key
PROJECT_ROOT=/var/www/pstattest.com/
DB_NAME=pstattest
class BackupArchiveGenerator(Task):
def get_archive_name(self, tenant, date, archive):
"""
Build and return the archive name based on the requested archive.
"""
filename = '%s_to_%s' % (date.strftime('%Y_%m_%d'), datetime.datetime.today().strftime('%Y_%m_%d'))
if archive:
filename = "%s_archive" % filename
destination = os.path.join(tenant.subdomain, '%s.zip' % filename)
@winhamwr
winhamwr / gist:359405
Created April 7, 2010 20:31
Hudson script for running selenium tests
#!/bin/bash
# Located at: http://gist.github.com/359405
source $WORKSPACE/../../../virtualenvs/$JOB_NAME/bin/activate
./scripts/clean.sh;
# Delete the database so Django doesn't prompt us yes/no to continue
echo "CREATE DATABASE IF NOT EXISTS $JOB_NAME DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" | mysql -u root;
echo "DROP DATABASE IF EXISTS test_$JOB_NAME;" | mysql -u root;
@winhamwr
winhamwr / hud_run_unittests.sh
Created June 11, 2010 22:02
Hudson: Run unittests
#!/bin/bash
# http://gist.github.com/435108
source $WORKSPACE/../../../virtualenvs/$JOB_NAME/bin/activate
./scripts/clean.sh;
echo "CREATE DATABASE IF NOT EXISTS $JOB_NAME DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" | mysql -u root;
echo "DROP DATABASE IF EXISTS test_$JOB_NAME;" | mysql -u root;
rm --force #WORKSPACE/pstat/nosetests.xml;
python scripts/run_tests.py --coverage --django-sqlite;
@winhamwr
winhamwr / hud_gen_coverage.sh
Created June 28, 2010 15:14
Hudson: Generate coverage data
#!/bin/bash
# http://gist.github.com/455967
####
## Generate coverage data for usage by Hudson and the violations plugin
####
source $WORKSPACE/../../../virtualenvs/$JOB_NAME/bin/activate
cd pstat
coverage xml --omit $WORKSPACE/../../../virtualenvs,/usr/share,$WORKSPACE/pstat/pstat_deploy,$WORKSPACE/pstat/*/migrations
import logging
from selenium.firefox.webdriver import WebDriver
from django.conf import settings
from django.test import TestCase
djangoassets_logger = logging.getLogger('assets.cssutils')
djangoassets_logger.setLevel(logging.WARNING)
const int ledGreenPin = 3;
const int ledBluePin = 4;
int incomingByte;
void setup() {
// initialize serial communication:
Serial.begin(9600);
Serial.print("YOYOYO\n");
// initialize the LED pin as an output:
pinMode(ledRedPin, OUTPUT);
@winhamwr
winhamwr / normalize_html.js
Created December 21, 2010 16:43
HTML normalization to allow for consistent comparison of HTML
/**
* Order HTML attributes for consistent HTML comparison.
*
* Adapted from google-code-prettify
* http://code.google.com/p/google-code-prettify/source/browse/trunk/src/prettify.js#311
* Apache license, Copyright (C) 2006 Google Inc.
*/
function normalizeHtml(node) {
var html = '';
switch (node.nodeType) {
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="64MVW6TGUJZ66">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
@winhamwr
winhamwr / run_tests.py
Created March 28, 2011 18:25
Example file for simplified running of nosedjango tests for a project
#! /usr/bin/env python
# Example: $ ./run_tests.py --django-sqlite --multiprocess
import os
import subprocess
import sys
scripts_dir = os.path.abspath(os.path.dirname(__file__))
pstat_dir = os.path.join(scripts_dir, '..', 'pstat')