Skip to content

Instantly share code, notes, and snippets.

View porcelli's full-sized avatar

Alex Porcelli porcelli

View GitHub Profile
#!/bin/sh
find /Users/porcelli/Documents/dev/osl -name \*.java -type f | \
(while read file; do
iconv -f MacRoman -t UTF-8 $file > tmp.txt;
mv tmp.txt $file
done)
import java.security.InvalidParameterException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
public class RestParser {
final char[] content;
final Map<Integer, String> positionedVariables = new TreeMap<Integer, String>();
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mysql-parser</groupId>
<artifactId>mysql-parser</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<name>MySQL Parser</name>
public static void main(String... args) {
StopWatch sw = new StopWatch();
sw.start();
BigInteger a = new BigInteger("0");
BigInteger b = new BigInteger("1");
for (int i = 0; i < 1e6; i++) {
final BigInteger c = b;
b = a.add(b);
a = c;
public static void main(String... args) throws MuleException {
Mule myMule = Mule.newInstance(new MyModule());
myMule.start(); //start mule
}
public static class MyModule extends AbstractModule { // config module
@Override
protected void configure() {
flow("SimpleFilePollAndMove") //defines a named flow
public static void main(String... args) throws MuleException {
Mule myMule = Mule.newInstance(new AbstractModule() { //creates a new mule instance using an anonymous inner AbstractModule based class
@Override
protected void configure() {
flow("multipleFileMove")
.from("file:///opt/my_app/out") // source folder
.transformTo(byte[].class) //transform file to byte[]
.broadcast() //broadcast the payload to
.send("file:///opt/other_app/in") //destiny folder
.send("file:///opt/crm/in") //destiny folder
public static void main(String... args) throws MuleException {
Mule mule = Mule.newInstance(new AbstractModule() {
@Override
protected void configure() {
flow("SendEmail")
.send("smtp://smtp.mycompany.com:25?address=#[header:address]");
}
});
mule.start(); // start mule
public class GenerateSignatures {
public static void main(String... args) {
Parameter[] values = new Parameter[]{new Parameter("A", "int"), new Parameter("B", "String"), new Parameter("C", "long")};
Parameter[][] result = multiply(values);
for (int i = 0; i < result.length; i++) {
for (int k = 0; k < result[i].length; k++) {
System.out.print(result[i][k].toString() + " ");
DBObject myBuilderContact = BasicDBObjectBuilder.start()
.add("username", "porcelli")
.add("first name", "alexandre")
.add("last name", "porcelli")
.push("address")
.add("st. name", "r. josé ramon urtiza")
.add("number", "181")
.add("complement", "ap. 191B")
.add("city", "são paulo")
.add("country", "brasil")
@porcelli
porcelli / roles.properties
Created April 23, 2012 14:54
Config files for jboss7.0.2 (jboss-as-home/standalone/configuration/) in order to run jbpm-console
admin=admin,manager,user,webdesigner,functionalanalyst
krisv=admin,manager,user
john=admin,manager,user,PM
mary=admin,manager,user,HR
sales-rep=admin,manager,user,sales