Skip to content

Instantly share code, notes, and snippets.

@ursuleacv
ursuleacv / microgpt.py
Last active February 11, 2026 22:33 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and inference a GPT LLM in pure, dependency-free Python.
Differences from GPT-2 are minor: rmsnorm instead of layer norm, no biases, square ReLU instead of GeLU nonlinearity.
The contents of this file is everything algorithmically needed to train a GPT. Everything else is just efficiency.
Art project by @karpathy.
"""
import os # for os.path.exists
import math # for math.log, math.exp
import random # for random.seed, random.choices
@ursuleacv
ursuleacv / parallel_pcntl_example.php
Created October 17, 2025 15:56
PHP Parallel Execution with pcntl_fork() and Return Values
<?php
// Make sure the PCNTL extension is available
if (!function_exists('pcntl_fork')) {
die("PCNTL functions not available. Please install the PCNTL extension.\n");
}
// Create a temp directory for process communication
$tempDir = sys_get_temp_dir() . '/pcntl_' . uniqid();
mkdir($tempDir, 0755, true);
@ursuleacv
ursuleacv / PIIMasker.php
Created August 29, 2025 01:08
PHP class to mask or anonymize PII data
<?php
/**
* Class PIIMasker
*
* This class provides methods to mask or anonymize Personally Identifiable Information (PII).
* Masking involves partial replacement for readability, while anonymization uses hashing for irreversibility.
* It's recommended to use anonymization for storing data securely.
*/
class PIIMasker
@ursuleacv
ursuleacv / deploy.sh
Created October 12, 2024 17:56 — forked from cagartner/deploy.sh
Laravel Push deploy Github actions example
#!/bin/sh
set -e
vendor/bin/phpunit
(git push) || true
git checkout production
git merge master
@ursuleacv
ursuleacv / deployment_guide.md
Created October 12, 2024 17:52 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel
@ursuleacv
ursuleacv / cd.yml
Created October 12, 2024 17:51 — forked from madsem/cd.yml
GitHub Workflows For: Laravel CI with Mysql 8 & Laravel Vapor Deployment
name: Laravel Vapor CD
on:
release:
types: [ published, deleted ]
branches:
- master
jobs:
deploy_release:
runs-on: ubuntu-20.04
@ursuleacv
ursuleacv / README.md
Created October 12, 2024 17:49 — forked from mindfullsilence/README.md
Deployment scripts for atomic deployment of laravel applications in runcloud

Runcloud Automic Deployment Script For Laravel Applications

These scripts can be used to set up automic deployments in runcloud for laravel applications

@ursuleacv
ursuleacv / provision-preview.yaml
Created October 12, 2024 17:46 — forked from LarryBarker/provision-preview.yaml
Automatically deploy PRs to preview environments with the help of Laravel Forge
name: Preview Environment
on:
pull_request:
types: [opened]
env:
FORGE_API_TOKEN: ${{ secrets.FORGE_API_TOKEN }}
FORGE_SERVER_ID: ${{ secrets.FORGE_SERVER_ID }}
@ursuleacv
ursuleacv / quadratic_polynom.php
Created September 10, 2023 19:47
Calculate quadratic polynomial regression
<?php
function quadraticRegression($dataPoints) {
$sumX = 0;
$sumX2 = 0;
$sumX3 = 0;
$sumX4 = 0;
$sumY = 0;
$sumXY = 0;
$sumX2Y = 0;
@ursuleacv
ursuleacv / polyfit.php
Created September 9, 2023 19:44
polyfit equivalent in PHP
<?php
function polyfit($dependentValues, $independentValues, $countOfElements, $order, &$coefficients)
{
// Declarations...
// ----------------------------------
$maxOrder = 5;
$B = array_fill(0, $maxOrder + 1, 0.0);
$P = array_fill(0, (2 * ($maxOrder + 1)) + 1, 0.0);
$A = array_fill(0, (2 * ($maxOrder + 1)) * ($maxOrder + 1), 0.0);