Skip to content

Instantly share code, notes, and snippets.

View kevints's full-sized avatar

Kevin Sweeney kevints

View GitHub Profile
@kevints
kevints / backup_repl.py
Created March 27, 2015 21:02
Aurora Backup REPL
"""A REPL for performing ad-hoc analysis of Aurora storage backups."""
import code
from twitter.common import app
from gen.apache.aurora.storage.ttypes import Snapshot, TBinaryProtocol
from thrift.transport import TTransport
@kevints
kevints / gist:1a1279e6ce4d7ec650e0
Created March 23, 2015 18:31
pesos test failure
% tox
GLOB sdist-make: /home/ksweeney/workspace/pesos/setup.py
py26 create: /home/ksweeney/workspace/pesos/.tox/py26
py26 installdeps: compactor[pb]==0.2.1, futures==2.1.6, mesos.interface==0.21.1, pytest, mock
py26 inst: /home/ksweeney/workspace/pesos/.tox/dist/pesos-0.2.0.zip
py26 runtests: PYTHONHASHSEED='2061337895'
py26 runtests: commands[0] | py.test tests
========================================================================= test session starts =========================================================================
platform linux2 -- Python 2.6.9 -- py-1.4.26 -- pytest-2.6.4
collected 18 items
@kevints
kevints / test_virtualenv.sh
Created February 6, 2015 22:16
Install aurora client into a virtualenv
./pants setup-py --recursive src/main/python/apache/aurora/client:client-packaged
./build-support/virtualenv aurora.venv
source aurora.venv/bin/activate
pip install -f dist --pre apache.aurora.client==0.7.1-SNAPSHOT
aurora --help
@kevints
kevints / FinagleFutures.java
Last active August 29, 2015 14:09
Finagle version of guava's Futures
package com.github.kevints.finaglefutures;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import com.google.common.base.Throwables;
import com.twitter.util.Await;
import com.twitter.util.Duration;
import com.twitter.util.Future;
@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;
@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 / 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 / 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;
# 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 / .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