Skip to content

Instantly share code, notes, and snippets.

@ValeryVerkhoturov
ValeryVerkhoturov / bigint.js
Last active September 22, 2025 05:39
Handle BigInt in JSON serialization & deserialization
const WBNBReportsJSON = (() => {
const noiseValue = /^-?\d+n+$/; // Noise - strings that match the custom format before being converted to it
const originalStringify = JSON.stringify;
const originalParse = JSON.parse;
/*
Function to serialize value to a JSON string.
Converts BigInt values to a custom format (strings with digits and "n" at the end) and then converts them to proper big integers in a JSON string.
*/
const stringify = (value, replacer, space) => {
import random
from decimal import Decimal, getcontext
getcontext().prec = 7
def split_amount_with_error(total_amount, parts=10, error_percent=10):
total_amount = Decimal(str(total_amount))
error_fraction = Decimal(str(error_percent)) / Decimal('100')
base_part = total_amount / Decimal(str(parts))
document.documentElement.style.setProperty('scrollbar-gutter', 'stable');
@ValeryVerkhoturov
ValeryVerkhoturov / Dockerfile
Created April 20, 2025 09:49
Dockerfile for SPA (Ex.: Vite)
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm i --force
COPY . .
RUN npm run build
@ValeryVerkhoturov
ValeryVerkhoturov / bridges-tor-mac.md
Last active April 30, 2025 12:36
Update bridges to make tor service work on MacOS

Install tor via HomeBrew and start the tor service.

brew install tor && brew services start tor

And to use obsf4 proxy we need to install its library/ Use HomeBrew for installation of the library.

brew install obfs4proxy
@ValeryVerkhoturov
ValeryVerkhoturov / hello.go
Created January 30, 2025 16:30 — forked from ereli/hello.go
How to sign macOS and Windows executables using self-signed certificates on a Mac.
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
@ValeryVerkhoturov
ValeryVerkhoturov / nginx-cors.conf
Created January 19, 2025 15:53 — forked from sbuzonas/nginx-cors.conf
Nginx CORS maps
map $http_origin $allow_origin {
default "";
"~^https?://(?:[^/]*\.)?(stevebuzonas\.(?:com|local))(?::[0-9]+)?$" "$http_origin";
}
map $request_method $cors_method {
default "allowed";
"OPTIONS" "preflight";
}
@ValeryVerkhoturov
ValeryVerkhoturov / zipcode.csv
Created December 29, 2024 11:16
USA zipcode radius and bounds
We can't make this file beautiful and searchable because it's too large.
zipcode,lat,lng,radius_in_miles,bounds_west,bounds_east,bounds_north,bounds_south
23883,37.13,-76.83,7,-76.840094,-76.641581,37.210962,37.034273
23884,36.92,-77.28,13,-77.29079,-77.269319,36.91969,36.913262
23885,37.19,-77.56,5,-77.645795,-77.50547,37.250782,37.114609
23887,36.58,-77.83,6,-77.879894,-77.744203,36.613827,36.544878
23888,36.96,-76.98,8,-77.095809,-76.84547,37.037233,36.854508
23889,36.89,-77.74,7,-77.844347,-77.657867,36.958291,36.8423
23890,37.03,-77.09,12,-77.295957,-76.946848,37.14819,36.844721
23891,37.05,-77.21,2,-77.230106,-77.192022,37.064772,37.040587
23893,36.63,-77.91,6,-77.978475,-77.866649,36.702117,36.544446
package main
import (
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
var (
db gorm.DB
)
// Просмотреть код, назвать, что выведется в stdout
package main
import (
"fmt"
"time"
"sync"
)
type Agent struct {