Skip to content

Instantly share code, notes, and snippets.

@dmorgantini
dmorgantini / monitor_network.sh
Last active Jan 19, 2016
Execute this to ensure that your macbook pro resets the DHCP lease each time your macbook pro decides to drop the wifi connection.
View monitor_network.sh
#!/bin/bash
FAIL_COUNT=0
TIME=1
while true; do
ping -c 1 -t 1 google.com > /dev/null
if [ $? -ne 0 ]; then
@dmorgantini
dmorgantini / DropWizardAdminResource.java
Last active Aug 13, 2020
Dropwizard App with Admin Resource
View DropWizardAdminResource.java
public class TemplateApplication extends Application<ServiceConfiguration> {
public static void main(String[] args) throws Exception {
new TemplateApplication().run(args);
}
@Override
public void run(ServiceConfiguration configuration, Environment environment) throws Exception {
@dmorgantini
dmorgantini / DateTimeDeserializer.java
Created Nov 20, 2012
Joda Datetime with dropwizard (0.6.0-SNAPSHOT)
View DateTimeDeserializer.java
public class DateTimeDeserializer extends JsonDeserializer<DateTime> {
@Override
public DateTime deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
if (jp.getCurrentToken() == JsonToken.VALUE_NUMBER_INT) {
return new DateTime(jp.getLongValue());
}
throw ctxt.mappingException("Expected JSON Number");
}
View AddNumbersService.java
package com.example.helloworld.resources;
import javax.jws.WebMethod;
@javax.jws.WebService(
name = "AddNumbersPortType",
serviceName = "AddNumbersService",
targetNamespace = "http://duke.example.org")
@javax.jws.soap.SOAPBinding(
style = javax.jws.soap.SOAPBinding.Style.DOCUMENT,