Skip to content

Instantly share code, notes, and snippets.

View realSergiy's full-sized avatar
💭
Full-stack AI: data -> fine-tune -> impact

realSergiy realSergiy

💭
Full-stack AI: data -> fine-tune -> impact
View GitHub Profile
@realSergiy
realSergiy / fresh-os-steps.sh
Created April 30, 2026 02:50
setup-kubuntu-ansible fresh-OS bootstrap
#!/usr/bin/env bash
set -euo pipefail
ARCH="$(dpkg --print-architecture)"
echo "==> Updating apt and applying pending upgrades"
sudo apt update
sudo apt full-upgrade -y
echo "==> Adding Brave apt repository"
@realSergiy
realSergiy / hexRandomWalk.ts
Last active July 31, 2022 20:00
Hex Random Walk
class Hexagon {
// function which will instantiate the class
constructor(level: number, index: number) {
this.level = level;
this.levelId = index;
this.neighbors = [];
this.levelCount = (this.level - 1) * 6;
@realSergiy
realSergiy / ralatedRains.ts
Last active July 29, 2022 11:55
Related Rains Simple
const simulate = (runs: number) => {
let rainedOnSaturdayGivenSunday = 0;
let rainySaturdaysSanityCheck = 0;
let rainySundays = 0;
const startTime = performance.now();
for (let i = 0; i <= runs; i++) {
const hasRainedOnSaturday = Math.random() < 0.25;
const createRndFunc = (): () => number => {
const cryptoQuotaInBytes = 65536; // https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues#exceptions
const cryptoSystemMax = cryptoQuotaInBytes / Uint32Array.BYTES_PER_ELEMENT;
const maxValue = Math.pow(2, 32) + 1;
let randomUIntArr = new Uint32Array(cryptoSystemMax);
crypto.getRandomValues(randomUIntArr);
let randomFloatArray = [...randomUIntArr.values()].map(x => x/maxValue);
let elementIndex = 0;