Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
for dev in $(cat /proc/acpi/wakeup | grep '*enabled' | cut -d' ' -f1); do
if [ "$dev" = "PWRB" ]; then
continue
fi
echo $dev > /proc/acpi/wakeup
done
exit 0
#!/bin/bash
path=https://example.webcam/streams/123/
file=${path}stream.m3u8
while true; do
for s in `curl -s $file | tr -d '\015' | grep -v '#'`; do
echo $s
curl -s "$path$s" > $s
done
@azazar
azazar / mklibvirtrootfs
Created August 24, 2022 12:00
mklibvirtrootfs.sh
#!/bin/bash
fail() {
echo "$@"
exit 1
}
test -z "$1" && fail Image name argument missing
CACHE_DIR="${HOME}/.cache/deb"
@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
}
@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];
// ==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 -
// ==UserScript==
// @name author.today качать с названием
// @namespace Azazar's Scripts
// @match https://author.today/work/*
// @grant GM_setClipboard
// @version 1.0
// @author -
// ==/UserScript==
let extMap = {
@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 / 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 / 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()