Skip to content

Instantly share code, notes, and snippets.

View pkit's full-sized avatar

Constantine Peresypkin pkit

  • Airfold
  • San Francisco, USA
View GitHub Profile
const Pool = require('pg-pool');
const STATE = {
CANCELLED: 0,
ACTIVE: 1,
WAITING: 2,
}
export class ManagedPool extends Pool {
constructor (options) {
@pkit
pkit / Makefile
Last active October 8, 2020 17:19
v8 BigInt parser test
CC = g++
CFLAGS = -Wall -std=c++11 -fno-rtti -O2 -DV8_COMPRESS_POINTERS -DV8_31BIT_SMIS_ON_64BIT_ARCH -I../include -I.. -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -fPIC -c
LDFLAGS = -Wall -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -fstack-protector-strong -fno-omit-frame-pointer
V8_OUT ?= ../out.gn/x64.release/obj
ZLIB_OUT = $(V8_OUT)/third_party/zlib
ZLIB_OBJS = $(ZLIB_OUT)/zlib_adler32_simd/adler32_simd.o $(ZLIB_OUT)/zlib_inflate_chunk_simd/inffast_chunk.o $(ZLIB_OUT)/zlib_inflate_chunk_simd/inflate.o $(ZLIB_OUT)/zlib_crc32_simd/crc32_simd.o $(ZLIB_OUT)/zlib_x86_simd/crc_folding.o $(ZLIB_OUT)/zlib_x86_simd/fill_window_sse.o
V8_LIBS = -lv8_base_without_compiler -lv8_compiler -lv8_base_without_compiler -lchrome_zlib -lcompression_utils_portable -ltorque_generated_definitions -lcppgc_base -lv8_cppgc_shared -lv8_snapshot -lv8_libplatform -lv8_libbase -lv8_libsampler -lchrome_zlib -lv8_libplatform
LIBS = -L/usr/lib/x86_64-linux-gnu -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed $(
@pkit
pkit / big_int_128.patch
Created January 21, 2021 12:49
v8 exploits patches
diff --git a/src/numbers/conversions.cc b/src/numbers/conversions.cc
index 27f0a6ac3b..0d6eec63a4 100644
--- a/src/numbers/conversions.cc
+++ b/src/numbers/conversions.cc
@@ -392,7 +392,7 @@ void StringToIntHelper<LocalIsolate>::DetectRadixInternal(Char current,
template <typename LocalIsolate>
template <class Char>
bool StringToIntHelper<LocalIsolate>::ParseChunkInternal(Char start) {
- const int kChunkSize = 10240;
+ const int kChunkSize = 128;

Events table (ordered by insertion):

CREATE TABLE events (
  id UInt64,
  ts DateTime64(3),
  data TEXT
)
ENGINE=MergeTree()
ORDER BY tuple()
@pkit
pkit / clickhouse_url_server.py
Created November 20, 2023 19:43
The most basic URL server for ClickHouse. Can be used with the `URL()` engine: `URL('http://localhost:8555/', JSONEachRow)`
import contextlib
import io
import json
import logging
import os
import socket
import sys
from functools import partial
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
from typing import Any, Iterator
@pkit
pkit / docker-credential-gh
Created December 10, 2023 01:55
ghcr.io credential helper
#!/bin/bash
set -e
cmd="$1"
if [ "erase" = "$cmd" ]; then
cat - >/dev/null
exit 0
fi
if [ "store" = "$cmd" ]; then
cat - >/dev/null
@pkit
pkit / Russian-Phonetic-Linux.keylayout
Created September 19, 2024 19:33
Russian Phonetic Linux Keyboard layout for OSX
<?xml version="1.1" encoding="UTF-8"?>
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<!-- Fri, 24 Feb 2006 Generated from KCHR: "Russian - Phonetic" -->
<!--Last edited by Ukelele version 396 on 2024-09-19 at 12:24 (PDT)-->
<!--Created by Ukelele version 1.8 on 2008-08-02 at 16:24 (EDT)-->
<keyboard group="7" id="19457" name="Russian-Phonetic-Linux" maxout="1">
<layouts>
<layout first="0" last="0" mapSet="ANSI" modifiers="commonModifiers"/>
</layouts>
<modifierMap id="commonModifiers" defaultIndex="4">
@pkit
pkit / analyze_method_resolution.py
Created October 29, 2024 17:51
Analyze and print method resolution for each method in a class
from some_package import SomeClass
def analyze_method_resolution(cls: Type, include_magic_methods: bool = False) -> None:
"""
Analyzes and prints the method resolution for all methods in a class
without executing them.
Args:
cls: The class to analyze