Skip to content

Instantly share code, notes, and snippets.

View agorushkin's full-sized avatar

agorushkin agorushkin

View GitHub Profile
@agorushkin
agorushkin / ulid.ts
Created October 24, 2023 11:33
Function to generate a ULID using bitwise operators.
const UINT32_RADIX = Math.pow(2, 32);
const UINT8_MAX = 0b11111111;
const ENCODING = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
export const ulid = (): string => {
const time = Date.now();
const bytes = crypto.getRandomValues(new Uint8Array(16));
const low = time % UINT32_RADIX;
const high = (time - low) / UINT32_RADIX;
@agorushkin
agorushkin / types.xml
Created April 12, 2023 03:25
DayZ Item IDs in their designated categories
{
"ammo": [
"#Boxed Ammo",
"AmmoBox_00buck_10rnd",
"AmmoBox_12gaRubberSlug_10Rnd",
"AmmoBox_12gaSlug_10Rnd",
"AmmoBox_22_50Rnd",
"AmmoBox_357_20Rnd",
export class Network {
#weights = [] as number[];
#bias = 0;
#alpha = 0.1;
constructor(alpha: number, size: number) {
this.#alpha = alpha
this.#weights = new Array(size).fill(0).map(() => Math.random() * 2 - 1);