Skip to content

Instantly share code, notes, and snippets.

@rquast
rquast / MongoConfig.java
Created December 1, 2019 03:20 — forked from EliasRanz/MongoConfig.java
Mongo Configuration for Amazon DocumentDB utilizing Spring-Boot and spring-data-mongodb
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
@rquast
rquast / DumpIndexWriter.java
Created September 16, 2018 02:26 — forked from maxpert/DumpIndexWriter.java
Lucene redis example
package mxp;
import java.io.IOException;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.NumericField;
import org.apache.lucene.index.CorruptIndexException;
@rquast
rquast / syncthing-backup.md
Created June 6, 2018 21:28 — forked from sjorge/syncthing-backup.md
using syncthing for backups

introduction

I wanted to replace rsync for my current host backups.

I had 2 hosts (1 laptop and 1 desktop) that would get there changes polled from a backup server. (polled = cronjob ran every hours) Ofcourse those boxes are not always on and a frenzy of cron mails happen every now and then.

I replaced everything with syncthing, they have clients available for linux, illumos, openbsd and mac. With the config below (client::folder master = yes, server::folder master = no) we prevent the server from accidentally overriding a file on the client. The client knows the server's IPv4 and/or IPv6 address so we do not need global or local discovery nor UPnP.

<?php
namespace Cavy\Model\DTO;
abstract class AbstractBase implements Base {
/**
* @return array
*/
<?php
namespace Cavy\Model\DTO;
use Cavy\Lib\Exceptions\ValidationException;
use Cavy\Model\DAO\DocumentsModel;
use Respect\Validation\Validator as v;
class Document extends ModifiedBase implements Indexable {
import {PLATFORM} from 'aurelia-pal';
export default [
{ route: ['', 'home'], name: 'home', moduleId: PLATFORM.moduleName('./home'), nav: true, title: 'Home', variables: {
page: {
description: 'Helpdesk And Support Platform - Fast, Cheap, Easy',
keywords: 'support platform, helpdesk, help desk, live chat, CRM, customer management'
},
opengraph: {
'og:type': 'article',
import {inject} from 'aurelia-framework';
import SsrTransformer from './ssr-transformer';
@inject(SsrTransformer)
export class TransformerStep {
constructor(transformer) {
this.transformer = transformer;
}
module.exports = require('aurelia-ssr-bootstrapper-webpack').default(function(aurelia, headers) {
let PLATFORM = require('aurelia-pal').PLATFORM;
aurelia.use
.standardConfiguration()
.feature(PLATFORM.moduleName('resources/index'));
aurelia.use
.globalResources([
PLATFORM.moduleName('resources/elements/hero'),
PLATFORM.moduleName('resources/elements/heading'),
PLATFORM.moduleName('resources/elements/footer'),
import {DOM} from 'aurelia-pal';
export const TRANSFORMER_TYPES = {
page: {
type: 'meta',
key: 'name',
value: 'content',
elements: [
'description',
'keywords'
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><%- htmlWebpackPlugin.options.metadata.title %></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<base href="<%- htmlWebpackPlugin.options.metadata.baseUrl %>">