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.

@rquast
rquast / nginx.conf
Created March 8, 2018 22:42 — forked from thoop/nginx.conf
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@rquast
rquast / 01-runner.js
Created February 16, 2018 23:29 — forked from stelcheck/01-runner.js
REPL example for electron
'use strict'
const net = require('net')
const chalk = require('chalk')
const path = require('path')
const cp = require('child_process')
const rimraf = require('rimraf')
function getPath() {
@rquast
rquast / docker-compose.yml
Created October 9, 2017 02:51 — forked from huksley/docker-compose.yml
Launches fully configured Graylog 2.3.1 instance
#
# Launches configured Graylog 2.3.1 instance
#
# - Docker-compose 1.16 required
# - Please configure following according to your network:
# * gelf-address URL (for each container)
# * GRAYLOG_WEB_ENDPOINT_URI
# - After launch define GELF tcp and GELF udp inputs in graylog web ui
# - Containers send logging to the graylog itself
# - By default tuned to 30 days retention
@rquast
rquast / attached.js
Created July 9, 2017 01:05 — forked from peisenmann/attached.js
Aurelia custom attribute to invoke a callback when an element gets added to the dom. Demo: http://plnkr.co/edit/fguuz4
import {customAttribute, bindable, LogManager} from 'aurelia-framework';
const logger:Logger = LogManager.getLogger("attached");
/**
* MIT License. Patrick Eisenmann.
* Apply this attribute to an element to have a callback invoked when the element added to the DOM
*
* @param {Function} callback. Required. The function to be invoked.
* The first argument to the callback is the Element that had the attached on it.
@rquast
rquast / index.md
Created June 21, 2017 00:30 — forked from andris9/index.md
Retrieve UDP logs from ZoneMTA

Step 1. Install MessagePack module

ZoneMTA emits logs over UDP in MessagePack format, so a MessagePack parser is needed to read log messages

npm install msgpack-js

Step 2. Update MTA config

Edit your ZoneMTA application config to activate remote UDP logging. Add remote to the log section. Port and host should point to the server where logger.js app is running.

@rquast
rquast / config.json
Created June 20, 2017 13:20 — forked from andris9/config.json
ZoneMTA DKIM plugin example
{
"plugins": {
"dkim": {
"enabled": "sender",
"domain": "example.com",
"selector": "test",
"path": "/path/to/private/key.pem"
}
}
}
@rquast
rquast / About.txt
Created February 20, 2017 01:09 — forked from Manouchehri/About.txt
OSX app menu compatibility shim for JDK 9 EA releases
Abstract:
Hooks existing preferences/about/quit functionality from an existing Java app into handlers for the Mac OS X application menu.
Tailored to provide compatibility with the Java 9 EA releases so that the app may be built on other platforms. Note that there
is no compatibility with Java 8, though all that is required is to change java.awt.desktop -> com.apple.eawt in all handler methods
This work was inspired by an OSX compatibility layer provided by Apple that used a different API. This is an otherwise original
contribution and is a reimplementation using newer interface methods.
Usage: