Navigation Menu

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
@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 / 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>
<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 / 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 / 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
@albertoaflores
albertoaflores / ConfigServerApplication.java
Created April 21, 2017 20:30
Sample Spring Cloud Config Server
package io.cybertech.boot.sample;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {
@albertoaflores
albertoaflores / create-sample-key-file.sh
Created April 21, 2017 20:44
Creates a key using JDK's keytool. It's used to encrypt/decrypt values.
ALIAS_NAME="mytestkey"
KEYSTORE_SECRET="changeme"
KEYSTORE_PASSWORD="letmein"
VALIDITY_TIME=365
echo "Creating server key, valid for $VALIDITY_TIME days"
keytool -genkeypair -alias $ALIAS_NAME -keyalg RSA \
-dname "CN=Web Server,OU=Unit,O=Organization,L=City,S=State,C=US" \
-keypass $KEYSTORE_SECRET -keystore server.jks -storepass $KEYSTORE_PASSWORD \
-validity $VALIDITY_TIME