Skip to content

Instantly share code, notes, and snippets.

View usametov's full-sized avatar

Ulan Sametov usametov

  • Asta Nova Enterprise Solutions
View GitHub Profile
@usametov
usametov / playwright-help.md
Created March 12, 2025 03:57
how to avoid being blocked

When scraping websites using Playwright in headless mode, you might get blocked due to anti-bot measures implemented by the target website. These measures often detect automated browsers and block them to prevent scraping. Below are several strategies to help you avoid being blocked, along with implementation tips using Playwright in Python or JavaScript.


Why You're Getting Blocked

Websites use various techniques to detect headless browsers, such as:

  1. User-Agent Detection: Your browser's user-agent might indicate a headless browser.
  2. Browser Fingerprinting: Websites analyze browser properties (e.g., screen resolution, WebGL, plugins) to detect automation.
  3. Behavior Analysis: Websites may track mouse movements, click patterns, or other human-like behavior.
  4. IP Blocking: Frequent requests from the same IP can trigger rate-limiting or blocking.

A/B testing is a powerful method to compare two versions of a user experience (UX) design to determine which performs better. Below is a quickstart guide for conducting A/B testing for UX, with a focus on using R for statistical analysis.

Quickstart Guide to A/B Testing for UX with R

1. Define Your Goal and Metrics

  • Goal: Identify the specific UX improvement you want to test (e.g., increase button click-through rate, reduce bounce rate, improve form completion).
  • Metrics:
    • Primary Metric: The key performance indicator (KPI) tied to your goal (e.g., conversion rate, time on page).
    • Secondary Metrics: Additional metrics to monitor for unintended consequences (e.g., user satisfaction, page load time).
  • Example: If testing a new button design, your primary metric might be the click-through rate (CTR).
@usametov
usametov / EventEmitter.md
Last active March 21, 2025 02:43
angular learning notes

Angular's EventEmitter is a class in the @angular/core module that facilitates event-driven communication between components, particularly in a parent-child component relationship. It’s built on top of Angular’s reactive programming model and is commonly used to emit custom events that other parts of the application can listen to and respond to. Essentially, it’s a way to send data or signals from one component (usually a child) to another (usually a parent).

What is EventEmitter?

  • EventEmitter extends RxJS’s Subject, making it an observable that can emit values to subscribers.
  • It’s designed specifically for Angular’s component interaction, allowing you to define custom events with the @Output() decorator.
  • You can emit any type of data (e.g., strings, objects, numbers) through an EventEmitter.

How Does It Work?

  1. Define an EventEmitter in the Child Component: Use the @Output() decorator to mark it as an event that the parent can bind to.
  2. Emit an Event: Call the `em
@usametov
usametov / thinking_tokens.py
Created January 26, 2025 04:03 — forked from zainhas/thinking_tokens.py
Extract ONLY thinking tokens from DeepSeek-R1
from together import Together
client = Together(api_key = TOGETHER_API_KEY)
question = "Which is larger 9.9 or 9.11?"
thought = client.chat.completions.create(
model="deepseek-ai/DeepSeek-R1",
messages=[{"role": "user", "content": question}],
stop = ['</think>']
)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// ©jdehorty
// @version=5
indicator('Machine Learning: Lorentzian Classification', 'Lorentzian Classification', true, precision=4, max_labels_count=500)
import jdehorty/MLExtensions/2 as ml
import jdehorty/KernelFunctions/2 as kernels
// ====================
@usametov
usametov / simba.clj
Created May 25, 2024 18:36 — forked from apeckham/simba.clj
connect to bigquery with clojure.java.jdbc
(ns simba
(:require [clojure.java.jdbc :as j])
(:import (com.simba.googlebigquery.jdbc42 Driver)))
(def conn {:classname "com.simba.googlebigquery.jdbc42.Driver"
:subprotocol "bigquery"
:subname "//https://www.googleapis.com/bigquery/v2:443;ProjectId=MY-PROJECT-ID;OAuthServiceAcctEmail=USERNAME@PROJECT.iam.gserviceaccount.com;OAuthPvtKeyPath=PATH-TO-P12-FILE"})
(defn run-query [query] (j/query conn [query]))
@usametov
usametov / rust-xp-01-s3.rs
Created May 10, 2024 02:12 — forked from jeremychone/rust-xp-01-s3.rs
Rust Quick Example to connect to S3 and Minio bucket server
#![allow(unused)] // silence unused warnings while exploring (to comment out)
use std::{error::Error, str};
use s3::bucket::Bucket;
use s3::creds::Credentials;
use s3::region::Region;
use s3::BucketConfiguration;
// Youtube Walkthrough - https://youtu.be/uQKBW8ZgYB8
@usametov
usametov / rsakeypairgen.clj
Created April 13, 2024 22:36 — forked from postspectacular/rsakeypairgen.clj
RSA keypair generator w/ Clojure (requires Bouncycastle & unlimited JCE). Based on bundled example (org.bouncycastle.openpgp.examples.RSAKeyPairGenerator)
;; usage:
;;
;; (-> (rsa-keypair 2048)
;; (generate-secret-key "alice@example.org" "hello")
;; (export-keypair "alice.pub" "alice.sec" true))
(import
'[java.util Date]
'[java.security SecureRandom KeyPair KeyPairGenerator]
'[org.bouncycastle.jce.provider BouncyCastleProvider]
@usametov
usametov / ssh2hitron.sh
Created April 8, 2024 01:55 — forked from breyer/ssh2hitron.sh
Getting ssh access to HITRON cable modem
#!/bin/bash
#HITRON=10.10.2.1
HITRON=192.168.100.1
USER=app
PASSWORD="com8&#wDs2*1er"
OPTIONS="-o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ServerAliveInterval=5 -o ServerAliveCountMax=1"
echo Password of $USER $PASSWORD
while [ 1 ]
do
echo connect...
@usametov
usametov / github_graphql_api_client.clj
Created March 18, 2024 20:46 — forked from lagenorhynque/github_graphql_api_client.clj
A minimal GitHub GraphQL API client implemented as a babashka (Clojure) script
#!/usr/bin/env bb
(ns github-graphql-api-client
(:require
[babashka.curl :as curl]
[cheshire.core :as cheshire]
[clojure.pprint :refer [pprint]]))
(def auth-token (System/getenv "AUTH_TOKEN"))
(def graphql-query