Skip to content

Instantly share code, notes, and snippets.

@matthauck
matthauck / JerseyConfig.java
Last active August 29, 2015 14:03
jersey2 spring bridge
package com.foo;
import javax.inject.Inject;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.context.ApplicationContext;
public class JerseyConfig extends ResourceConfig {
@matthauck
matthauck / build.gradle
Created July 15, 2014 06:39
Run spring-boot jar from gradle
task(boot, dependsOn: bootRepackage) << {
exec {
executable = 'java'
args = [ '-jar', jar.archivePath ]
}
}
@matthauck
matthauck / global_ca_hack.rb
Created June 21, 2012 23:04
Net::HTTP global ca hack
require 'net/http'
module Net
class HTTP
# Creates a new Net::HTTP object for the specified +address+.
# This method does not open the TCP connection.
def initialize(address, port = nil)
@address = address
@port = (port || HTTP.default_port)
@matthauck
matthauck / gist:4563666
Created January 18, 2013 10:25
utf-8 broken in jruby 1.7.2 windows
# encoding: utf-8
require 'tempfile'
def valid_utf8(str)
str.encoding == Encoding::UTF_8 && str.valid_encoding?
end
str = <<-EOF
My UTF-8 String: ✓ ®

Keybase proof

I hereby claim:

  • I am matthauck on github.
  • I am matthauck (https://keybase.io/matthauck) on keybase.
  • I have a public key whose fingerprint is CC51 505B 00FE E248 09D1 71F2 F313 3993 866C CD32

To claim this, I am signing this object:

[root]
name = "iron-issue-444"
version = "0.1.0"
dependencies = [
"env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"router 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@matthauck
matthauck / TomcatPlugin.groovy
Created August 26, 2013 06:40
simple gradle forking tomcat plugin (intended to be put in buildSrc)
package com.foo
import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.GradleException
import org.gradle.api.file.FileCollection
import org.gradle.api.tasks.TaskAction
import org.gradle.api.plugins.WarPlugin
use std::sync::Arc;
use std::sync::mpsc::{SyncSender, sync_channel};
use std::thread;
use futures::{self, Async, Future};
use futures::executor::{Notify, Spawn};
pub type VoidFuture = Box<Future<Item = (), Error = ()>>;
pub fn consume(mut fut: VoidFuture) {
@matthauck
matthauck / Cargo.lock
Last active September 25, 2018 21:59
Nested futures deadlock
[[package]]
name = "arrayvec"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bitflags"
@matthauck
matthauck / 1. run.sh
Created October 7, 2018 20:45
pihole and cloudflared on docker
#!/bin/bash
set -e
pushd cloudflared
docker build . -t cloudflared
popd
set +e