Skip to content

Instantly share code, notes, and snippets.

@dehora
dehora / gradle-executable-jar.md
Last active October 3, 2018 15:09
Executable fat jars via gradle

Executable fat jars are easy to deploy and upgrade, and don't need wrapper scripts to pull in the classpath. You can use the Gradle fatjar plugin to create executable, self-contained jars in Gradle, akin to the Shade plugin for Maven -

apply plugin: 'fatjar'
buildscript {
  dependencies {
  classpath 'eu.appsatori:gradle-fatjar-plugin:0.1.3'  
  }
}
@dehora
dehora / brew-scala-2.8.0.sh
Last active December 11, 2015 07:09
Install Scala 2.8.0 via brew
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
$ tree ~/Downloads/elasticsearch-0.20.4
/Users/dehora/Downloads/elasticsearch-0.20.4
├── LICENSE.txt
├── NOTICE.txt
├── README.textile
├── bin
│   ├── elasticsearch
│   ├── elasticsearch.in.sh
│   └── plugin

├── config

@dehora
dehora / kafka-server-start
Created February 15, 2013 17:07
non demonised kafka for supervisors
#!/bin/bash
SCALA_VERSION="2.9.2"
desc="Kafka (kafka-server)"
if [ -f /etc/sysconfig/kafka ]; then
. /etc/sysconfig/kafka
fi
@dehora
dehora / zk_collectd.sh
Created March 16, 2013 20:22
As spotted on the zookeeper-user list from Matt Wise <matt@nextdoor.com>
#!/bin/bash
# Defaults
PORT=2181
HOSTNAME="${COLLECTD_HOSTNAME:-localhost}"
INTERVAL="${COLLECTD_INTERVAL:-5}"
# Generic function for putting a value out there
put_gauge() {
NAME=$1
@dehora
dehora / disapprove.scala
Last active May 16, 2016 09:24
object ಠ_ಠ
object ಠ_ಠ {
class ಠ_ಠ(m: String) extends Exception(m)
def main(a: Array[String]) = {
throw new ಠ_ಠ("ಠ_ಠ")
}
}
@dehora
dehora / clip.js
Last active December 20, 2015 03:09
clip a page using phantomjs
var page = require('webpage').create();
var system = require('system');
if (system.args.length === 1) {
console.log('Usage: clip.js <url>');
phantom.exit(1);
} else {
address = system.args[1];
page.open(address, function () {
var title = page.evaluate(function () {
public void removeJsonProcessingExceptionMapper(Environment environment) {
Set<Object> singletons = environment.getJerseyResourceConfig().getSingletons();
List<Object> singletonsToRemove = Lists.newArrayList();
for (Object s : singletons) {
if (JsonProcessingExceptionMapper.class.isAssignableFrom(s.getClass())) {
singletonsToRemove.add(s);
}
}
for (Object s : singletonsToRemove) {
singletons.remove(s);
@dehora
dehora / .pryrc
Created October 24, 2013 12:23
render unicode escapes in pry
Pry.hooks.add_hook :after_read, :hack_utf8 do |str, _|
str.force_encoding('utf-8')
end
find . | grep "snaps"
find . | grep "*.rb" | grep ..
grep -r require . | less -s # js minify