Skip to content

Instantly share code, notes, and snippets.

@scharlal
scharlal / Wynncraft.ahk
Last active September 8, 2022 17:36
Spell casting on number keys for Wynncraft
/*
Spell casting on number keys for Wynncraft
Version: v11
Usage:
* Use Minecraft with the GUI scale on 2 (two)
* Use the Wynncraft provided resource pack
* Wynncraft mods are not supported!
* Setup your configuration below
* Setup your custom actions/ hotkeys

AutoHotkey repeat string

As I found out, there is no native implementation to repeat a string N times in AutoHotkey.

This function however will do exactly that

strRepeat( string, times ) {
  return StrReplace( Format( "{:" times "}",  "" ), " ", string )
}
@scharlal
scharlal / JS random array with fixed sum.md
Last active February 28, 2023 06:19
Create an array of random numbers with a fixed sum in JavaScript

Create an array of random numbers with a fixed sum in JavaScript

function createArray(_sum, length, min, max, step) {
    var avg         = Math.floor(_sum / length);
    min             = min || 1;
    max             = max || 1000;
    step            = step || 1;
    var difference  = _sum - (min * length);
 var arr = [];
@scharlal
scharlal / backup.cmd
Last active May 6, 2018 18:06
Batch based TimeMachine-Backup for Windows
::
:: This backup script will allow you to copy ALL files with a set archive attribute.
:: This is specially helpful when you are working on text-files and let this script run periodically.
::
@ECHO OFF
:: CONFIG ::
:: Set your destination and the amount of unique months per year you want to keep in your destination
SET destination=_backup