Skip to content

Instantly share code, notes, and snippets.

@Silthus
Silthus / IPseudoRandomGenerator.java
Created Jan 9, 2021
Pseudo Random Generator Comparison
View IPseudoRandomGenerator.java
public interface IPseudoRandomGenerator {
/**
* The iteration count is increased on every failure and reset on a success.
* <p>You can reset it manually by calling {@link #reset()}.
*
* @return the current iteration count
*/
int iteration();
float chance();
@Silthus
Silthus / PseudoRandomGenerator.java
Last active Jan 9, 2021
A pseudo random generator that brings the perceived randomness closer to the truth.
View PseudoRandomGenerator.java
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* The PseudoRandomGenerator is used to test an increasing chance based of the initial chance.
* <p>
* Use it to align the preceived chance of randomness for users with the actual randomness.
* <p>
* The generator will keep track of an iteration counter that will increase with every
* failed check and increase the chance for the next check. It resets after the chance was hit.
@Silthus
Silthus / docker-compose.backup.yml
Created Nov 26, 2020
mc-restic-compose-backup example
View docker-compose.backup.yml
version: '3.7'
services:
backup:
image: silthus/mc-restic-compose-backup
env_file:
- backup.env
- backup.secrets.env
- sql.secrets.env
volumes:
# We need to communicate with docker
@Silthus
Silthus / rcon.compose.yml
Last active Nov 14, 2020
Expose secured websites from docker containers with traefik
View rcon.compose.yml
version: '3.7'
services:
rcon:
image: itzg/rcon
user: ${CURRENT_USER}
environment:
RWA_WEBSOCKET_URL_SSL: wss://wss.rcon.your-url.com
RWA_WEBSOCKET_URL: ws://ws.rcon.your-url.com
env_file:
- rcon.env
View config.json
{
"settingsReloadIntervalMinutes": 1,
"fullscreen": false,
"autoStart": true,
"lazyLoadTabs": true,
"websites": [
{
"url": "https://www.patreon.com/kevdev",
"duration": 10,
"tabReloadIntervalSeconds": 15
View drop-all-schemas.sql
/* USE [YOUR_DATABASE] */
DECLARE @schema VARCHAR(128)
SELECT @schema = (SELECT TOP 1 [name] FROM sys.schemas ORDER BY [name])
WHILE @schema is not null
BEGIN
/* Drop all non-system stored procs */
View Export-VMTemplate.ps1
param (
[parameter(Mandatory=$true)]
$VM,
[parameter(Mandatory=$true)]
[string]
$TemplateName,
[parameter(Mandatory=$false)]
$VMMServer,
@Silthus
Silthus / README.md
Created Sep 12, 2018
Quest Example Readme
View README.md

Beispiel Quest

Hier sollte in ein bis zwei kurzen Sätzen der Kern der Quest erzählt werden, so dass man schnell weiß um was es in der Quest geht.

Die README Dateien für Quests können auch von den Quest Schreibern entworfen werden um den Quest Entwicklern die Arbeit zu erleichtern.

Ablauf

Ein kurzer Überblick über den schematischen Ablauf der Quest wie sie vom Quest Schreiber geplant wurde.

@Silthus
Silthus / drop-all.sql
Last active Jan 7, 2019
Drops all stored procs, views, constraints and tables
View drop-all.sql
/* Drop all non-system stored procs */
DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name])
WHILE @name is not null
BEGIN
SELECT @SQL = 'DROP PROCEDURE [dbo].[' + RTRIM(@name) +']'
EXEC (@SQL)
@Silthus
Silthus / Get-FailedFiles.ps1
Created Mar 12, 2018
Powershell script that parses RoboCopy log and extracts failed files to .csv. Copied from: https://gallery.technet.microsoft.com/scriptcenter/Powershell-script-to-parse-a1bc8a92
View Get-FailedFiles.ps1
#Requires -Version 4
function Log {
<#
.Synopsis
Function to log input string to file and display it to screen
.Description
Function to log input string to file and display it to screen. Log entries in the log file are time stamped. Function allows for displaying text to screen in different colors.