Skip to content

Instantly share code, notes, and snippets.

View hasalex's full-sized avatar

Alexis Hassler hasalex

View GitHub Profile
#!/bin/bash
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
#export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
# Retrouver le répertoire d'installation de Java
export JAVA_HOME=`update-java-alternatives -l | grep java-6-openjdk | awk '{ print $3 }'`
--
-- Create schema university
--
CREATE DATABASE IF NOT EXISTS university;
USE university;
CREATE TABLE `university`.`course` (
`id` int(11) NOT NULL auto_increment,
`code` varchar(10) NOT NULL,
`name` varchar(30) NOT NULL,
@hasalex
hasalex / create-cert.sh
Last active November 4, 2022 15:59
Tomcat 9 configuration, with HTTP/2
# Commun pour le connecteur APR et les connecteurs classiques
openssl req -newkey 2048 -nodes -keyout conf/tomcat.key -x509 -days 365 -out conf/tomcat.crt -config conf/openssl.cnf
# Inutile pour le connecteur APR
openssl pkcs12 -inkey conf/tomcat.key -in conf/tomcat.crt -export -out conf/tomcat.pfx
@hasalex
hasalex / undertow-http2
Created September 28, 2017 19:26
HTTP, HTTPS, HTTP2 avec Undertow
package fr.sewatech.demo.http2.undertow;
import io.undertow.Undertow;
import io.undertow.UndertowOptions;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.Headers;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import java.security.KeyStore;
persons.stream()
.filter(Person::isMale)
.filter(p -> p.isAdult(LocalDate.now()))
.map(p -> p.getFirstName() + " " + p.getLastName())
.collect(Collectors.toList());
dn: dc=sewatech,dc=fr
objectClass: top
objectClass: domain
dc: sewatech
dn: ou=people,dc=sewatech,dc=fr
objectClass: top
objectClass: organizationalUnit
ou: people
@hasalex
hasalex / gist:7430048
Created November 12, 2013 12:30
Arquillian Maven Resolver
public class Deployments {
public static final String WEBAPP_SRC = "src/main/webapp";
public static WebArchive deploy() {
File[] requiredLibraries = Maven.resolver().loadPomFromFile("pom.xml")
.resolve("com.google.guava:guava", "org.codehaus.jackson:jackson-mapper-asl")
.withTransitivity().asFile();
return ShrinkWrap.create(WebArchive.class)
.addPackages(true, JsonServlet.class.getPackage())
@hasalex
hasalex / ldap-security-domain.cli
Created June 24, 2013 22:13
jboss-cli script for configuring LDAP configuration in WildFly with OpenDJ
batch
/subsystem=security/security-domain=swmsg-xxx:add(cache-type=default)
/subsystem=security/security-domain=swmsg-xxx/authentication=classic:add()
/subsystem=security/security-domain=swmsg-xxx/authentication=classic/login-module=LdapExtended:add(code=LdapExtended, flag=required, module-options={"java.naming.provider.url"=>"ldap://127.0.0.1:1389/","bindDN"=>"cn=Sewatech","bindCredential"=>"aa","baseCtxDN"=>"ou=people,dc=sewatech,dc=fr","baseFilter"=>"(uid={0})","rolesCtxDN"=>"ou=groups,dc=sewatech,dc=fr","roleFilter"=>"(uniqueMember={1})","roleAttributeID"=>"cn"})
run-batch
@hasalex
hasalex / build-wildfly-800alpha2.sh
Last active December 18, 2015 21:59
Bash script for building WildFly AS 8.0.0 Alpha2 : bash <(curl -s https://raw.github.com/gist/5851579)
# Building WildFly AS 8.0.0.Alpha2
wget https://github.com/wildfly/wildfly/archive/8.0.0.Alpha2.tar.gz
tar -xf 8.0.0.Alpha2.tar.gz
cd wildfly-8.0.0.Alpha2
./build.sh -DskipTests -T1C -Drelease=true # -Drelease=true creates the distribution archives
# -DskipTests can be omitted but build would be much longer
# -T1C launches one build thread per processor ; it should be used only when -DskipTests is on
# Copy the binaries
cp -R build/target/wildfly-8.0.0.Alpha2 /opt/java/
@hasalex
hasalex / gist:5842614
Last active December 18, 2015 20:48
LDIF export of a OpenDJ simple content, related to gist:5842518
dn: dc=sewatech,dc=fr
objectClass: domain
objectClass: top
dc: sewatech
dn: ou=people,dc=sewatech,dc=fr
objectClass: organizationalUnit
objectClass: top
ou: people