Skip to content

Instantly share code, notes, and snippets.

View psi-4ward's full-sized avatar

Christoph Wiechert psi-4ward

View GitHub Profile
@psi-4ward
psi-4ward / README.md
Created December 13, 2016 19:40
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",
import feathersClient from '../../../be/node_modules/feathers/client';
import socketioClient from '../../../be/node_modules/feathers-socketio/client';
import ioClient from '../../../be/node_modules/socket.io-client';
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 = [];
@psi-4ward
psi-4ward / waitForPort.sh
Created December 11, 2015 17:31
waitForPort.sh
#!/bin/bash
MAXTIME=30
PORTS=()
START_TSTAMP=$(date "+%s")
function help() {
>&2 echo "Wait until a port becomes open"
>&2 echo
>&2 echo "Usage: $0 [options] -h HOST -p Port"
@psi-4ward
psi-4ward / user.js
Created October 20, 2015 14:27
Loopback User model with *roles* property support
/**
* Loopback User model with *roles* property support
*/
var builtinUser = require('loopback/common/models/user.js');
var async = require('async');
var _ = require('lodash');
var debug = require('debug')('loopback:user');
@psi-4ward
psi-4ward / check_docker_cpu.sh
Created August 25, 2015 15:36
check_docker_cpu.sh
#!/usr/bin/env bash
#############################################################
# Check the cpu consumption of a running docker container
# by reading cgroup information
#
# Licence: LGPL
# Author: Christoph Wiechert <wio@psitrx.de>
#############################################################
#!/usr/bin/env bash
#############################################################
# Check the memory consumption of a running docker container
# by reading cgroup information
#
# Licence: LGPL
# Author: Christoph Wiechert <wio@psitrx.de>
#############################################################
@psi-4ward
psi-4ward / customize-grml.md
Last active December 2, 2023 06:41
Customize Grml LiveCD (remaster)

Customize Grml LiveCD (remaster)

This little bash script helps you to build your own customized grml.iso

Features

  • Include your .ssh/*.pub files into authorized_keys
  • Inject Grml Cheats
  • Auto download all necessary files (the ISO and grml2usb)
@psi-4ward
psi-4ward / README.md
Last active June 13, 2017 13:02
CoreOS mdadm RAID1 for ROOT

CoreOS mdadm RAID1 for ROOT

  • Setup SoftwareRAID for the CoreOS root partition without data-loss.
  • Only for ext4!
  • The Trick is to use the right volume label and fs-types :)
  • We assume CoreOS is on /dev/sdaX and the second RAID Device is /dev/sdb
  • Drawback: only / gets mirrored, Node goes down when sda fails
  1. Boot into any recovery system like Grml
  2. If not already done: install CoreOS
@psi-4ward
psi-4ward / docker-powerdns-servicediscovery.sh
Created April 15, 2015 08:54
Service Discovery for Docker to update PowerDNS MySQL
#!/bin/bash
# watch events until infinity
UNTIL=99999999999
# respect events 30sec in the past to not forget
# started containers AFTER "register running" but BEFORE event listener starts
SINCE=$(expr `date +%s` - 30)
DOMAIN=fubar
@psi-4ward
psi-4ward / README.md
Created April 14, 2015 15:30
CoreOS - Consul - Registrator
  • /opt/bin/etcdctl2 is a wrapper for etcdctl to add certs
  • copy the consul web-ui into /DATA/infra/consul/ui