Skip to content

Instantly share code, notes, and snippets.

View ChaosEngine's full-sized avatar
🚲
HTML5 game designing

Chaos ChaosEngine

🚲
HTML5 game designing
View GitHub Profile
@ChaosEngine
ChaosEngine / ParallelFor.cs
Created July 20, 2018 21:54
Parallel scheme to partition long calculation
async Task<double> ComputeStuffAsync(CancellationToken token)
{
var tsk = Task.Run(() =>
{
var sum = 0.0;
int DOP = 4;
Parallel.For(0, DOP - 1, new ParallelOptions { MaxDegreeOfParallelism = DOP, CancellationToken = token },
// Initialize the local states
() => (double)0.0,
@ChaosEngine
ChaosEngine / Samsung_SCX-3400_Series.ppd
Created September 2, 2018 11:13
Samsung SCX-3405W Cups PPD file
*PPD-Adobe: "4.3"
*%%%% PPD file for SCX-3200 with CUPS.
*%%%% Created by the CUPS PPD Compiler CUPS v1.5.0.
*FormatVersion: "4.3"
*FileVersion: "2.0.0"
*LanguageVersion: English
*LanguageEncoding: ISOLatin1
*PCFileName: "scx3200.ppd"
*Product: "(SCX-3200)"
*Manufacturer: "Samsung"
@ChaosEngine
ChaosEngine / repro.sh
Created July 29, 2020 19:59
dotnet docker sdk alpine-3.12 test failing repro
#run latest SDK alpine-3.12 image with dump capabilities
docker run -it --rm --cap-add=SYS_PTRACE mcr.microsoft.com/dotnet/core/sdk:3.1-alpine
#we'll be using git
apk add git
#some trivialities
alias ll='ls -lah --color'
cd /srv/
#clone my repo with tests
@ChaosEngine
ChaosEngine / netversion.ps1
Created August 4, 2020 07:17
PowerShell script to return versions of .NET Framework on a machine
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |
Get-ItemProperty -name Version,Release -EA 0 |
Where { $_.PSChildName -match '^(?!S)\p{L}'} |
Select PSChildName, Version, Release
@ChaosEngine
ChaosEngine / WebWorkerify.js
Created November 9, 2020 18:44
WebWorkerify of any JS funcion
Function.prototype.callAsWorker = function (context, args) {
return new Promise((resolve, reject) => {
const code = `
${context ? [...context].reduce((acc, cur) => acc + cur.toString() + '\n') : ''}
self.onmessage = async function (e) {
const result = await ( ${this.toString()}.call(null, e.data) );
self.postMessage( result );