Skip to content

Instantly share code, notes, and snippets.

View caseyscarborough's full-sized avatar

Casey Scarborough caseyscarborough

View GitHub Profile
Files for demonstrating custom binding of Jersey resource filters using annotations
public class DomainBlackListTest extends MockedTester {
@Mock public EventBus eb;
@Mock public EventBusSingleton eventBus;
@Before public void initMocks() {
when(eventBus.getEventBus())
.thenReturn(eb);
}
@Test public void simple() {
@caseyscarborough
caseyscarborough / web.xml
Created March 7, 2015 20:21
Grails 2.4.4 web.xml file
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
metadata-complete="true"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>/@grails.project.key@</display-name>
<context-param>

Keybase proof

I hereby claim:

  • I am caseyscarborough on github.
  • I am caseyscarborough (https://keybase.io/caseyscarborough) on keybase.
  • I have a public key whose fingerprint is 2035 2DDD 4020 9F41 B6EA C518 EDF4 0919 672B A1FB

To claim this, I am signing this object:

@caseyscarborough
caseyscarborough / log4j.properties
Created December 7, 2014 20:29
Log4j properties file
# Root logger option
log4j.rootLogger=INFO, stdout
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
@caseyscarborough
caseyscarborough / D2LRipper.java
Last active August 29, 2015 14:00
A Java program I've written used to parse a test bank on Desire2Learn using Selenium and Jsoup, and a Groovy script that sorts the questions, and removes all the duplicates. Not meant to be efficient, just to get all questions from the test bank, an otherwise VERY tedious task.
import org.apache.commons.lang3.StringEscapeUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.safety.Whitelist;
import org.jsoup.select.Elements;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
@caseyscarborough
caseyscarborough / Quine.java
Created April 3, 2014 17:32
A quine, a program that emits takes in no input and outputs it's own source code, written in Java.
public class Quine {
static String[] lines = {
"public class Quine {",
" static String[] lines = {",
" };",
" static String source(String[] lines) {",
" char q = (char) 34;",
" char nl = (char) 10;",
" int edge = 2;",
" int count = 24;",
@caseyscarborough
caseyscarborough / HttpSender.java
Created February 25, 2014 22:49
Example of get and post requests using Java.
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
public class HttpSender {
public static void main(String[] args) throws Exception {
@caseyscarborough
caseyscarborough / b64.c
Last active September 15, 2023 17:02
Base64 implementation in C
/*********************************************************************\
MODULE NAME: b64.c
AUTHOR: Bob Trower 08/04/01
PROJECT: Crypt Data Packaging
COPYRIGHT: Copyright (c) Trantor Standard Systems Inc., 2001
@caseyscarborough
caseyscarborough / rot13.c
Created January 14, 2014 14:34
Encrypts text using the rot13 cipher.
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
char *convert_to_rot13(char *str) {
size_t i;
for (i = 0; i < strlen(str); i++) {
if (str[i] > 64 && str[i] < 91) {
str[i] += str[i] < 78 ? 13 : -13;