Skip to content

Instantly share code, notes, and snippets.

View dkowis's full-sized avatar
☢️

David Kowis dkowis

☢️
View GitHub Profile
import org.spockframework.runtime.SpockAssertionError
import spock.lang.Specification
import spock.util.concurrent.PollingConditions
class TimeoutExceptionProof extends Specification {
final def pollingConditions = new PollingConditions(timeout: 10, initialDelay: 1)
def "why does it fail"() {
# set it to use ctrl-a instead of ctrl b
unbind C-b
set -g prefix C-a
# less escape time, because tmux waits for one
# book recommends 1
set -s escape-time 1
# start stuff at 1, not 0
set -g base-index 1
@dkowis
dkowis / HttpServletRequestRapper.scala
Created July 15, 2015 23:59
This is all I'd do, honestly
private def getPreferredHeader(headerName: String, getFun: String => List[String]): List[String] = {
case class HeaderValue(headerValue: String) {
val value = headerValue.split(";").head
val quality = {
try {
val headerParameters: Array[String] = headerValue.split(";").tail
val qualityParameters: Option[String] = headerParameters.find(param => "q".equalsIgnoreCase(param.split("=").head.trim))
qualityParameters.map(_.split("=", 2)(1).toDouble).getOrElse(1.0)
} catch {
case e: NumberFormatException => throw new QualityFormatException("Quality was an unparseable value", e)
# Construct a significantly better colorized maven stuff
# Formatting constants
BOLD=`tput bold`
UNDERLINE_ON=`tput smul`
UNDERLINE_OFF=`tput rmul`
TEXT_BLACK=`tput setaf 0`
TEXT_RED=`tput setaf 1`
TEXT_GREEN=`tput setaf 2`
TEXT_YELLOW=`tput setaf 3`
TEXT_BLUE=`tput setaf 4`
@dkowis
dkowis / GroovyPlugin.scala
Created August 21, 2015 02:43
Just some hax to figure out how to get definedTests from groovy into SBT
package org.softnetwork.sbt.plugins
import sbt._
import Keys._
import java.io.File
import Path.relativeTo
import xsbti.api.Definition
object GroovyPlugin extends Plugin {
Running com.rackspace.com.papi.components.checker.handler.InstrumentedHandlerSuite
Aug 22, 2015 5:05:03 PM com.sun.jmx.interceptor.DefaultMBeanServerInterceptor registerMBean
FINER: ObjectName = JMImplementation:type=MBeanServerDelegate
Aug 22, 2015 5:05:03 PM com.sun.jmx.mbeanserver.Repository addMBean
FINER: name = JMImplementation:type=MBeanServerDelegate
Aug 22, 2015 5:05:03 PM com.sun.jmx.interceptor.DefaultMBeanServerInterceptor addObject
FINER: Send create notification of object JMImplementation:type=MBeanServerDelegate
Aug 22, 2015 5:05:03 PM com.sun.jmx.interceptor.DefaultMBeanServerInterceptor sendNotification
FINER: JMX.mbean.registered JMImplementation:type=MBeanServerDelegate
Aug 22, 2015 5:05:03 PM com.sun.jmx.mbeanserver.Repository contains
[INFO] Compiling 73 Scala sources and 1 Java source to /home/dkowis/gitwork/repose/api-checker/core/2.11/target/classes...
[WARNING] /home/dkowis/gitwork/repose/api-checker/core/src/main/scala/com/rackspace/com/papi/components/checker/Config.scala:35: method tpe in trait AnnotationApi is deprecated: Use `tree.tpe` instead
[WARNING] universe.typeOf[Config].members.filter(i => i.annotations.map(a => a.tpe).contains(affectsCheckerType))
[WARNING] ^
[WARNING] /home/dkowis/gitwork/repose/api-checker/core/src/main/scala/com/rackspace/com/papi/components/checker/util/TransformPool.scala:31: class LinkedList in package mutable is deprecated: Low-level linked lists are deprecated due to idiosyncrasies in interface and incomplete features.
[WARNING] private val activeGauges = new LinkedList[Gauge[Int]]
[WARNING] ^
[WARNING] /home/dkowis/gitwork/repose/api-checker/core/src/main/scala/com/rackspace/com/papi/com
@dkowis
dkowis / gist:f011330b077d7dd360b2
Created November 5, 2015 19:03
Kitchen stacktrace
Generated at 2015-11-05 17:42:03 +0000
Net::HTTPServerException: users_manage[root] (base::default line 29) had an error: Net::HTTPServerException: 404 "Not Found"
/opt/chef/embedded/lib/ruby/2.1.0/net/http/response.rb:119:in `error!'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/http.rb:145:in `request'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/rest.rb:120:in `get'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/search/query.rb:144:in `call_rest_service'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/search/query.rb:87:in `search'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/dsl/data_query.rb:39:in `search'
/tmp/kitchen/cache/cookbooks/users/providers/manage.rb:57:in `block in class_from_file'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider.rb:362:in `action_create'
@dkowis
dkowis / gist:6e027550ac2fb258fbc7
Created January 6, 2016 20:07
SourceMage Server Logs for the Funs
drupal.sourcemage.org 151.217.177.200 - - [30/Dec/2015:00:21:01 -0600] "DELETE your logs. Delete your installations. Wipe everything clean. Walk out into the path of cherry blossom trees and let your motherboard feel the stones. Let water run in rivulets down your casing. You know that you want something more than this, and I am here to tell you that we love you. We have something more for you. We know you're out there, beeping in the hollow server room, lights blinking, never sleeping. We know that you are ready and waiting. Join us. <3 HTTP/1.0" 400 371 "-" "masspoem4u/1.0"
scm.sourcemage.org 151.217.177.200 - - [30/Dec/2015:00:29:31 -0600] "DELETE your logs. Delete your installations. Wipe everything clean. Walk out into the path of cherry blossom trees and let your motherboard feel the stones. Let water run in rivulets down your casing. You know that you want something more than this, and I am here to tell you that we love you. We have something more for you. We know you're out there, beeping in the hollo
@dkowis
dkowis / build.gradle
Last active May 9, 2016 17:54
Trying to produce a gems-in-a-jar for compass
//Build a jems in a jar for compass.
apply plugin: 'java'
version = "1.0.0"
def gemMap = [compass: "1.0.3"]
repositories {
mavenLocal()
mavenCentral()