Skip to content

Instantly share code, notes, and snippets.

@DBalashov
DBalashov / count-loc.ps1
Created March 20, 2024 15:04
Run in solution directory (example): powershell -F ..\count-loc.ps1
$extensions = @(".cs", ".vue", ".scss", ".ts")
$exclude = @("\bin\", "\obj\", "\node_modules\", "\.nuxt\", "\.output\")
$path = $args[0]
$files = Get-ChildItem -Recurse -Include ($extensions | % { '*' + $_ }) $path
$statLength = @{}
$statLOC = @{}
$totalLOC = 0;

Другие интересные штуки тут: https://t.me/notes_of_programmer

Размер таблицы с детализацией

select l.metric
     , l.nr                                            as bytes
     , case when is_size then pg_size_pretty(nr) end   as bytes_pretty
     , case when is_size then nr / nullif(x.ct, 0) end as bytes_per_row
from (select min(tableoid)        as tbl     -- = 'public.tbl'::regclass::oid
using System.Data.Common;
using System.Text;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace PostgresExtensions;
/*
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
#pragma warning disable CS8618
var summary = BenchmarkRunner.Run<MainTest>();
@DBalashov
DBalashov / clickhouse_useful_queries.sql
Last active July 5, 2025 06:42
Clickhouse useful queries
select name,
formatReadableSize(sum(data_compressed_bytes)) as compressed_size,
formatReadableSize(sum(data_uncompressed_bytes)) as uncompressed_size,
round(sum(data_uncompressed_bytes) / sum(data_compressed_bytes), 2) as ratio
from system.columns
where table = 'deals'
group by name
order by sum(data_compressed_bytes) desc
-----------------------------------------------------------------------------------------------------------------------
select table,
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
#pragma warning disable CS8618
var summary = BenchmarkRunner.Run<MainTest>();
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
#pragma warning disable CS8618
var summary = BenchmarkRunner.Run<MainTest>();
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
#pragma warning disable CS8618
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
// | Method | Categories | N | Mean | Error | StdDev | Ratio |
// |----------------- |----------- |------- |--------------:|-------------:|-----------:|------:|
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
// | Method | Categories | N | Mean | Error | StdDev | Ratio |
// |------------------- |----------- |------- |--------------:|-----------:|-----------:|------:|