Skip to content

Instantly share code, notes, and snippets.

@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')
<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 / kegbot.conf
Created January 10, 2011 05:41
supervisord configuration for kegbot
[group:kegbot]
programs=kegbot_core,kegboard_daemon,kegbot_runserver
[program:kegbot_core]
command=/opt/kegbot/env/bin/kegbot_core.py
directory=/opt/kegbot
user=kegbot
environment=HOME='/home/kegbot'
numprocs=1
autostart=true
@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) {
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);
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)
@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
@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 / celeryd_rotate
Created May 17, 2010 14:35
logrotate.d configuration for celery
/var/log/celery/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
copytruncate
}
@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;