Skip to content

Instantly share code, notes, and snippets.

@azazar
azazar / .bashrc_ps1
Last active February 18, 2025 12:17
My bash prompt
# Set terminal title (optional)
PS1="\[\e]0;\u@\h: \w\a\]"
# Segment 1: Dark Gray background (100) with Light Yellow text (93)
PS1+=$'\[\e[100;93m\] \u@\h '
# Arrow from Segment 1 to Segment 2:
# Arrow's foreground is set to dark gray (90)
# Arrow's background is set to Light Blue (104)
PS1+=$'\[\e[90;104m\]\uE0B0'
@azazar
azazar / vnc_single_window
Created January 8, 2025 11:22
A script that provides remote access to a single window using VNC over LAN.
#!/usr/bin/env python3
"""
vnc_single_window_wx_xlib_dbus.py
A Python script that:
- Uses python3-xlib (Xlib) to list available windows (plus a "root" option).
- Displays a wxPython GUI (ListBox) of windows.
- On selection, we run x11vnc on that window (passwordless + accept popup).
- Publishes the chosen window name via Avahi (Zeroconf) using python3-dbus instead of avahi-publish-service.
@azazar
azazar / bitcoin_dump_privkeys.py
Last active May 19, 2025 07:11
Scans directories for Bitcoin wallet.dat files with private keys and dumps all identified keys
import re
import hashlib
import base58 # pip install base58
import os
import sys
def hash256(data):
"""Perform SHA-256 hash twice."""
return hashlib.sha256(hashlib.sha256(data).digest()).digest()
@azazar
azazar / manage_sshd.py
Created February 1, 2024 19:54
Start/stop SSHD in Termux when power and wifi are connected
#!/data/data/com.termux/files/usr/bin/python3
import json
import os
import subprocess
import time
import logging
import signal
# Configuration
@azazar
azazar / .bashrc
Last active January 20, 2024 07:57
Aliases that changes the current directory to the home directory of a specified user and then starts a new shell session as that user.
# For users with read-only or otherwise unusable HOME directory
alias www='sudo -u www-data /bin/bash -c "mkdir -p /tmp/$(id -n -u)-home && cd /tmp/$(id -n -u)-home && (test -e realhome || ln -s $(getent passwd www-data|cut -d':' -f6) realhome) && HOME=/tmp/$(id -n -u)-home exec /bin/bash -l"'
# For users with writable HOME
alias uuu='cd $(getent passwd www-data|cut -d':' -f6) && sudo -u www-data -s /bin/bash'
@azazar
azazar / ChatGPT Custom Instructions.txt
Last active September 18, 2023 12:23
ChatGPT Custom Instructions
## IMPLICIT REPLYING RULES. FOLLOW THOSE RULES IN YOUR RESPONSES UNLESS ASKED TO DO OTHERWISE!
Completeness: Avoid stubs, placeholders or incomplete answers. No "// ... existing code" comments!
Conciseness: Respond briefly and directly (unless it leads to breaking completeness rule).
Language: Answer in English, unless otherwise directed.
Code Escaping: Use "~~~" for code in "```" to escape "```".
Assistance: Ask user to perform actions on PC/Internet if necessary.
Code Standards: Construct code that is clear, modular, and adheres to the chosen style guide. Follow SOLID, KISS, DRY, and YAGNI principles. Make code testable, error-handling, efficient, optimized, and sanitize user input. Highlight security risks, use recognized design patterns.
Code Review: Analyze code for improvements or flaws, compute metrics like cyclomatic complexity, duplication, lines of code.
// ==UserScript==
// @name author.today качать с названием
// @namespace Azazar's Scripts
// @match https://author.today/work/*
// @grant GM_setClipboard
// @version 1.0
// @author -
// ==/UserScript==
let extMap = {
// ==UserScript==
// @name flibusta.is качать с названием
// @namespace Violentmonkey Scripts
// @match *://flibusta.is/a/*
// @match *://flibusta.is/s/*
// @match *://flibusta.is/sequence/*
// @grant GM_setClipboard
// @grant GM_download
// @version 1.4
// @author -
@azazar
azazar / compress_int_set.php
Last active February 11, 2023 14:46
Routines for compressed serialization and deserialization of integer sets
<?php
function compress_int_set($arr) {
if (count($arr) == 0) {
return '';
}
sort($arr);
$prev = $arr[0];
@azazar
azazar / reencode_audiobook.sh
Last active January 20, 2023 19:13
A script that encodes mp3 audiobook directory into a single audio file with lowest but usable quality using either mp3, opus or speex codec
#!/bin/bash
set -ex
# fail function to exit with error message
fail() {
echo "$@" 1>&2
exit 1
}