Skip to content

Instantly share code, notes, and snippets.

@cheadrian
cheadrian / Chrome Extension Manifest V3 Firebase Javascript.md
Last active February 25, 2026 08:28
Insert Firebase inside website using Chrome Extension with Manifest V3. Web Version 9 CDN modular Firebase Firestore local JS.
@cheadrian
cheadrian / !README.md
Last active November 13, 2025 01:31
AliExpress Merge Boss Bot - OpenCV, UiAutomator2

AliExpress Merge Boss Bot

Overview

This repository contains a Python script for an automation bot designed to interact with the Merge Boss game. The bot uses the uiautomator2 library and requires specific dependencies to be installed.

To run this I recommend you first to make it running on PC in order to modify the position parameters, but if you have an display with similar resolution 1080 x 2400 or aspect ratio it should work by default, so you can setup directly using Termux on your Android device.

Check this article to see demo gifs and images.

@cheadrian
cheadrian / !Readme.md
Last active April 27, 2025 21:07
Hardware PWM FAN control for Raspberry Pi

This is using https://pypi.org/project/rpi-hardware-pwm/ Python library in order to generate an PWM signal using integrated Raspberry Pi hardware PWM driver to control the fan speed.

⚠️ If you are using Raspberry Pi 5, set RPI_5 to True!

sudo pip3 install rpi-hardware-pwm

Make sure you connect the control port of the fan to the pin 12. You can also use pin 35, but change PWM_CHANNEL to 1.

Inside the /boot/config.txt you should have set dtoverlay=pwm-2chan

@cheadrian
cheadrian / Youtube_Livestream_Parts_download.py
Last active August 13, 2024 16:03
Download Youtube Live streamed video from the start or selected time
#With the help of this script you can download parts from the Youtube Video that is live streamed, from start of the stream till the end
import urllib.request
import os
#E.G: "https://r4---sn-gqn-p5ns.googlevideo.com/videoplayback?expire=1603041842& ..... 2.20201016.02.00&sq="
#The sound link should contain: &mime=audio in it.
#Here's an example from NASA LIVE:
#VIDEO: https://r5---sn-gqn-p5ns.googlevideo.com/videoplayback?expire=1603165657&ei=eQmOX8TeFtS07gO1xLWwDA&ip=79.115.11.159&id=DDU-rZs-Ic4.1&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160&source=yt_live_broadcast&requiressl=yes&mh=PU&mm=44%2C29&mn=sn-gqn-p5ns%2Csn-c0q7lnsl&ms=lva%2Crdu&mv=m&mvi=5&pl=20&initcwndbps=1350000&vprv=1&live=1&hang=1&noclen=1&mime=video%2Fmp4&gir=yes&mt=1603143920&fvip=5&keepalive=yes&fexp=23915654&c=WEB&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Clive%2Chang%2Cnoclen%2Cmime%2Cgir&sig=AOq0QJ8wRQIgQMnxy1Yk3HLTpqbOGmjZYH1CXCTNx6u6PgngAVGi4EQCIQDWyaye-u_KGyVQ0HRUsyKVaAzyXbmzDqOGVGpIyP7VtA%3D%3D&lspa
@cheadrian
cheadrian / !Huawei Ads and Tracking Blocking.md
Last active June 22, 2024 21:57
Adaway Huawei Blocklist for Ads, Tracking, Metrics, Gspace
@cheadrian
cheadrian / webhook_google_ads_form_functions.php
Last active January 18, 2024 10:33
Webhook for Google Ads Lead Form extension using WordPress and WP Webhooks plugin and send data to email
/*
* Forward data received by webhook from Google Ads Form Extension
* to selected email
* Details at:
* https://che-adrian.medium.com/create-a-webhook-for-google-ads-lead-form-extension-using-wordpress-and-wp-webhooks-plugin-and-cd2a3c7fb1c3
*/
add_filter( 'wpwhpro/run/actions/custom_action/return_args', 'wpwh_ads_email', 10, 3 );
function wpwh_ads_email( $return_args, $identifier, $response_body ){
//Email where you receive the data
$to = "example@example.com";
@cheadrian
cheadrian / CustomScrollView.js
Last active December 14, 2023 12:10
Custom scroll view indicator with Reanimated and Gesture
/*
* Check the Snack demo here:
* https://snack.expo.dev/@cheadrian/custom-scroll-view-indicator-with-reanimated-and-gesture
* Article with gif and features:
* https://che-adrian.medium.com/b78b238067b3?source=friends_link&sk=66df3163984fbcacbf9f7f4193b92e25
*/
import { useEffect, useRef, useState } from 'react';
import { View, StyleSheet } from 'react-native';
import { ScrollView } from 'react-native-gesture-handler';
@cheadrian
cheadrian / edge_detection_compare_adjust.py
Created December 10, 2023 22:10
Adaptive Threshold, Sobel, Morph Close comparison with Matplotlib sliders
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
def sobel_edge_detector(img, threshold=50):
grad_x = cv.Sobel(img, cv.CV_64F, 1, 0)
grad_y = cv.Sobel(img, cv.CV_64F, 0, 1)
grad = np.sqrt(grad_x**2 + grad_y**2)
grad_norm = (grad * 255 / grad.max()).astype(np.uint8)
@cheadrian
cheadrian / 1. Manifest V3 Firebase Chrome.md
Last active July 15, 2023 21:13
Insert Firebase functions inside website using Chrome Extension. Web Version 9 CDN modular Firebase Firestore.
import numpy as np
from collections import namedtuple, deque
from itertools import count
import random, datetime, os, copy, glob, math, time, asyncio, base64, shutil
import cv2
import gym, ray
from gym import Env, spaces
from gym.spaces import Box