Skip to content

Instantly share code, notes, and snippets.


Christoph Wiechert psi-4ward

View GitHub Profile
psi-4ward / db-migrate.ts
Created May 13, 2020
sequelize-typescript database migration
View db-migrate.ts
* Database migration helper using Umzug
* supports TypeScript (ts-node) and JS
* Usage:
* * With ts-node: npx ts-node src/db-migrate.ts
* * or after transpile: node src/db-migrate.js
* Params:
* * down: Downgrade the last migration
psi-4ward / .xbindkeysrc
Last active Jun 22, 2018
Linux window activation by hotkey
View .xbindkeysrc
# Meta c brings Chrom(e|ium) to foreground
"~/.dotfiles/ -a Chrom"
# Meta k brings Konsole to foreground
"~/.dotfiles/ -a Konsole"
# Meta k brings WebStorm to foreground
"~/.dotfiles/ -a WebStorm"
psi-4ward / auth.changePassword.js
Last active Jun 26, 2020
Feathers.js simple changePassword Service
View auth.changePassword.js
const auth = require('@feathersjs/authentication');
const errors = require('@feathersjs/errors');
const bcrypt = require('bcryptjs');
const comparePasswords = (oldPassword, password) => new Promise((resolve, reject) => {, password, (err, data1) => {
if(err || !data1) return reject();
return resolve();
psi-4ward / validateSchema.js
Created Dec 8, 2017
feathersjs schema validation based on Ajv with switch and $async support
View validateSchema.js
const Ajv = require('ajv');
const ajvKeywords = require('ajv-keywords');
const ajvAsync = require('ajv-async');
const errors = require('@feathersjs/errors');
const app = require('../app');
module.exports = function validateSchemaHookFactory(schema, options) {
const patch = options && options.patch;
if(options) delete options.patch;
psi-4ward / list-related-posts.js
Last active Jan 26, 2018
Hexo related posts by tags
View list-related-posts.js
psi-4ward / docker-compose.yml
Created Jan 29, 2017
Icinga2 Docker-Compose
View docker-compose.yml
version: '2'
image: mariadb
restart: unless-stopped
- "./mysql:/var/lib/mysql"
psi-4ward /
Last active Jun 5, 2018
Icinga2 Mail Notification Scripts (for Director)
# Mail Notification Script for Icinga2 Hosts
# Uses swaks for mail delivery:
# Date: 2017-01-19
# Author: Christoph Wiechert <>
usage() {
echo "Mail Notifications for Icinga2 Host Alerts"
psi-4ward / docker-compose.yml
Created Jan 17, 2017
Mailcow Docker-Compose File
View docker-compose.yml
version: '2'
image: andryyy/mailcow-dockerized:pdns
- ./data/conf/pdns/:/etc/powerdns/
restart: unless-stopped
psi-4ward /
Created Dec 13, 2016
Feathers.js multipart/file-data Upload Middleware

Feathers.js multipart/file-data Upload middleware

Parses multipart/form-data uploads and stream files to a blob-store.
After uploading the Services receives a json-body with the file references:

  "files": [
      "key": "34525ca2-f774-444f-8e7e-7622bef69cb1",
      "filename": "13.jpg",
View feathers-socket.js
import feathersClient from '../../../be/node_modules/feathers/client';
import socketioClient from '../../../be/node_modules/feathers-socketio/client';
import ioClient from '../../../be/node_modules/';
import authentication from '../../../be/node_modules/feathers-authentication/client';
import hooks from '../../../be/node_modules/feathers-hooks';
import findIndex from 'lodash/findIndex';
import find from 'lodash/find';
import Vue from 'vue';
export const errorHandlers = [];