Skip to content

Instantly share code, notes, and snippets.

View daverave1212's full-sized avatar

David Irimia daverave1212

View GitHub Profile
@daverave1212
daverave1212 / camera_drag.py
Last active May 26, 2026 21:14
A Python script for dragging camera in RTS games that don't have that feature (e.g. Age of Empires 2)
'''
What This Is
This is a python script that enables you to drag-move the camera with the middle mouse button.
How To Install (Windows)
1. Install python (https://www.python.org/ and go to Downloads and Download for Windows)
2. Open windows search, search for Command Prompt. Right click it > Run as administrator > Yes
3. Type the following command:
pip install mouse keyboard
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
public static class U {
// Math
public static double PercentOf(this double value, double ofWhat) {
return ofWhat * value / 100;
@daverave1212
daverave1212 / ExtensionUtils.cs
Created January 29, 2025 14:49
ExtensionUtils.cs
using System;
public static class ExtensionUtils {
public static float DistanceTo(this (float, float) pointA, (float, float) pointB) {
var (ax, ay) = pointA;
var (bx, by) = pointB;
return (float) Math.Sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
}
// Online C# Editor for free
// Write, Edit and Run your C# code using C# Online Compiler
using System;
using System.Linq;
public class HPoint {
public float X;
public float Y;
@daverave1212
daverave1212 / EloSystem.cs
Last active January 13, 2025 19:38
A generic Match making system made in C# for elo calculations. Simply take this file and use it as in the example.
/*
Use like:
float[] eloChanges = EloSystem.CalculateEloChanges(playerElos: new float[] { 14000, 4500, 11000, 17444, 6969, 21000 }, winnerIndex: 1, eloStakes: 100, isDebug: true);
float[][] teamsEloChanges1 = EloSystem.CalculateTeamsEloChanges(teamsWithPlayerElos: new[] { team1, team2, team3 }, winnerIndex: 1, eloStakes: 100, isDebug: true);
float[][] teamsEloChanges2 = EloSystem.CalculateTeamsEloChanges(teamsWithPlayerElos: new float[][] {
new float[] { 14000, 4500 },
new float[] { 11000, 17444 },
new float[] { 6969, 21000 },
}, winnerIndex: 1, eloStakes: 100, isDebug: true);
// Run with `groovy caesars-casino.groovy`
// (c) 2011 Playtika
// This code is licensed under MIT license (see LICENSE.txt)
import java.util.Collections;
class CaesarsCasino {
static void main(String[] args) {
def symbolsOnLine = "\$@#7?"
def machine = new Machine(symbolsOnLine)
@daverave1212
daverave1212 / SGBD Proiect.md
Last active June 2, 2020 14:27
SGBD Proiect
<title>SGBD Proiect</title>
@daverave1212
daverave1212 / PL-SQL.md
Last active January 15, 2021 17:17
PL-SQL
<title>PL-SQL</title>
<title>Crypto Examen</title>
@daverave1212
daverave1212 / Calcul Numeric Sheet.md
Last active January 21, 2021 14:42
Matlab Understandings

Cursul 1

Metoda bisectiei

eroarea absoluta = |x - xk| <= b-a / 2^k+1^> functia f definita pe [a,b], epsilon

loop log2( b-a /| supra epsilon) +1 times
	x = a + (b - a)/2
	if f(x) == 0

return last x