Skip to content

Instantly share code, notes, and snippets.

View revenkroz's full-sized avatar
😏
It's probably fine

Oleg Koval revenkroz

😏
It's probably fine
View GitHub Profile
@revenkroz
revenkroz / frp.md
Last active January 17, 2024 11:32
Install FRP
@revenkroz
revenkroz / 0.md
Last active August 10, 2023 11:19
retry simulation
@revenkroz
revenkroz / 1-approach.md
Created November 22, 2022 20:32
Approaches to SSR with v8go

First Approach

Fastest one. The idea is to run SSR script, get function with sensitive args and run it.

iso object has Isolate *v8go.Isolate and RenderScript *v8go.UnboundScript (it was compiled before).

Go Code

// renderer.go

How to install and use PHP XHProf in Docker

1. Add Dockerfile with XHProf module and GUI

FROM php:8.1-fpm-alpine AS xhprof

WORKDIR /app

# graphviz and ttf-freefont are required to vizualize functions calls
const clubs = ["Тирана","Теута","Влазния","Лячи","Кукеси","Скендербеу","Партизани","Алашкерт","Арарат","Ноа","Арарат-Армения","Пюник","Гандзасар","Урарту","Ширак","Ред Булл Зальцбург","ЛАСК","Рапид Вена","Штурм","Альтах","Рид","Санкт-Пельтен","Адмира","Аустрия","Нефтчи","Карабах","Габала","Кешля","Сабаил","Ислочь","Энергетик-БГУ","Рух Брест","Динамо Минск","Шахтер Солигорск","Спутник","БАТЭ","Неман","Славия Мозырь","Динамо Брест","Минск","Витебск","Слуцк","Гомель","Торпедо-БелАЗ","Сморгонь","Серкль Брюгге","Брюгге","Гент","Эйпен","Берсхот","Генк","Кортрейк","Левен","Антверпен","Мускрон","Стандард","Андерлехт","Сент-Труйден","Шарлеруа","Зюлте-Варегем","Васланд-Беверен","Мехелен","Остенде","Борац Баня-Лука","Радник","Сараево","Железничар","Зриньски","Широки Бриег","Берое","ЦСКА-1948 София","ЦСКА София","Левски","Локомотив Пловдив","Лудогорец","Динамо Загреб","Хайдук","Риека","Локомотива Загреб","Осиек","Славен","Вараждин","АЕЛ","Анортосис","Омония","АЕК Ларнака","Аполлон","АПОЭЛ","Виктория Пльзень","Сигма","Фас
@revenkroz
revenkroz / example-docker-nginx.conf
Last active May 15, 2021 11:34
Docker-Nginx Examples
server {
listen 80;
server_name example.com;
return 301 https://example.com/;
}
server{
listen 443 ssl http2;
@revenkroz
revenkroz / image-with-rounded-border.js
Created February 25, 2021 12:12
Script to get an image (see selector) with rounded borders
(() => {
function roundedImage(x, y, width, height, radius) {
ctx.beginPath();
ctx.moveTo(x + radius, y);
ctx.lineTo(x + width - radius, y);
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
ctx.lineTo(x + width, y + height - radius);
ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
ctx.lineTo(x + radius, y + height);
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
<?php declare(strict_types=1);
class Converter
{
private const URL = 'http://www.cbr.ru/scripts/XML_daily.asp';
private const CURRENCY_ID = 'R01239';
/** @var DOMXPath|null */
private $xpath = null;
@revenkroz
revenkroz / run-tmux.sh
Last active December 3, 2020 17:11
Control shared tmux session
if [[ $# < 1 ]] ; then
echo 'Usage: ./run-tmux.sh <start|stop|"command">'
exit 1
fi
SESSION_FILE=tmux.session
SESSION_NAME=shared
COMMAND=$1
@revenkroz
revenkroz / control-screen.sh
Created December 3, 2020 16:39
Script to control screen
if [[ $# < 1 ]] ; then
echo 'Usage: ./start-screen.sh <screen_name> ["commands_in_quotes"]'
echo 'To stop screen: ./start-screen.sh <screen_name> "quit"'
exit 1
fi
SCREEN_NAME=$1
COMMAND=$2
if ! screen -list | grep -q $SCREEN_NAME; then