Skip to content

Instantly share code, notes, and snippets.

@mirasrael
mirasrael / interlocked.cs
Created April 29, 2022 08:59
Interlocked operations
public class Sample
{
private volatile int counter;
public void IncrementUnlocked() => this.counter = this.counter + 1;
@mirasrael
mirasrael / read-write.cs
Created April 15, 2022 08:58
Read Write Lock
public class Sample
{
ReadWriteLockSlim rwLock;
int counter;
public void IncrementTwice()
{
rwLock.EnterWriteLock();
try
@mirasrael
mirasrael / mutex.cs
Last active April 15, 2022 09:09
Mutex
public class Sample
{
object mutex = new object();
int counter;
public void IncrementTwice()
{
lock (mutex)
{
@mirasrael
mirasrael / 5e-tool.js
Created June 9, 2021 09:18
Fixed betteRoll20 1.21.0
This file has been truncated, but you can view the full file.
// ==UserScript==
// @name betteR20-5etools
// @namespace https://5e.tools/
// @license MIT (https://opensource.org/licenses/MIT)
// @version 1.21.0
// @updateURL https://get.5e.tools/script/betteR20-5etools.user.js
// @downloadURL https://get.5e.tools/script/betteR20-5etools.user.js
// @description Enhance your Roll20 experience
// @author 5egmegaanon/astranauta/MrLabRat/TheGiddyLimit/DBAWiseMan/BDeveau/Remuz/Callador Julaan/Erogroth/Stormy/FlayedOne/Cucucc/Cee/oldewyrm/darthbeep
// Copyright (c) Strange Loop Games. All rights reserved.
// See LICENSE file in the project root for full license information.
namespace Eco.Simulation.RouteProbing
{
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Eco.Shared.Math;
using Eco.Shared.Serialization;
public static void Benchmark()
{
var iterations = 1000;
var size = 100000;
for (var i = 0; i < size; i++)
{
concurrent.Add(i.ToString(), i);
simple.Add(i.ToString(), i);
threadSafe.Add(i.ToString(), i);
}
@mirasrael
mirasrael / 1
Last active March 14, 2019 05:57
Dlls
Accessibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a:C:\Program Files\Unity\Hub\Editor\2018.3.8f1\Editor\Data\MonoBleedingEdge\lib\mono\unityjit\Accessibility.dll
Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null:<Dynamic>
Eco.Client, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null:W:\projects\Eco\Client\Library\ScriptAssemblies\Eco.Client.dll
Eco.Client.IntegrationTests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null:W:\projects\Eco\Client\Library\ScriptAssemblies\Eco.Client.IntegrationTests.dll
Eco.Client.Tests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null:W:\projects\Eco\Client\Library\ScriptAssemblies\Eco.Client.Tests.dll
Eco.LocalizationTools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null:W:\projects\Eco\Client\Assets\Plugins\Eco.LocalizationTools.dll
Eco.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null:W:\projects\Eco\Client\Assets\Plugins\Eco.Shared.dll
Editor.Eco, Version=0.0.0.0, Cul
@mirasrael
mirasrael / DictConcurrency.cs
Created February 11, 2019 10:05
dict comparison
public static void Main (string[] args)
{
var iterations = 1000;
var size = 100000;
for (var i = 0; i < size; i++)
{
concurrent.Add(i.ToString(), i);
simple.Add(i.ToString(), i);
threadSafe.Add(i.ToString(), i);
}
@mirasrael
mirasrael / collections.kt
Last active January 19, 2019 17:47
Collections for Kotlin lesson
package education
import java.util.*
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
/**
* Date: 1/13/2019
* Time: 20:49
@mirasrael
mirasrael / arrays.kt
Created November 18, 2018 06:36
Array utility functions for Kotlin lessons
import java.util.*
/**
* Date: 11/18/2018
* Time: 09:26
*/
fun printArray(a: LongArray) {
var i = 0
while (i < a.size) {
print(a[i++])