Skip to content

Instantly share code, notes, and snippets.

View JKamue's full-sized avatar

Jannes Kaspar-Müller JKamue

View GitHub Profile
@JKamue
JKamue / restic.md
Last active March 15, 2024 13:21
Restic setup

Mostly a documentation for future me on a future server

source will be the server that creates backups target will be the server that stores backups

Setup

  1. Install restic on source, for ubuntu apt-get install restic
  2. Create a ssh key pair on source (ssh-keygen -t ed25519) ideally give it it a special name like hetzner-storagebox
  3. Push the shh key from source to target using ssh-copy-id like this
@JKamue
JKamue / CustomIdConverter.cs
Created September 25, 2023 14:23
Newtonsoft CustomConverter based on Attribute
using Newtonsoft.Json;
namespace Demos.Newtonsoft
{
internal class CustomIdConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
var customId = (string) value;
customId = customId.Replace("-", ".");
@JKamue
JKamue / FrameRateCounter.cs
Created June 17, 2021 14:20
FrameRateCounter
/* Copyright (C) JKamue
* License: GNU GENERAL PUBLIC LICENSE Version 3
* https://gist.github.com/JKamue/b6f9cedcb4ea2eaef2039045b7d3dd44
* Written by Jannes Kaspar-Müller <contact@jkamue.de>
*/
public class FrameRateCounter {
public int Framerate {
get;
private set;
@JKamue
JKamue / BufferedScreenController.cs
Last active May 30, 2021 15:17
Buffered Winforms Screen Controller
/* Copyright (C) JKamue
* License: GNU GENERAL PUBLIC LICENSE Version 3
* https://gist.github.com/JKamue/b6f9cedcb4ea2eaef2039045b7d3dd44
* Written by Jannes Kaspar-Müller <contact@jkamue.de>
*/
class BufferedScreenController {
private readonly Panel _panel;
private readonly Timer _timer;
private readonly Color _color;
@JKamue
JKamue / KeyStatus.cs
Last active June 4, 2021 18:08
Static class to allow key polling
/* Copyright (C) JKamue
* License: GNU GENERAL PUBLIC LICENSE Version 3
* https://gist.github.com/JKamue/b6f9cedcb4ea2eaef2039045b7d3dd44
* Written by Jannes Kaspar-Müller <contact@jkamue.de>
*/
// List of KeyCodes: https://docs.microsoft.com/de-de/dotnet/api/system.windows.forms.keys?view=net-5.0
// For WinForms set KeyPreview = true
public static class KeyStatus
{
@JKamue
JKamue / minecraft_sha1_digest.php
Last active November 30, 2022 22:52
Minecraft SHA-1 Authentication digest - Implementation in PHP
<?php
// Special thanks to: https://wiki.vg/Protocol_Encryption#Client and
// https://web.archive.org/web/20151022204440/https://gist.github.com/SirCmpwn/404223052379e82f91e6
// Was tested with 1000 random values generated by SitCmpwn's gist
test();
function test()
{
echo digest("Notch") . PHP_EOL; // Should be 4ed1f46bbe04bc756bcb17c0c7ce3e4632f06a48

Keybase proof

I hereby claim:

  • I am jkamue on github.
  • I am jkamue (https://keybase.io/jkamue) on keybase.
  • I have a public key ASC2BWhdP0YCWBNlkikjovsWt1tMvD8pvG1qhqO7r79kSQo

To claim this, I am signing this object: