Skip to content

Instantly share code, notes, and snippets.

View SeppPenner's full-sized avatar
😜
I like cookies 🍪🍪🍪🍪

SeppPenner SeppPenner

😜
I like cookies 🍪🍪🍪🍪
View GitHub Profile
sudo sync
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo sed -i 's/jessie/buster/g' /etc/apt/sources.list
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo sync
#sudo reboot
@SeppPenner
SeppPenner / Startup.cs
Created July 17, 2019 14:04
Blazor localization test
namespace Example.Application
{
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@SeppPenner
SeppPenner / Something.md
Created July 16, 2019 05:49
Backup of 在AspNetCore 2.2中使用MQTTnet

       MQTTnet可以说是.Net 开发者的福音,在众多MQTT开源项目中,也有.Net的一份子。感谢 Christian!当发现这个开源项目时,我非常有兴趣。于是我开始了一个实验的项目。我并不是一个软件开发高手,项目代码写得很糟糕。所以并没有开源分享。以下我简单介绍关键代码的实现。同时也提出我遇到的问题,我们来共同学习吧!

创建一个设备信息表:Devices.cs

public class Devices
{
	[Key]
	public int Id { get; set; }

	[Display(Name = "Tid")]
@SeppPenner
SeppPenner / CheckTopic.cs
Last active May 18, 2020 16:42
MQTT: Matching a topic to a topic filter in C# based on Eclipse Mosquitto's function.
/// <summary>
/// Does a check if topics match a certain topic filter.
/// </summary>
/// <param name="allowedTopic">The allowed topic.</param>
/// <param name="topic">The topic.</param>
/// <returns><c>true</c> if the topic is valid, <c>false</c> if not.</returns>
public static bool TopicMatch(string allowedTopic, string topic)
{
if (string.IsNullOrWhiteSpace(allowedTopic) || string.IsNullOrWhiteSpace(topic))
{
@SeppPenner
SeppPenner / license-badges.md
Created June 24, 2019 08:41 — forked from lukas-h/license-badges.md
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

@SeppPenner
SeppPenner / README.md
Last active May 28, 2019 14:21
How to really install Thingsboard with Postgres

Approach:

  1. Install Java.
  2. Install Postgres.
  3. Create folder (e.g. C:\Thingsboard) --> Not under C:\Programm Files or C:\Programm Files (x86) as this will not work due to spaces in the path name.
  4. Download Thingsboard as zip (See https://thingsboard.io/docs/user-guide/install/windows/) and unzip it under the folder from 3.
  5. Adjust the file thingsboard.yml in the conf folder (Comment out HSQLDB DAO Configuration, Uncomment PostgreSQL DAO Configuration and adjust username and password (Host too, if needed).
  6. Create the database thingsboard via pgAdmin or the command line in Postgres (Or rename it to something else and adjust the host parameter configuration, too).
  7. Install Thingsboard using .\install.bat (Powershell in admin mode needed).
  8. Start service with net start thingsboard.
@SeppPenner
SeppPenner / Configuration.md
Last active April 26, 2019 14:13
OpenCover beeing stuck in infinite loop?
C:\Jenkins\workspace\someproject>OpenCover.Console.Exe -target:"C:\program files\dotnet\dotnet.exe" -targetargs:"test \"src\SomeProject.Tests\SomeProject.Tests.csproj\" --configuration Debug --no-build" -output:"src\TestResults\SomeProject.Tests.coveragexml" -oldstyle -register:user 
@SeppPenner
SeppPenner / Example.cs
Last active March 27, 2019 15:18
IEnumerable gives error exception handeling can't read list
namespace ListExample
{
using System.Collections.Generic;
public class Program
{
private static readonly List<Animal> AnimalsToCheck = new List<Animal>
{
new Animal { Eater = Eater.Carnivore, Format = 1 },
new Animal { Eater = Eater.Herbivore, Format = 3 }
@SeppPenner
SeppPenner / License.txt
Created March 19, 2019 13:07
OpenSSL-Create certificate with brainpoolP512r1 and a certificate revocation list (CRL) for it
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
@SeppPenner
SeppPenner / License.txt
Last active January 7, 2021 14:22
C# MigraDoc break line in table cell if the text is too long for a cell and does not contain some split chars, e.g. commas, hypens, ...
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for