Skip to content

Instantly share code, notes, and snippets.

View albertoaflores's full-sized avatar
💭
Hacking some Open Source

Alberto Flores albertoaflores

💭
Hacking some Open Source
View GitHub Profile
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
<attributes>
</classpathentry>
@albertoaflores
albertoaflores / project.xml
Created June 13, 2012 12:53
Sample .project file in eclipse to add facets when not it's not added before
<projectDescription>
<name>myproject</name>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments></arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments></arguments>
@albertoaflores
albertoaflores / org.eclipse.wst.common.component.xml
Created June 13, 2012 12:54
Sample WTP file to enable projects to load from eclipse to a server
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="myWebApp">
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="myCoolWebapp"/>
<property name="java-output-path"/>
</wb-module>
</project-modules>
@albertoaflores
albertoaflores / standalone.xml
Created June 18, 2012 19:12
Proper configuration for 2-way SSL in JBOSS 7.1.1.
...
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="http" secure="true">
<ssl key-alias="foo" password="YOUR_KEYSTORE_PASSWORD"
certificate-key-file="YOUR_KEYSTORE_FILE"
verify-client="true"
ca-certificate-file="YOUR_TRUSTORE_FILE"
ca-certificate-password="YOUR_TRUSTORE_PASSWORD"
truststore-type="YOUR_TRUSTORE_TYPE"/>
@albertoaflores
albertoaflores / .mavenrc
Created July 3, 2012 12:27
Sample .mavenrc file for SSL connections
MAVEN_OPTS="-Djavax.net.ssl.keyStore=<YOU KEYSTORE FILE> \
-Djavax.net.ssl.keyStorePassword=<YOUR KEYSTORE PASSWORD> \
-Djavax.net.ssl.keyStoreType=JKS \
-Djavax.net.ssl.trustStore=<YOUR TRUSTSTORE FILE> \
-Djavax.net.ssl.trustStorePassword=<YOUR TRUSTSTORE PASSWORD> \
-Djavax.net.ssl.trustStoreType=JKS"
@albertoaflores
albertoaflores / sample-surefire-pom.xml
Created July 3, 2012 12:42
Sample pom.xml showing configuration of the surefire maven plugin using SSL (and debug flags)
...
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertiesVariables>
<property>
<name>ssl.debug</name>
<value>true</value>
</property>
<property>
@albertoaflores
albertoaflores / open_jdk_jre.yml
Created March 30, 2015 20:33
Snippet of the open_jdk_jre.yml file needed for OWF
---
repository_root: "{default.repository.root}/openjdk/{platform}/{architecture}"
version: 1.7.0_+
memory_sizes:
metaspace: 64m..
permgen: 64m..
@albertoaflores
albertoaflores / tomcat.yml
Created March 30, 2015 20:37
Snippet of changes made to tomcat.yml to support OWF
---
tomcat:
version: 7.0.+
repository_root: "{default.repository.root}/tomcat"
lifecycle_support:
version: 2.+
repository_root: "{default.repository.root}/tomcat-lifecycle-support"
@albertoaflores
albertoaflores / SurveyEndpoint.java
Last active March 4, 2017 11:25
Sample REST endpoint with non 200 response and no Exception
@RequestMapping("/{surveyId}")
public Survey findSurvey(@PathVariable String surveyId, HttpServletResponse response) {
log.info("Querying survey {}", surveyId);
Survey survey = repository.get(surveyId);
if (survey == null) {
log.warn("Survey {} was not found!", surveyId);
response.setStatus(404);
}
return survey;
}
@albertoaflores
albertoaflores / .gitconfig
Last active March 4, 2017 11:38
Sample aliases in my gitconfig
[alias]
lg= log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
#quick look at all repo
loggsa = log --color --date-order --graph --oneline --decorate --simplify-by-decoration --all
#quick look at active branch (or refs pointed)
loggs = log --color --date-order --graph --oneline --decorate --simplify-by-decoration
#extend look at all repo
logga = log --color --date-order --graph --oneline --decorate --all