Skip to content

Instantly share code, notes, and snippets.

@fabio-stein
fabio-stein / FileSystemDemo.cs
Created January 28, 2024 01:16
Create a simple file system example with simple commands to manage the content. It simulates FS blocks with header metadata
using System.Text.Json;
//File.Delete("data.txt");
var stream = File.Open("data.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
var fs = new FileSystem(stream);
var fc = new FileContext(fs);
Console.WriteLine(@"Command list:
ls
cat @fileName
@fabio-stein
fabio-stein / pomodoro.md
Created October 10, 2023 03:14
The best Pomodoro Timer - ZenTik.io

Elevate Your Productivity with ZenTik - Pomodoro Timer

Hey there, productivity enthusiasts! Are you ready to revolutionize the way you work? Introducing Zentik, your ultimate companion for achieving a state of focused flow and tranquility in your daily tasks.

The Power of Pomodoro Technique, Enhanced

@fabio-stein
fabio-stein / SimpleParallelTaskExample.cs
Created September 8, 2021 23:50
Example - Run Tasks in parallel with PLINQ controlling/limiting max number of threads
using System;
using System.Linq;
using System.Threading.Tasks;
class Program
{
const int generatedTasks = 10;
const int maxThreads = 2;
static Random random = new Random();
@fabio-stein
fabio-stein / ex2.sql
Created November 14, 2020 18:34
Exercicio 2 SQL
WITH bichos_familia AS(
SELECT m.id_familia, SUM(m.quantidadebichosestimacao) AS bichos FROM Morador m
GROUP BY m.id_familia
)
SELECT c.bairro AS 'Bairro', COALESCE(SUM(b.bichos),0) AS 'Bichos de Estimação' FROM Condominio c
LEFT JOIN Familia f ON c.Id = f.id_condominio
LEFT JOIN bichos_familia b ON b.id_familia = f.id
GROUP BY c.bairro
@fabio-stein
fabio-stein / DateUtil.cs
Created November 14, 2020 18:02
Get Nth Business Day C#
using System;
namespace TestApp
{
public class DateUtil
{
public static DateTime Get5thBusinessDay(DateTime sourceMonth)
{
return GetNthBusinessDay(5, sourceMonth);
}
import os
import socket
import subprocess
# Create a socket
def socket_create():
try:
global host
global port