Skip to content

Instantly share code, notes, and snippets.

View alexlehm's full-sized avatar

Alexander Lehmann alexlehm

View GitHub Profile
verbose: true;
foreground: true;
inetd: false;
numeric: true;
transparent: true;
timeout: 2;
#user: "sslh";
pidfile: "/home/alexlehm/run/sslh.pid";
#chroot: "/var/empty";
@alexlehm
alexlehm / deploy.ps1
Created September 24, 2023 01:44
Post a file to a URL with Powershell
# upload file with form-data to a URL using powershell
# this works with binary files, no conversion happens to the file
#
# this can be used to deploy files on Appveryor
$File='result.zip';
$FilePath = Get-Item -Path $File;
$URL = "https://example.com/upload.php";
$fileBytes = [System.IO.File]::ReadAllBytes($FilePath);
@alexlehm
alexlehm / fact.pl
Last active October 25, 2018 19:23
720! calculation with Perl and bigint
#! /usr/bin/perl
use bigint;
$f=1;
for($i=1;$i<=720;$i++) {
$f*=$i;
}
@alexlehm
alexlehm / AsyncTest.java
Last active May 25, 2017 10:38
AsyncTest.java
package cx.lehmann.vertx;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
@alexlehm
alexlehm / HttpKeepAliveClientTest.java
Created May 14, 2017 11:44
HttpKeepAliveClientTest.java
package cx.lehmann.vertx;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClient;
import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
@alexlehm
alexlehm / HttpKeepAliveClientTest.java
Created May 10, 2017 21:18
HttpKeepAliveClientTest.java
package cx.lehmann.vertx;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClient;
import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
diff --git a/src/test/java/httpclientpool/HttpClientPoolTest.java b/src/test/java/httpclientpool/HttpClientPoolTest.java
index 9a0e7d0..e5d0abe 100644
--- a/src/test/java/httpclientpool/HttpClientPoolTest.java
+++ b/src/test/java/httpclientpool/HttpClientPoolTest.java
@@ -21,6 +21,7 @@ import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
+import static org.mockserver.matchers.Times.exactly;
@alexlehm
alexlehm / Log4j2LogDelegate.java
Created September 21, 2016 20:41
Log4j2LogDelegate.java
/*
* Copyright (c) 2011-2015 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
@alexlehm
alexlehm / LoginServiceTest.java
Created September 2, 2016 13:01
LoginServiceTest.java
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClientRequest;
import io.vertx.core.logging.Logger;
@alexlehm
alexlehm / DnsNameResolver.java
Created August 9, 2016 22:27
DnsNameResolver.java
/*
* Copyright 2015 The Netty Project
*
* The Netty Project 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
*
* Unless required by applicable law or agreed to in writing, software