Skip to content

Instantly share code, notes, and snippets.

View schmidtgit's full-sized avatar
🧙‍♂️
Edit status

Jens Schmidt schmidtgit

🧙‍♂️
Edit status
View GitHub Profile
@schmidtgit
schmidtgit / SignalRHubExtension.cs
Last active November 13, 2022 05:49
Register interface with HubConnection
using Microsoft.AspNetCore.SignalR.Client;
using System.Reflection;
namespace SchmidtGit;
static class SignalRHubExtension
{
public static void RegisterInterfaceWithHub<T>( this HubConnection hubConnection, T hubClient ) {
var methods = typeof(T).GetMethods().Where(e => e.ReturnType == typeof(Task)) ?? Array.Empty<MethodInfo>();
foreach (var method in methods)
_ = hubConnection.On(
@schmidtgit
schmidtgit / main.cpp
Created February 12, 2020 23:34
Schedule functions to run at set frequency
#include <vector>
#include <algorithm>
#include <iostream>
#include <functional>
std::vector<std::function<void()>> schedule(std::vector<std::pair<int, std::function<void()>>> o) {
std::vector<std::pair<double, std::function<void()>>> q;
for (auto p : o) {
double delay = 1.0 / p.first;
for (int i = 1; i < p.first+1; i++) {
@schmidtgit
schmidtgit / game.py
Created October 23, 2019 15:35
Coding Pirates Game
print("Kryds og Bolle version 0.0.0.0.1")
gameboard = ['','','','','','','','','']
playerTurn = 'X'
def SwitchPlayer():
print("skift spiller virker ikke")
def Input():
print("input virker ikke")
@schmidtgit
schmidtgit / python_cheat.py
Created October 9, 2019 14:32
Coding Pirates @ Pentia
# Varibles
my_integer = 1
my_float = 1.0
my_list = [1,2]
my_string = "Something"
# I/O Operations
my_input = input(">")
print(my_input)
@schmidtgit
schmidtgit / setup.json
Created March 29, 2018 00:16
Default setup file for the Abathur Framework
{
"IsParallelized": false,
"Modules": [
"EmptyModule",
"RandomDemo",
"AutoHarvestGather",
"AutoSupply"
]
}
@schmidtgit
schmidtgit / gamesettings.json
Created March 28, 2018 20:34
Default settings file for the NydusNetwork
{
"FolderPath": "C:\\Program Files (x86)\\StarCraft II",
"ConnectionAddress": "127.0.0.1",
"ConnectionServerPort": 8165,
"ConnectionClientPort": 8170,
"MultiplayerSharedPort": 8175,
"Fullscreen": false,
"ClientWindowWidth": 1024,
"ClientWindowHeight": 768,
"GameMap": "Cloud Kingdom LE",
@schmidtgit
schmidtgit / BansheeTest.cs
Last active March 30, 2018 16:32
Extremely simple example on how to write a module for the Abathur framework.
using Abathur.Constants;
using Abathur.Core;
using Abathur.Modules;
namespace AbathurBot.Modules.Examples {
class BansheeTest : IModule {
private IProductionManager _pQueue;
public BansheeTest(IProductionManager productionManager) {
_pQueue = productionManager;
}
@schmidtgit
schmidtgit / StarCraftConnectionExample.cs
Created February 11, 2018 21:54
Simplified examples of connecting to the StarCraft II client for a post on AdequateSource.com
using System;
using System.Diagnostics;
using System.Net.WebSockets;
using System.Threading;
namespace AdequateSource
{
class StarCraftConnectionExample
{
public void LaunchClient() {