Skip to content

Instantly share code, notes, and snippets.

View virtix's full-sized avatar
💭
I may be slow to respond.

bill shelton virtix

💭
I may be slow to respond.
View GitHub Profile
@virtix
virtix / find.Examples
Created March 18, 2012 10:58
From man pages
EXAMPLES
find /tmp -name core -type f -print | xargs /bin/rm -f
Find files named core in or below the directory /tmp and delete them. Note that this will work incorrectly if
there are any filenames containing newlines, single or double quotes, or spaces.
find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f
Find files named core in or below the directory /tmp and delete them, processing filenames in such a way that
file or directory names containing single or double quotes, spaces or newlines are correctly handled. The -name
$PORT = 4444
#start server
java -jar selenium-server-standalone.jar port=$PORT
#stop server
wget http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer
@virtix
virtix / sauce_browsers_coordination.py
Created February 8, 2012 19:51 — forked from santiycr/sauce_browsers_coordination.py
Coordinate multiple browsers in Sauce OnDemand using threads
from threading import Thread
from selenium import selenium
import time
try:
import json
except ImportError:
import simplejson as json
USERNAME = "USERNAME"
ACCESS_KEY = "ACCESS-KEY"
@virtix
virtix / webdriver_grid_cmd_line_help.md
Created January 20, 2012 11:50
WebDriver Commandline Help formatted for Markdown

To use as a standalone server

Usage: java -jar selenium-server.jar [-interactive] [options]

  • port <nnnn>: the port number the selenium server should use (default 4444)

  • timeout <nnnn>: an integer number of seconds before we should give up

@virtix
virtix / jquery-dynamic-form.js
Created November 21, 2011 11:48
Trying to do a many-to-may model in django
/**
* @copyright
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@virtix
virtix / TestSimpleHttpNTLMConnection.java
Created November 4, 2011 20:46
Simple HttpClient 4.1 that performs an HTTP GET request through NTLM v2
package test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;
@virtix
virtix / CoverageTest.java
Created October 25, 2011 11:13
Shows how statement coverage can be higher than branch coverage. This is an inverse subsumption relation.
package test;
import static org.junit.Assert.*;
import org.junit.Test;
import junit.framework.TestCase;
public class CoverageTest {
//mutation-driven
//cause an error; the program should deal with the negative number
@Test
public void testPurchasesWithNegativeNumbers(){
DiscountCalculator calc = new DiscountCalculator();
dayZero.set(2011, Calendar.JANUARY, 15, 0, 8, 45);
Account winner = a(d(-19), d(-4), p("reggae", 8, d(-12)), p("rock-a-billy", -10, d(-7)));
Discount d = calc.getSpecialDiscount(winner, d(-1));
//System.out.println( d.getDiscount() );
assertEquals("Probably should throw exception on purchases with negative amounts.", d.getDiscount().multiply(new BigDecimal(100)).intValue());
@virtix
virtix / search.html
Created October 2, 2011 17:37
random name data in jas
<html>
<head>
<title>JS search algorithm</title>
<script>
peeps =[
{'Abraham G. Kerr'=[]},
{'Abraham T. Leon'=[]},
{'Adena A. Fox'=[]},
{'Adrian B. Stafford'=[]},
package edu.gmu.mut;
import java.util.ArrayList;
import java.util.Calendar;
/**
* Class Account represents an immutable customer account.
*/
public class Account {