Skip to content

Instantly share code, notes, and snippets.

View ChronoMonochrome's full-sized avatar

Victor Shilin ChronoMonochrome

  • Russian Federation, Stavropol
View GitHub Profile
@ChronoMonochrome
ChronoMonochrome / wlan.cpp
Last active August 10, 2023 18:58
Wifi tethering on Windows
#include <Windows.h>
#include <wlanapi.h>
#include <iostream>
#pragma comment(lib, "wlanapi.lib")
typedef DWORD(WINAPI* P_WlanOpenHandle)(DWORD, PVOID, PDWORD, PHANDLE);
typedef DWORD(WINAPI* P_WlanCloseHandle)(HANDLE, PVOID);
typedef DWORD(WINAPI* P_WlanHostedNetworkStartUsing)(HANDLE, PWLAN_HOSTED_NETWORK_REASON, PVOID);
typedef DWORD(WINAPI* P_WlanHostedNetworkStopUsing)(HANDLE, PWLAN_HOSTED_NETWORK_REASON, PVOID);
@ChronoMonochrome
ChronoMonochrome / merge_frames.py
Created June 2, 2023 08:20
Image stitching with OpenCV
import cv2
from PIL import Image
import numpy as np
def cv2_estimate_dx_dy(prev_filename, curr_filename):
"""
Calculates dx and dy using OpenCV script for two consecutive frames
"""
# Load the previous and current frames
prev_frame = cv2.imread(prev_filename, cv2.IMREAD_GRAYSCALE)
@ChronoMonochrome
ChronoMonochrome / SSH port forwarding cheatsheet.md
Last active May 25, 2023 16:18
A quick reminder for myself how to expose a local machine using an intermediate server

Quick start

Forward port 22 on local machine as server:22222

ssh -R 22222:localhost:22 server_user@server -p PORT

Expose this port on the server to the world using socat *

socat TCP-LISTEN:22223,fork,bind=0.0.0.0 TCP:localhost:22222

Now you can connect to the local machine from outside of the local network

ssh local_user@server -p 22223

@ChronoMonochrome
ChronoMonochrome / video_ssim_search.py
Created May 1, 2023 10:29
A script to search frame in video using SSIM (structural similarity image comparison)
from time import time
import av
import cv2
import numpy as np
from PIL import Image
from SSIM_PIL import compare_ssim
# Load reference image and get its dimensions
ref_img = cv2.imread("preroll_end2_cropped.png")
ref_height, ref_width, _ = ref_img.shape
@ChronoMonochrome
ChronoMonochrome / binpatch.py
Created November 25, 2022 12:54
Patch Windows EXE (DLL) with python script
import os
import shutil
import subprocess
import tempfile
from pwnlib.log import getLogger
log = getLogger(__name__)
def _run(cmd, stdin = None):
@ChronoMonochrome
ChronoMonochrome / ayaya.py
Last active October 21, 2022 15:18
AYAYA
def gen_a(length_full=48):
i=0
a = []
a.append(" "*((length_full-i*4)//2)+" "*3 + ":AYAYA:")
for i in range(1, length_full//4//2):
a.append(" "*((length_full-i*4)//2) + ":AYAYA:" + " "*(i*4) + ":AYAYA:")
i+=1
a.append(" "*((length_full-i*4)//2) + ":AYAYA:"*(length_full//8))
i+=1
#print(i, i+6+1)
@ChronoMonochrome
ChronoMonochrome / gcc11.md
Last active July 18, 2022 09:37
Download GCC 11 from Ubuntu 22.10 repositories

Determine the list of deb packages

apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances \
  gcc-11 g++-11 | grep "^\w" | sort -u | xargs

(credits: How to list/download the recursive dependencies of a debian package?)

apt download binutils binutils-common binutils-x86-64-linux-gnu cdebconf cpp-11 debconf dpkg g++-11 gcc-11 \
gcc-11-base gcc-12-base libacl1 libasan6 libatomic1 libbinutils libbz2-1.0 libc-dev-bin libc6 libc6-dev libcc1-0 \
@ChronoMonochrome
ChronoMonochrome / Python39build.md
Last active April 23, 2025 11:34
Build script to cross compile Python 3.9 for Android

Setup environment

wget https://dl.google.com/android/repository/android-ndk-r23c-linux.zip
unzip android-ndk-r23c-linux.zip

export NDK=$(realpath android-ndk-r23c)
$NDK/build/tools/make_standalone_toolchain.py  --arch arm --api 21 --install-dir  $(realpath toolchain)

export PATH=$PATH:$(realpath toolchain/bin)
@ChronoMonochrome
ChronoMonochrome / arm64-cross-arch-dev.md
Last active June 8, 2022 14:23
Cross architecture (arm64) development cheat-sheet

Mount qemu qcow2 image

modprobe nbd max_part=8
qemu-nbd --connect=/dev/nbd0 bionic-server-cloudimg-arm64.img

Copy qemu-aarch64-static to the aarch64 filesystem and chroot

@ChronoMonochrome
ChronoMonochrome / timely_farm.py
Last active April 12, 2022 16:29
Flowers farm on discord with selenium
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.get("https://discord.com/login")
# login and manually navigate to https://discord.com/channels/x/y")