Skip to content

Instantly share code, notes, and snippets.

@scottopell
scottopell / inline.js
Created March 2, 2016 01:43
Who's Hiring Filter
var keywords = ["NYC", "New York"];
var els = document.getElementsByClassName("athing");
[].forEach.call(els, function(ele){
var regex = new RegExp("\\b" + keywords.join("|") + "\\b");
var elementText = ele.innerHTML; // probably a few false positives, oh well.
if (regex.test(ele.innerHTML)){
ele.style.display = "block";
} else {
ele.style.display = "none";
}
@scottopell
scottopell / readme.md
Last active October 28, 2015 01:36
CS352 Project 4 Testing scripts

Test Scripts

Adapted from Austin Schwartz's scripts that he posted on project 2. https://gist.github.com/nawns/3befd88d5bdd39d43e96

These assume you'll be running from the root of the project (ie, alongside src and bin.) Have the tests inside p4tests/output. See the diagram at the bottom for the intended directory structure.

Usage:

./test.sh t1.mj

Or a prettier version with side by side diff (requires sdiff)

@scottopell
scottopell / discussions_to_explain.md
Last active October 14, 2015 14:35
Explanations of technical systems posed in the form of a discussion in which the design is iterated on.
@scottopell
scottopell / restart_modem.sh
Last active August 29, 2015 14:27
Restart a SB6183 Modem via cURL
curl -X POST -d 'Rebooting=1&RestoreFactoryDefault=0' 'http://192.168.100.1/goform/RgConfiguration.pl'
@scottopell
scottopell / HDFS-8748.patch
Created July 27, 2015 21:46
HDFS 8748 rejected patch
diff --git hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java
index e6570f5..0144ac4 100644
--- hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java
+++ hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java
@@ -20,6 +20,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
// The function is supposed to return false when
// x+y overflows unsigned short.
// Does the function do it correctly?
bool IsValidAddition( unsigned short x,
unsigned short y) {
if (x+y < x)
return false;
return true;
}