Skip to content

Instantly share code, notes, and snippets.

@amoe
amoe / neo4j_java_11.patch
Created July 19, 2019 14:42
Neo4j Java 11 patch
diff -Naur neo4j-community-3.4.6.orig/bin/neo4j neo4j-community-3.4.6/bin/neo4j
--- neo4j-community-3.4.6.orig/bin/neo4j 2018-08-13 10:43:20.000000000 +0100
+++ neo4j-community-3.4.6/bin/neo4j 2019-07-19 15:20:21.175879490 +0100
@@ -84,15 +84,19 @@
[[ -n "${JAVA_MEMORY_OPTS:-}" ]] && version_command+=("${JAVA_MEMORY_OPTS[@]}")
JAVA_VERSION=$("${version_command[@]}" 2>&1 | awk -F '"' '/version/ {print $2}')
- if [[ "${JAVA_VERSION}" < "1.8" ]]; then
- echo "ERROR! Neo4j cannot be started using java version ${JAVA_VERSION}. "
- _show_java_help
@amoe
amoe / gist:f7a7e5fb59efed06a3a4f8aded6907f8
Created April 25, 2019 09:13
spdlog extension example
#include "spdlog/fmt/ostr.h"
class Person {
public:
Person(string name, int age): name(name), age(age) { }
template<typename OStream>
friend OStream &operator<<(OStream &os, const Person& p) {
return os << "<Person name=" << p.name << ">";
}
#ifndef FIELD_ENCODER_MODEL_HH
#define FIELD_ENCODER_MODEL_HH
#include <Qt>
#include <QModelIndex>
#include <QStringListModel>
class FieldEncoderModel: public QAbstractItemModel {
public:
@amoe
amoe / field_encoder_model.cc
Created March 4, 2019 16:05
wrapper for stringlistmodel
#include "field_encoder_model.hh"
FieldEncoderModel::FieldEncoderModel() {
QStringList available = {"foo", "bar", "baz"};
this->innerModel = new QStringListModel(available);
}
Qt::ItemFlags FieldEncoderModel::flags(const QModelIndex& index) const {
return this->innerModel->flags(index);
}
services:
web:
build: .
image: docker_bind_volume_demo
mem_limit: 4g
ports: ['49152']
volumes:
- ./mymodule:/mnt:ro
version: '2'
@amoe
amoe / errors.log
Created February 8, 2019 16:15
Errors from fabric tar/pipe script
tar: Removing leading `/' from member names
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
Traceback (most recent call last):
File "write_to_fifo.py", line 13, in <module>
out_stream=reader_proc.stdin
File "<decorator-gen-3>", line 2, in run
File "/usr/local/lib/python3.5/dist-packages/fabric/connection.py", line 30, in opens
return method(self, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/fabric/connection.py", line 702, in run
@amoe
amoe / osxbundle.py
Created February 19, 2018 16:57
OSX bundling tool for SCons based on gabor-fluxus usage
#!/usr/bin/env python
"""Provides tools for building Mac application bundles."""
# Based on code by Gary Oberbrunner and Mitch Chapman
from os.path import *
import os
import re
import shutil
from SCons.Builder import *
@amoe
amoe / proxies.js
Created November 24, 2017 14:34
one way binding in vanilla js
// proxies.js
const initialState = {
count: 0
};
const configuration = {
count: '#my-textarea'
};
@amoe
amoe / prime_factors.clj
Created November 22, 2017 04:44
prime factors
(defn inner [z n lim]
(cond
(> z lim)
nil
(zero? (mod n z))
(cons z
(inner (+ z 1) (/ n z) lim))
:else
(inner (+ z 1) n lim)))
@amoe
amoe / concdemo.clj
Last active June 1, 2017 14:16
minimum wait queue
(ns wn-backend.concdemo
(:require [wn-backend.util.common :refer :all]
[clj-http.client :as client])
(:import [java.util.concurrent LinkedBlockingQueue]))
(def my-queue (LinkedBlockingQueue.))
(def queue-minimum-delay 1000)
(defn queue-processor []