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 / cfpb-source-code-policy.txt
Created April 9, 2012 14:34 — forked from CFPBadmin/cfpb-source-code-policy.txt
Consumer Financial Protection Bureau Source Code Policy
1. USE OF EXTERNAL OPEN SOURCE SOFTWARE
a) "Open Source Software" (OSS) is software that allows its recipients to modify and redistribute the source code; as such, "open source" is a copyright and distribution framework and makes no implications regarding technical support or indemnification. In almost all cases, OSS meets the definition of "commercial computer software" and shall be given appropriate statutory preference in accordance with 41 USC 264B (reference (b)) (see also FAR 2.101(b), 12_1.html 12.000, 12.101 (reference (c))).
b) Executive agencies, including CFPB, are required to conduct market research when preparing for the procurement of products or services by 41 USC Sec. 253a (reference (e)) (see also FAR 10.001. Market research for software should include OSS.
a. There are several positive aspects of OSS that should compel CFPB to seek out OSS when conducting market research on software for Bureau-wide use:
i. Publicly available source code enables continuous and broad peer review that
@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'=[]},