Quick scriptlets to create new little assets for various scripting and experimentation
| """ | |
| du -sh * | python3 sum.py | |
| """ | |
| import sys | |
| import re | |
| numpat = re.compile("(^[0-9.]+)([a-zA-Z]*)") | |
| total = 0.0 |
Quick script to see, when rolling a dice set complement of d6, d8, d10, d12, d20 , which are the most frequent numbers to appear.
Use this to determine how to subdivide your Foe Pool
See also fate chances
Then, aggregating those percentage point chances, what likelihood a given range would be hit.
| // Small allocation-less experiment. | |
| // For sure, there are ways to not allocate at all: passing stack memory locations down. | |
| // This does mean everything needs to be defined higher up where it is ultimately consumed fully | |
| const std = @import("std"); | |
| const Person = struct { | |
| name: []const u8 = "", | |
| age: u8 = 0, | |
| }; |
A little experiment to demonstrate Python's use of threads is indeed concurrency and NOT parallelism
The script is designed such that a bunch of random numbers are processed - this is an attempt at avoiding chances of the execution runtime trying to optimize out some values. The final value is also printed - not because it's interesting, but so that there is no chance the runtime optimizes for the fact that a variable remains unused.
When running the experiment and displaying htop in another screen, it is visible that multi-processing is happening in procs mode (all CPUs blaze a short while),
whilst when I use threads mode, the processing offers just some blips here and there as the main python process gets scheduled wherever it can.
I also did an implementation in Go which uses goroutines, and observing the behaviour in htop indicates that these are doing some level of leveraging either multiprocessing or OS threads somehow, as go run gorun.go 10 clearly has all processes firing on all cylinder
| Copyright (C) Tai Kedzierski | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | |
| documentation files (the “Software”), to deal in the Software without restriction, including without limitation | |
| the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, | |
| and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO |
These are notes for a Zig-inspired strongly-typed GC language, taking some aspects from Python, and retaining some smiilar simplicity as promised by Go.
Zig brings so several great ideas to the table, but a variant of its apporoach for application-space would be very welcome, so it would provide a similar experience to Zig with many of its characteristics:
- error unions
- optionals
- defer
- block scopes