Skip to content

Instantly share code, notes, and snippets.

View rodion-m's full-sized avatar
🤩
CodeAliving

Rodion Mostovoi rodion-m

🤩
CodeAliving
View GitHub Profile

Другие интересные штуки тут: 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
@rain-1
rain-1 / LLM.md
Last active August 16, 2025 00:39
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@davidfowl
davidfowl / MinimalAPIs.md
Last active August 15, 2025 14:58
Minimal APIs at a glance
@LeZuse
LeZuse / 00_README.md
Last active June 4, 2025 14:13
Install node on Apple Silicon M1 both ARM and x86 (Rosetta)

Node.js on Apple Silicon

Node Version Manager (https://github.com/nvm-sh/nvm) works perfectly across native node installations as well as emulated Rosetta installations. The trick I am using here is to install one LTS version of node under Rosetta and another stable version as native binary.

TODO

  • find a way how to run the same node version on both platforms
@mjohnsullivan
mjohnsullivan / icon_gradient.dart
Created November 25, 2019 22:09
Apply a color gradient to an icon in Flutter
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
@michaelbukachi
michaelbukachi / realm.kt
Last active May 24, 2022 04:31
Realm Coroutines
import io.realm.*
import io.realm.kotlin.where
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
private suspend fun <T: RealmObject, S: RealmQuery<T>> findAllAwait(query: S): RealmResults<T> = suspendCancellableCoroutine { continuation ->
val listener = RealmChangeListener<RealmResults<T>> { t -> continuation.resume(t) }
@sgdan
sgdan / gzip.kts
Last active June 3, 2025 06:14
Kotlin code to compress/uncompress a string with gzip
import java.io.ByteArrayOutputStream
import java.io.File
import java.nio.charset.StandardCharsets.UTF_8
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
fun gzip(content: String): ByteArray {
val bos = ByteArrayOutputStream()
GZIPOutputStream(bos).bufferedWriter(UTF_8).use { it.write(content) }
return bos.toByteArray()
@GreyCat
GreyCat / c-struct-to-ksy.rb
Created March 25, 2017 10:53
Convert C struct into Kaitai Struct spec (.ksy)
#!/usr/bin/env ruby
require 'yaml'
TYPE_TO_KSY = {
'uint8_t' => 'u1',
'uint16_t' => 'u2',
'uint32_t' => 'u4',
'uint64_t' => 'u8',
@CMCDragonkai
CMCDragonkai / regular_expression_engine_comparison.md
Last active July 22, 2025 18:21
Regular Expression Engine Comparison Chart

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html