Skip to content

Instantly share code, notes, and snippets.

View KillerGoldFisch's full-sized avatar

Kevin Gliewe KillerGoldFisch

View GitHub Profile
@KillerGoldFisch
KillerGoldFisch / MQTTnetExtensions.cs
Created October 11, 2018 14:51
Server extensions for https://github.com/chkr1011/MQTTnet, exposes the session manager and sessions via reflection. Remember to lock the session dictionary before using it!!
using MQTTnet.Server;
using System;
using System.Collections.Generic;
using System.Reflection;
namespace MQTTnet.Server.Extensions
{
public static class MQTTnetExtensions
{
private static FieldInfo MqttClientSessionsManager_FI = typeof(MqttServer).GetField("_clientSessionsManager", BindingFlags.Instance | BindingFlags.NonPublic);
//Copyright (C) Microsoft Corporation. All rights reserved.
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;
@KillerGoldFisch
KillerGoldFisch / install-duplicati.sh
Created May 26, 2018 10:37
Install headless Duplicati on Ubuntu 16.04
#!/bin/sh
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | tee /etc/apt/sources.list.d/mono-official.list
apt-get update
apt-get -y install ufw unzip mono-devel
mkdir /usr/lib/duplicati
@KillerGoldFisch
KillerGoldFisch / proxies.xml
Created March 29, 2018 17:40
Membrane service proxy HTTP to HTTPS rewriter
<spring:beans xmlns="http://membrane-soa.org/proxies/1/"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://membrane-soa.org/proxies/1/ http://membrane-soa.org/schemas/proxies-1.xsd">
<router>
<serviceProxy name="HTTPS Rewriter" port="80" host="*">
<groovyTemplate><![CDATA[
@KillerGoldFisch
KillerGoldFisch / RuntimeStringInterpolation.cs
Created November 16, 2017 16:04
Runtime String interpolation for .NET Core
public static string Interpolate(string value, System.Collections.Generic.IDictionary<string, object> inject) {
return System.Text.RegularExpressions.Regex.Replace(value, @"{(?<exp>[^}]+)}", match => {
var p = inject.Select(pair => System.Linq.Expressions.Expression.Parameter(pair.Value.GetType(), pair.Key));
var e = System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(p.ToArray(), null, match.Groups["exp"].Value, inject.Values.ToArray());
return (e.Compile().DynamicInvoke(inject.Values.ToArray()) ?? "").ToString();
});
}
/*
Dependencys:
@KillerGoldFisch
KillerGoldFisch / droopy.py
Created October 26, 2017 14:11
Droopy is a mini Web server whose sole purpose is to let others upload files to your computer. : http://stackp.online.fr/?p=28
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Droopy (http://stackp.online.fr/droopy)
# Copyright 2008-2013 (c) Pierre Duquesne <[email protected]>
# Licensed under the New BSD License.
# Changelog
# 20131121 * Update HTML/CSS for mobile devices
# * Add HTTPS support
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 misterT2525
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
/**
* The MIT License
* Copyright (c) 2014-2015 Techcable
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@KillerGoldFisch
KillerGoldFisch / Dockerfile
Last active May 9, 2016 13:04
killergoldfisch/beaker-opencv
FROM killergoldfisch/beaker
MAINTAINER Kevin Gliewe <[email protected]>
# Used for displaying STL-Files
RUN pip install numpy-stl enum34
RUN apt-get update && \
apt-get install -y cmake make build-essential git wget
#!/usr/bin/env python
from mcstatus import MinecraftServer
import json
import urllib2
def processNames(names):
url = "https://eu.mc-api.net/v3/uuid/" + ",".join(names) + "/json"
tmp = json.loads(get(url))
ret = []