Skip to content

Instantly share code, notes, and snippets.

View fabriziofortino's full-sized avatar

Fabrizio Fortino fabriziofortino

View GitHub Profile
@fabriziofortino
fabriziofortino / Rates.java
Last active August 15, 2016 10:15
Swagger schema for Fixer.io
ApiClient apiClient = new ApiClient();
RatesApi api = apiClient.buildClient(RatesApi.class);
Rates rates = api.getLatest("USD", Collections.singletonList("AUD"));
@fabriziofortino
fabriziofortino / RecursiveWatcherService.java
Created June 5, 2016 18:25
Java 8 Recursive WatchService
package com.keepithttps;
import com.sun.nio.file.SensitivityWatchEventModifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
@fabriziofortino
fabriziofortino / execute
Last active August 29, 2015 14:05
orientdb-service-wrapper
$ORIENTDB-HOME/bin/service/orientdb
Usage: ./orientdb [ console | start | stop | restart | condrestart | status | install | remove | dump ]
Commands:
console Launch in the current console.
start Start in the background as a daemon process.
stop Stop if running as a daemon or in another console.
restart Stop if running and then start.
condrestart Restart only if already running.
@fabriziofortino
fabriziofortino / JSONUserType.java
Last active July 21, 2020 08:59
Hibernate JSONUserType with Jackson
package com.keepithttps.hibernate.type;
import java.io.IOException;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Properties;
final OrientGraph graph = new OrientGraph("remote:localhost/mydb", "admin", "admin");
OrientVertex v1 = graph.addVertex("class:TestVertex");
OrientVertex v2 = graph.addVertex("class:TestVertex");
OrientVertex v3 = graph.addVertex("class:TestVertex");
OrientVertex v4 = graph.addVertex("class:TestVertex");
Map<String, Object> p1 = new HashMap<String, Object>();
p1.put("based_on", "0001");
OrientEdge e1 = v1.addEdge(null, v2, "TestEdge", null, p1);
import java.util.HashMap;
import java.util.Map;
import com.orientechnologies.orient.core.command.OCommandResultListener;
import com.orientechnologies.orient.core.sql.OCommandSQL;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.orient.OrientEdge;
@fabriziofortino
fabriziofortino / gist:8864348
Last active August 29, 2015 13:56
OSQLAsynchQuery does not return edges
import com.orientechnologies.orient.core.command.OCommandResultListener;
import com.orientechnologies.orient.core.sql.query.OSQLAsynchQuery;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
import com.tinkerpop.blueprints.impls.orient.OrientVertex;
public class OrientdbTest {
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
public class TestCloseConnection {
/**
* @param args
* @throws InterruptedException