Skip to content

Instantly share code, notes, and snippets.

View kevints's full-sized avatar

Kevin Sweeney kevints

View GitHub Profile
# Voting-Age population of each state
# From https://www.federalregister.gov/documents/2017/01/30/2017-01890/estimates-of-the-voting-age-population-for-2016
cat > vap.tsv <<EOF
3766477 Alabama
554567 Alaska
5299579 Arizona
2283195 Arkansas
30157154 California
4279173 Colorado
2823158 Connecticut

Keybase proof

I hereby claim:

  • I am kevints on github.
  • I am kts (https://keybase.io/kts) on keybase.
  • I have a public key whose fingerprint is EC64 F815 4FF6 FE68 59E4 6E5B 06BC 75B8 866B 1734

To claim this, I am signing this object:

struct Example {
1: required i32 requiredNum
2: optional i32 optionalNum
3: i32 defaultNum
4: i32 defaultedNum = -1
}
@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
@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 / 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;