Skip to content

Instantly share code, notes, and snippets.

View JKamsker's full-sized avatar

Jonas Kamsker JKamsker

View GitHub Profile
@JKamsker
JKamsker / FragmentedArray.cs
Created February 10, 2020 16:43
FragmentedArray
public class FragmentedArray<T> : IEnumerable<T>
{
private T[][] _fragments;
private int _fragmentSize;
public int Size { get; }
public FragmentedArray(int size, int chunks = 3)
{
Size = size;
_fragmentSize = size / chunks;
@JKamsker
JKamsker / CategoryDao.cs
Last active October 18, 2019 06:22
GraphQl-Projector
public class CategoryDao : IDisposable, IAsyncDisposable
{
private readonly GraphContext context;
public CategoryDao(GraphContext context)
{
this.context = context;
}
public async Task<Category> FindByIdAsync(int categoryId, IEnumerable<string> requiredFields = null)
// ==UserScript==
// @name EasyBank larger paging
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author J-Kit
// @match https://ebanking.easybank.at/InternetBanking/InternetBanking/*
// @grant none
// ==/UserScript==
@JKamsker
JKamsker / Fluent.cs
Last active November 15, 2018 08:21
Fluent typeswitch
using System;
using System.Collections.Generic;
using System.Linq;
namespace FluentHandler
{
internal class CustomHandler
{
private readonly List<ICheckable> _ceckables;
public bool IsNullable<T>(T value)
{
return Nullable.GetUnderlyingType(typeof(T)) != null;
}
using TS3AudioBot.Audio;
using TS3AudioBot.Helper;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using TS3Client;
using TS3Client.Full;
//+ IPv4Mask {255.255.255.0} System.Net.IPAddress
//+ Address {10.0.0.6} System.Net.IPAddress
/// <summary>
/// Get all IPAdresses which are in the current subnet
/// </summary>
/// <returns></returns>
public static List<IPAddress> GetAllIp()
{
var retVar = new List<IPAddress>();
@JKamsker
JKamsker / XoRCrypto.cs
Last active November 17, 2017 01:39
Lighning fast xor crypt
using System.Runtime.CompilerServices;
namespace TestingEnv
{
internal class XoRCrypto
{
private readonly int[] _keyChain;
private int _ckey;
public XoRCrypto(int[] chain = null)
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using JSocket.Utilities.Extensions;
public class FastList<T>
{
private readonly List<T> _internalList = new List<T>();
public int Count => _count;
private int _count;
private int _freeIndex;
public T this[int index] => _internalList[index];
public int Add(T input)