Skip to content

Instantly share code, notes, and snippets.

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

Текущие выполняемые запросы

select pid, user, client_addr, query_start, backend_type, substr(query, 0, 256) as query
from pg_stat_activity
where query_start is not null
  and client_addr is not null;
@theevilbit
theevilbit / screenshot.m
Last active April 19, 2024 07:55
Make a screenshot on macOS using Objective-C
/*
Compile:
gcc -framework Foundation -framework AppKit screenshot.m -o screenshot
*/
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
int main(void) {
/* v5.1.0 - August 2021 */
.accordion-body
.accordion-button
.accordion-collapse
.accordion-flush
.accordion-header
.accordion-item
.active
.alert
.alert-danger
@vtenq
vtenq / git-workflow.md
Last active April 19, 2024 07:53
Git workflow with conventional commits and semantic auto release

Git workflow with conventional commits and semantic auto release

This is an adoptation of Git flow by Vincent Driessen with conventional commits and semantic release.

The main concepts

At the core, the development model is greatly inspired by existing models out there. The central repo holds two main branches with an infinite lifetime:

@leonbora167
leonbora167 / Paddle_OCR_Training.ipynb
Last active April 19, 2024 07:53
Steps for training Detector and Recognizer of PaddleOCR
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cayter
cayter / repository.ts
Last active April 19, 2024 07:53
Drizzle ORM Type-Safe Repository With PgTable
import { startSpan } from "@sentry/remix";
import type { StartSpanOptions } from "@sentry/types";
import {
type AnyColumn,
type AnyTable,
type BuildQueryResult,
type DBQueryConfig,
type DrizzleTypeError,
type Equal,
type ExtractTablesWithRelations,
@shakahl
shakahl / how-to-integrate-wsl-with-windows-10.md
Last active April 19, 2024 07:51
How to seamlessly integrate Windows Subsystem for Linux (WSL) with Windows

How to seamlessly integrate Windows Subsystem for Linux (WSL) with Windows

Installation

Install an Ubuntu version from Microsoft Store.

Please check out the Windows 10 Installation Guide written by Microsoft itself.

@thinca
thinca / megurorb17.md
Created July 31, 2018 13:39
Meguro.rb #17 Ruby で Vim を拡張する

Ruby で Vim を拡張する

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@Rich-Harris
Rich-Harris / imperative-v-declarative-imports.md
Last active April 19, 2024 07:49
Why imperative imports are slower than declarative imports

Why imperative imports are slower than declarative imports

A lot of people misunderstood Top-level await is a footgun, including me. I thought the primary danger was that people would be able to put things like AJAX requests in their top-level await expressions, and that this was terrible because await strongly encourages sequential operations even though a lot of the asynchronous activity we're talking about should actually happen concurrently.

But that's not the worst of it. Imperative module loading is intrinsically bad for app startup performance, in ways that are quite subtle.

Consider an app like this:

// main.js