Skip to content

Instantly share code, notes, and snippets.

View leonelag's full-sized avatar

Leonel leonelag

  • Sorocaba - Brazil
View GitHub Profile
@leonelag
leonelag / SSLPoke.java
Last active December 11, 2015 17:18
Checks that the Java runtime is able to connect to and communicate with an SSL server. Useful for checking whether the security key chain contains valid keys.
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {
@leonelag
leonelag / 403.jsp
Created October 4, 2012 12:23
Advanced Spring Security. How to configure Spring beans to set up Spring Security without using the Spring Security namespace.
<%@page contentType="application/json; charset=UTF-8"%>{"status":"nauth","message":"Not authorized."}
@leonelag
leonelag / jetty-env.xml
Created October 4, 2012 11:23
How to add dependencies to a project run with jetty-maven-plugin
<!--
Example of data source configuration for Jetty 8
-->
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/myapp</Set>
@leonelag
leonelag / swank.sh
Created May 17, 2012 19:48
Quickly start a swank-clojure server outside a lein project.
#!/bin/sh
LOCAL_REPO="C:\Users\LLGD\work\maven-repository"
CLOJURE_JAR="$LOCAL_REPO\org\clojure\clojure\1.4.0\clojure-1.4.0.jar"
SWANK_JAR="$LOCAL_REPO\swank-clojure\swank-clojure\1.4.2\swank-clojure-1.4.2.jar"
CLJ_STACKTRACE="$LOCAL_REPO\clj-stacktrace\clj-stacktrace\0.2.4\clj-stacktrace-0.2.4.jar"
$JAVA_HOME/bin/java.exe -cp "$CLJ_STACKTRACE;$SWANK_JAR;$CLOJURE_JAR" clojure.main --eval "(require '[swank.swank])(swank.swank/start-server :port 8000)"
@leonelag
leonelag / index.html
Created April 25, 2012 11:50
Example of how to attach an event to HTML elements
<html>
<head>
<style>
li { border: thin solid red }
</style>
</head>
<body>
<ul>
<li id="my-elem-1">1</li>
<li id="my-elem-2">2</li>
@leonelag
leonelag / pom.xml
Created March 19, 2012 14:30 — forked from anonymous/pom.xml
Prevent m2e error message: Plugin execution not covered by lifecycle configuration
<!-- http://wiki.eclipse.org/M2E_plugin_execution_not_covered#lifecycle_mapping_metadata_provided_by_maven_plugin -->
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>