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 / add-txt2img.md
Last active March 15, 2025 05:48
SuperCollider scripts for generating binaural beats and syncing them with visual outputs via OSC (Open Sound Control) to control lights or other visual elements.

-- explore the concept, look at related efforts, and critically assess the feasibility based on available tools and trends.

What This Would Look Like

Syncing binaural beats with text-to-image diffusion models to create videos would involve:

  1. Audio Component: Generating binaural beats (e.g., two tones like 200 Hz and 210 Hz to produce a 10 Hz beat) to influence brainwave states (e.g., relaxation, focus).
  2. Visual Component: Using a text-to-image diffusion model (e.g., Stable Diffusion) to generate frames based on prompts, potentially evolving over time to match the audio’s rhythm or frequency.
  3. Video Synthesis: Combining these frames into a video where the visuals transition or pulse in sync with the binaural beat frequency, possibly using a text-to-video extension (e.g., AnimateDiff, ModelScope) or manual frame sequencing.
  4. Purpose: Creating an audio-visual entrainment (AVE) experience where the video enhances the brainwave effects of the binaural beats.

Evidence of Related Ef

@usametov
usametov / mat2parquet.md
Created March 14, 2025 16:27
Python script to read MATLAB (.mat) file and save it as a Parquet

Let us use the scipy.io library to read MATLAB files and pandas with pyarrow to handle Parquet file conversion.

Here's a comprehensive example:

# First, install required packages if you haven't already
# pip install scipy pandas pyarrow numpy

import scipy.io
import pandas as pd
@usametov
usametov / gemma3-colab-tutorial.md
Last active March 13, 2025 18:43
gemma 3 27B on colab tpu using JAX

Running the Gemma 3-27B model on a TPU using JAX in Google Colab requires careful setup, as the model is large and TPUs have specific requirements for efficient execution. Below is a step-by-step guide to help you achieve this. Note that the Gemma 3-27B model is computationally intensive, and Google Colab's free TPU resources may not be sufficient due to memory and runtime limitations. You may need access to premium Colab resources or alternative platforms like Kaggle or Google Cloud TPUs for successful execution.

Step-by-Step Guide

1. Set Up Google Colab with TPU Runtime

  • Open a new notebook in Google Colab: Google Colab.
  • Go to the Runtime menu, select Change runtime type, and choose TPU v2 as the hardware accelerator. Note that Colab provides TPU v2, which may not have enough memory for a 27B model, so consider upgrading to a paid plan or using an alternative platform if necessary.

2. Install Required Libraries

  • You need
@usametov
usametov / bipartite-graph.md
Last active March 13, 2025 00:57
graph theory: men and women

https://grok.com/share/bGVnYWN5_046f4fe1-c33f-4c68-a4d6-51711bc40c07

To address the statement "men also have more sexual partners than women" using graph theory, we can model heterosexual relationships as a bipartite graph and analyze the implications. This approach helps us rigorously evaluate the statement, particularly in the context of averages, which is often implied in such claims.

Step 1: Define the Problem and Model

The statement compares the number of sexual partners between men and women, typically interpreted as comparing the average number of partners. We will focus on heterosexual relationships for simplicity, as this is the most straightforward interpretation of the statement (though we can later consider extensions to other cases). In graph theory terms, we can represent heterosexual relationships as a bipartite graph:

  • Let ( M ) be the set of all men, and ( W ) be the set of all women.
  • An edge ( (m, w) ) exists between a man ( m \in M ) and a woman ( w \in W ) if they have
@usametov
usametov / modern-java.md
Created March 12, 2025 23:32
new java features, last 10 years

Over the past 8 years (since 2017), the Java programming language has undergone significant improvements, with new features and enhancements introduced in each major release. Oracle shifted Java to a six-month release cycle starting with Java 9 in September 2017, enabling faster delivery of features. Below is a summary of key improvements in Java from Java 9 (2017) to Java 23 (expected in 2024), focusing on major language enhancements, performance improvements, and developer productivity.


Java 9 (September 2017)

  1. Module System (Project Jigsaw)
    • Introduced the Java Platform Module System (JPMS) to modularize the JDK and applications.
    • Key feature: module-info.java files to define module boundaries, exports, and dependencies.
    • Benefits: Improved encapsulation, security, and scalability for large applications.
@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
// ====================