Skip to content

Instantly share code, notes, and snippets.

@mihairaulea
mihairaulea / gist:308e3ecd9ae5cff1746d30e066a88553
Created August 11, 2016 10:42
Neo4j database connection to impermanent database
GraphDatabaseService database = new TestGraphDatabaseFactory().newImpermanentDatabase();
Runtime.getRuntime().addShutdownHook(new Thread()
{
@Override
public void run()
{
database.shutdown();
}
});
ServerConfigurator configurator = new ServerConfigurator((GraphDatabaseAPI) database);
(person:Person {firstname: firstName, lastname: lastName } *5)-[:KNOWS *n..n]->(person)
(person)-[:HAS *n..n]->(skill:Skill {name: progLanguage} *2)
(company:Company {name: company, desc: catchPhrase} *3)-[:LOOKS_FOR_COMPETENCE *n..n]->(skill)
(company)-[:LOCATED_IN *n..1]->(country:Country {name: country} *5)
(person)-[:LIVES_IN *n..1]->(country)
@mihairaulea
mihairaulea / Neo4jRestartOGMTest.java
Created January 10, 2017 13:55
Restarting the neo4j server
@Test
public void testLoadMovieGood() throws InterruptedException {
//Set up the Session
Session session = GDBSessionFactory.getInstance().getSession();
Movie movie = new Movie("The Matrix", 1999);
Actor keanu = new Actor("Keanu Reeves");
keanu.actsIn(movie);
@mihairaulea
mihairaulea / GDBSessionFactory.java
Created January 10, 2017 14:05
session factory used with the ogm
package com.test;
import org.neo4j.ogm.session.Session;
import org.neo4j.ogm.session.SessionFactory;
public class GDBSessionFactory {
private static final String BOLT_URI = "bolt://xxxx:xxxx@127.0.0.1:7687";
private static final String BOLT_ENCRYPTION = "REQUIRES";
private static SessionFactory sessionFactory = new SessionFactory(configuration(),
@mihairaulea
mihairaulea / etherbase
Created October 17, 2017 11:32
etherbase
0x54FF3a21Ba0932EC6dC987efe63131B616B88193
/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=59816:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA CE.app/Contents/plugins/junit/lib/junit-rt.jar:/Applications/IntelliJ IDEA CE.app/Contents/plugins/junit/lib/junit5-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Jav
// https://github.com/quartz-scheduler/quartz/blob/master/docs/quick-start-guide.adoc#starting-a-sample-application
// https://firebase.google.com/docs/firestore/server/samples-java
public class JobScheduler {
public static void main(String[] args) {
// define the job and tie it to our custom class
JobDetail job = newJob(DashboardDataPusher.class)
.withIdentity("job1", "group1")
.build();
<htmL>
<head>
<script>
let microId = uuidv4();
let state = {};
function connectToWebsocket() {
let socket = new WebSocket("ws://localhost:8081");
socket.onopen = function(e) {
console.log("[open] Connection established");
@mihairaulea
mihairaulea / Microcontroller.ino
Created October 5, 2020 12:56
Arduino microcontroller
#include <ArduinoWebsockets.h>
#include <WiFi.h>
#include <ArduinoJson.h>
#include <stdint.h>
#include <TLC591x.h>
/*
*
*
segments.print_vertical_lines(); ---------------------------------------- before anything happens
segments.
https://infinite-lowlands-19198.herokuapp.com/data?orderData={"100100":{"productIds":["Metro_RECH_1_100100","A2201","A2212","A2212","A2212","A2212","A2212","A2212","A2212","A2233","A2233","A2233","A2233","Metro_RECH_1_100100"],"productNames":["INCEPE","FP-40SIGMA","TB-96956","TB-96953","TB-96952","TB-96950","TB-96955","TB-96949","TB-96948","DP-11GSIGA","DP-11GSIGG","DP-11GSIGN","DP-11GSIGR","TERMINAT"],"quantitiesPieces":["Catalin22","4200","21","25","65","20","65","48","45","40","360","400","360","Catalin"],"quantityBoxes":["CUTII","X","X","X","X","X","X","X","X","X","X","X","X","END"],"quantityPallets":["DESCRIERE","Folii_40mic__SIGMA","PANOU_120X90__SIGM","PANOU_40X30__SIGMA","PANOU_60X40__SIGMA","PANOU_60X40__SIGMA","PANOU_60X90__SIGMA","TABLA_60X40__SIGMA","TABLA_90X60__SIGMA","DOSAR_ALBAS__SIGMA","DOSAR_GALBE__SIGMA","DOSAR_NEGRU__SIGMA","DOSAR_ROSU__SIGMA","END"],"comments":["unprimcomentariu22"," EDITHERE"]},"200200":{"productIds":["Metro_RECH_2_200200","A2242","M0211","M0213","M0221","M0423","M0431",