Skip to content

Instantly share code, notes, and snippets.

View maximilian-krauss's full-sized avatar
💥
¯\_(ツ)_/¯

Maximilian Krauß maximilian-krauss

💥
¯\_(ツ)_/¯
View GitHub Profile
@maximilian-krauss
maximilian-krauss / gist:1556449
Created January 3, 2012 19:20
TreeView Select Next/Previous Item
' (c) TommyB http://shotty.devs-on.net
MyBase.KeyPreview = True
' ...
Private Sub Me_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles Me.KeyDown
Dim SelectedNode As TreeNode = NaviTreeView.SelectedNode
@maximilian-krauss
maximilian-krauss / gist:1909966
Created February 25, 2012 18:29
updateSystem.NET - Asynchronous Updatecheck
#Region " Asynchroner Updatespaß "
Private Sub btnRunAsync_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRunAsync.Click
'Updatesuche anstoßen
upctrlMain.checkForUpdatesAsync()
End Sub
'Dieses Event wird in jedem Falle nach Abschluß der Updatesuche gefeuert.
'Also bei gefundenen Updates, keinen neuen Updates und auch im Fehlerfall.
Private Sub upctrlMain_checkForUpdatesCompleted(ByVal sender As Object, ByVal e As updateSystemDotNet.appEventArgs.checkForUpdatesCompletedEventArgs) Handles upctrlMain.checkForUpdatesCompleted
@maximilian-krauss
maximilian-krauss / gist:2170153
Created March 23, 2012 12:15
Lunchtimestunt #1
using System;using System.Collections.Generic;using System.Linq;using System.Windows.Forms;using System.Drawing;class T { class L : Control { List<Point> dataPoints = new List<Point>(); public delegate void LeMoveHandler(object sender, Point cords); public event LeMoveHandler LeMove; public L() { SetStyle(ControlStyles.OptimizedDoubleBuffer, true); MouseMove += (o, e) => { Invalidate(); onLeMove(); }; MouseLeave += (o, e) => { Invalidate(); onLeMove(); }; Click += (o, e) => { dataPoints.Add(PointToClient(new Point(MousePosition.X, MousePosition.Y))); Invalidate(); }; } void onLeMove() { if (LeMove != null) LeMove(this, PointToClient(new Point(MousePosition.X, MousePosition.Y))); } protected override void OnPaint(PaintEventArgs e) { e.Graphics.FillRectangle(new SolidBrush(BackColor), ClientRectangle); dataPoints.ForEach(p => e.Graphics.FillRectangle(Brushes.Green, new Rectangle(new Point(p.X - (6 / 2), p.Y - (6 / 2)), new Size(6, 6)))); if (dataPoints.Count > 1) e.Graphics.DrawLines(Pens.Yellow, dataPoints.ToA
@maximilian-krauss
maximilian-krauss / linkLabelEx.cs
Created March 26, 2012 14:56
LinkLabel with BB-Code Style Url support
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing.Design;
using System.Text.RegularExpressions;
using System.Windows.Forms;
/*
* linkLabelEx - Ein Linklabel with BB-Code
* Copyright (c) 2012 by Maximilian Krauss
* http://kraussz.com
@maximilian-krauss
maximilian-krauss / MEF.cs
Created November 11, 2012 09:34
MEF Example
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Linq;
using System.Reflection;
using System.Text;
namespace ConsoleApplication1 {
class Program {
@maximilian-krauss
maximilian-krauss / WeightbotClient.cs
Created November 13, 2012 20:15
WeightbotClient
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Net;
using System.Web;
namespace coffeeInjection {
@maximilian-krauss
maximilian-krauss / gist:5982424
Created July 12, 2013 06:46
Very simple object cache with support for object expiration
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
namespace kraussHQ {
public sealed class BlobCacheEntry {
@maximilian-krauss
maximilian-krauss / gist:5984278
Last active December 19, 2015 16:29
Basic provider to sign a json document using the dsa algorithm
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.IO;
using System.Runtime.Serialization.Json;
using System.Runtime.Serialization;
// Add reference to System.Runtime.Serialization.dll
static class UriHelper {
public static Uri Combine(params string[] parts) {
var raw = new StringBuilder();
for (int i = 0; i < parts.Length; i++) {
var p = parts[i];
if (p.StartsWith("/"))
p = p.Substring(1);
raw.Append(
p.EndsWith("/") || i == parts.Length - 1 ? p : p + "/"

Keybase proof

I hereby claim:

  • I am maximilian-krauss on github.
  • I am maximilian (https://keybase.io/maximilian) on keybase.
  • I have a public key whose fingerprint is 83CA 569E 408F 88D2 E0D1 7E7D AAFB 2BD2 4929 04B5

To claim this, I am signing this object: