Skip to content

Instantly share code, notes, and snippets.

@marko-asplund
marko-asplund / Extending LVM based filesystem
Last active November 23, 2016 20:34
Extending LVM based filesystem
# initialize physical device to be used as a physical volume with LVM
# (below we assume the newly added block device was "/dev/sdb")
pvcreate /dev/sdb
# add physical volume to volume group
vgextend ubuntu-vg /dev/sdb
# extend logical volume and file system
lvextend -r /dev/ubuntu-vg/root /dev/sdb
@marko-asplund
marko-asplund / JettyWebApp.java
Created July 19, 2013 20:34
Using Jersey 2 Spring integration prototype with Jetty 9 embedded (with servlet 3.0 annotation support)
package fi.markoa.proto.jersey2.jetty;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext;
public class JettyWebApp {
public static void main(String ... args) throws Exception {
Server server = new Server(8090);
Configuration.ClassList classlist = Configuration.ClassList.setServerDefault(server);
@marko-asplund
marko-asplund / JettyWebApp.java
Created July 19, 2013 07:57
Using Jersey 2 Spring integration prototype with Jetty 9 embedded (without servlet 3.0 annotation support)
package fi.markoa.proto.jersey2.jetty;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
public class JettyWebApp {
public static void main(String ... args) throws Exception {
Server server = new Server(8090);
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/app1");
@marko-asplund
marko-asplund / build.sbt
Created October 31, 2015 22:22
sbt resolvers
organization := "fi.markoa"
name := "sbt-demo"
version := "0.0.1"
scalaVersion := "2.11.7"
libraryDependencies += "org.foo" % "bar" % "10"
package fi.markoa.proto.libload;
import java.io.File;
import java.io.IOException;
import java.net.JarURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.jar.JarEntry;
#!/usr/bin/env python
import sys
import socket
sock = socket.socket()
sock.connect(("127.0.0.1", 26542))
ss = sock.makefile()
for i in range(1, 5000000):
@marko-asplund
marko-asplund / AsyncErrorServlet1.java
Created July 9, 2014 20:37
Servlet 3.1 API / Asynchronous processing / error handling: approach #1
package fi.markoa.experiment.servlet3;
import javax.servlet.AsyncContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@marko-asplund
marko-asplund / AsyncErrorServlet2.java
Last active August 29, 2015 14:03
Servlet 3.1 API / Asynchronous processing / error handling: approach #2
package fi.markoa.experiment.servlet3;
import javax.servlet.AsyncContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;