Skip to content

Instantly share code, notes, and snippets.

glenwatson

Block or report user

Report or block glenwatson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ConfidenceIntervalApp.java
import org.apache.commons.math3.distribution.TDistribution;
import org.apache.commons.math3.exception.MathIllegalArgumentException;
import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
public class ConfidenceIntervalApp {
public static void main(String args[]) {
// data we want to evaluate: average height of 30 one year old male and female toddlers
// interestingly, at this age height is not bimodal yet
double data[] = new double[] { 63.5, 81.3, 88.9, 63.5, 76.2, 67.3, 66.0, 64.8, 74.9, 81.3, 76.2, 72.4, 76.2, 81.3, 71.1, 80.0, 73.7, 74.9, 76.2, 86.4, 73.7, 81.3, 68.6, 71.1, 83.8, 71.1, 68.6, 81.3, 73.7, 74.9 };
View gist:6fcddc1898baca8b9de1
def insert_row_at(self, values, row_idx):
""""Adds a row to the beginning of the worksheet and populates it with values.
Widens the worksheet if there are more values than columns.
:param values: List of values for the new row.
"""
self.add_rows(1)
data_width = len(values)
if self.col_count < data_width:
self.resize(cols=data_width)
@glenwatson
glenwatson / doesntwork
Last active Aug 29, 2015
md() vs. not-md()
View doesntwork
#!/bin/bash
function md() {
mkdir $1 && cd $1
}
View listSnippets.java
public List<Snippet> listSnippets() throws IOException {
verifyRootDirectoryExists();
File[] txtfiles = DIRECTORY.listFiles(new FileFilter() {
public boolean accept(File file) {
return file.isFile() && !file.isHidden() && file.getName().endsWith(".txt");
}
});
File[] titlefiles = DIRECTORY.listFiles(new FileFilter() {
public boolean accept(File file) {
return file.isFile() && !file.isHidden() && title.getName().endsWith(".title");
View hackability.js
String.prototype.hackability = function() {
var toppasswords = /password|123456|12345678|1234|qwerty|12345|dragon|pussy|baseball|football|letmein|monkey|696969|abc123|mustang|michael|shadow|master|jennifer|111111|2000|jordan|superman|harley|1234567|fuckme|hunter|fuckyou|trustno1|ranger|buster|thomas|tigger|robert|soccer|fuck|batman|test|pass|killer|hockey|george|charlie|andrew|michelle|love|sunshine|jessica|asshole|6969|pepper|daniel|access|123456789|654321|joshua|maggie|starwars|silver|william|dallas|yankees|123123|ashley|666666|hello|amanda|orange|biteme|freedom|computer|sexy|thunder|nicole|ginger|heather|hammer|summer|corvette|taylor|fucker|austin|1111|merlin|matthew|121212|golfer|cheese|princess|martin|chelsea|patrick|richard|diamond|yellow|bigdog|secret|asdfgh|sparky|cowboy|camaro|anthony|matrix|falcon|iloveyou|bailey|guitar|jackson|purple|scooter|phoenix|aaaaaa|morgan|tigers|porsche|mickey|maverick|cookie|nascar|peanut|justin|131313|money|horny|samantha|panties|steelers|joseph|snoopy|boomer|whatever|ice
@glenwatson
glenwatson / Arrays.sort.java
Created Mar 21, 2013
Collections.sort() defers to Arrays.sort()
View Arrays.sort.java
/**
* Src is the source array that starts at index 0
* Dest is the (possibly larger) array destination with a possible offset
* low is the index in dest to start sorting
* high is the end index in dest to end sorting
* off is the offset into src corresponding to low in dest
*/
private static void mergeSort(Object[] src,
Object[] dest,
int low, int high, int off,
@glenwatson
glenwatson / gist:2949358
Created Jun 18, 2012
table to unordered list
View gist:2949358
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" ></script>
<script type="text/javascript">
$(document).ready(function()
{
var unorderedGradesList = $('<ul></ul>') //Create the unordered list to put the grades into
.addClass("grades");
$('tr > td').each(function(index, element) //Get the table's contents and loop over them
{
You can’t perform that action at this time.