Skip to content

Instantly share code, notes, and snippets.

View krecu's full-sized avatar
🎯
Focusing

Kretshu Evgeniy krecu

🎯
Focusing
View GitHub Profile
This file has been truncated, but you can view the full file.
[
{
"condensed_name": "Education & Occupation",
"segment_type": "Demographic",
"keywords": [
"образование",
"профессия",
"работа",
"карьера",
"занятость",
[
{
"id": "IAB1",
"name": "Arts & Entertainment",
"keywords": [
"arts",
"entertainment",
"show",
"theater",
"cinema",
@krecu
krecu / bloom.go
Last active August 29, 2025 14:54
Bloom
package main
import (
"encoding/base64"
"github.com/willf/bloom"
)
type SegmentsSet struct {
filter *bloom.BloomFilter
}
package openrtb
import (
"strings"
"encoding/json"
openrtb2 "github.com/prebid/openrtb/v20/openrtb2"
"github.com/valyala/fastjson"
)
package search
import (
"github.com/blevesearch/bleve"
"github.com/blevesearch/bleve/analysis/lang/en"
"github.com/blevesearch/bleve/analysis/lang/ru"
"github.com/blevesearch/bleve/mapping"
"github.com/stretchr/testify/assert"
"testing"
)
function observerViewable(element, ttc, ot, fn) {
if (element instanceof HTMLElement) {
let timeoutId = null;
const TIME_TO_CHECK_INTERSECTION_IN_MS = ttc;
const OBSERVER_THRESHOLD = ot;
const OBSERVER_OPTIONS = { threshold: [OBSERVER_THRESHOLD] };
const checkIsVisible = () => {
const elementStyles = getComputedStyle(element);
const elementHeight = (element.clientHeight || parseInt(elementStyles.height, 10)) || 0;
@krecu
krecu / sample_banner.qtc
Created January 26, 2024 17:53
sample_banner.qtc
{% func RenderBanner(data BannerData) %}
{% stripspace %}
{% if data.IFrame %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
html, body {
@krecu
krecu / rewarded.go
Created October 19, 2023 11:00
rewarded.go
const RewardedVideoMarker = "rewarded"
if len(imp.Video.Ext) > 0 {
switch {
case fastjson.Exists(imp.Video.Ext, "videotype"):
if fastjson.GetString(imp.Video.Ext, "videotype") == RewardedVideoMarker {
return RewardedVideoMarker
}
case fastjson.Exists(imp.Video.Ext, "rewarded"):
if fastjson.GetInt(imp.Video.Ext, "rewarded") == 1 {
@krecu
krecu / prometheus.go
Last active July 20, 2023 07:08
Prometheus sample
package metrics
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/valyala/fasthttp"
"github.com/valyala/fasthttp/fasthttpadaptor"
)
// SimpleCounter - global variable
curl --location --request POST 'rtb-eu.b.otm-r.com/test_traffic/bid' \
--header 'X-Forwarded-For: 37.147.151.12' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36' \
--header 'X-Real-IP: 37.147.151.12' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": "69a76093f3eb794809237b041c199fa9",
"imp": [
{
"id": "1",