Skip to content

Instantly share code, notes, and snippets.

View kevints's full-sized avatar

Kevin Sweeney kevints

View GitHub Profile
@kevints
kevints / GsonTest.java
Created August 27, 2015 16:57
Testing GSON defaults - gson rev is 2.3.1
package org.apache.aurora.scheduler.http;
import java.util.List;
import com.google.gson.Gson;
import org.junit.Test;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
@kevints
kevints / output.txt
Created August 27, 2015 19:34
default profile values in pystachio (Aurora configs)
% cat test.aurora
class Profile(Struct):
a = Default(Integer, 1)
jobs = [
Job(role = 'a', environment = 'devel', name = 'c', cluster='devcluster',
task = SimpleTask('t', 'echo {{profile.a}}')).bind(profile=Profile()),
% aurora job inspect devcluster/a/devel/c test.aurora
Job level information
~aurora git aurora/. master
% jython -V
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=utf8
Jython 2.7b1
~aurora git aurora/. master
% JYTHONPATH=/tmp/aurora_client jython -m __main__
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=utf8
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/ksweeney/jython2.7b1/Lib/runpy.py", line 175, in run_module
@kevints
kevints / .xinputrc
Created May 5, 2014 22:12
Natural Scrolling on Ubuntu 14.04
# Natural Scrolling
xinput set-button-map 'Logitech USB Laser Mouse' 1 2 3 5 4 6 7 8 9 10 11 12 13 14 15 16
@kevints
kevints / .vimrc
Last active August 29, 2015 14:04
.vimrc
set nocompatible
if $COLORTERM == 'gnome-terminal'
set t_Co=256
endif
execute pathogen#infect()
syntax on
filetype plugin indent on
# The (insecure) default: user=mesos, password=mesos, roles=[root]
[users]
mesos = mesos, mesos, root
# Mapping of roles to permissions.
[roles]
# Root can fully administer the cluster.
root = *
# The Host Maintainer can prevent scheduling tasks on slaves (to prepare them for disruptive
# maintenance).
@kevints
kevints / SecureSchedulerMain.java
Created September 2, 2014 20:39
Minimum-viable shiro+guice+jersey webapp
package org.apache.aurora.scheduler.app;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@kevints
kevints / SecureSchedulerMain.java
Created September 2, 2014 21:19
MVP of twitter.common.application+guice+jetty+shiro+jersey
package org.apache.aurora.scheduler.app;
import java.util.Arrays;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
@kevints
kevints / TimedRule.java
Created October 10, 2014 21:34
PMD rule to enforce Guice AOP limitations (untested)
package org.apache.aurora.pmd;
import net.sourceforge.pmd.lang.java.ast.ASTAnnotation;
import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBodyDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTName;
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
import net.sourceforge.pmd.lang.symboltable.NameDeclaration;
@kevints
kevints / GuiceTest.java
Created October 13, 2014 19:56
requireBinding is a DRY violation
import javax.inject.Inject;
import javax.inject.Named;
import com.google.inject.AbstractModule;
import com.google.inject.CreationException;
import com.google.inject.Guice;
import com.google.inject.Key;
import com.google.inject.name.Names;
import org.junit.Test;