Skip to content

Instantly share code, notes, and snippets.

@winhamwr
winhamwr / gist:359405
Created Apr 7, 2010
Hudson script for running selenium tests
View gist:359405
#!/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 / celeryd_rotate
Created May 17, 2010
logrotate.d configuration for celery
View celeryd_rotate
/var/log/celery/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
copytruncate
}
@winhamwr
winhamwr / hud_run_unittests.sh
Created Jun 11, 2010
Hudson: Run unittests
View hud_run_unittests.sh
#!/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 Jun 28, 2010
Hudson: Generate coverage data
View hud_gen_coverage.sh
#!/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
View test_case.py
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)
View arduino RGB LEDs over serial
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 Dec 21, 2010
HTML normalization to allow for consistent comparison of HTML
View normalize_html.js
/**
* 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) {
@winhamwr
winhamwr / kegbot.conf
Created Jan 10, 2011
supervisord configuration for kegbot
View kegbot.conf
[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
View button.html
<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 Mar 28, 2011
Example file for simplified running of nosedjango tests for a project
View run_tests.py
#! /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')