This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| STDIN=$(</dev/stdin) | |
| echo "Sendmail invoked at $(date)" >>/var/log/sendmail.log | |
| echo "Params: ${@}" >>/var/log/sendmail.log | |
| echo -e "---\n${STDIN}\n---\n" >>/var/log/sendmail.log | |
| echo "${STDIN}" | /usr/sbin/sendmail.real ${@} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| import asyncio | |
| import os | |
| import signal | |
| class Server(): | |
| def __init__(self, socket_path): | |
| self.jobs = {} | |
| self.socket_path = socket_path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| def install_package(package): | |
| percent = 0 | |
| # Alpine apk provides machine-readable progress in bytes_downloaded/bytes_total format output to file descriptor of choice, so create a pipe for it | |
| pipe_rfd, pipe_wfd = os.pipe() | |
| with os.fdopen(pipe_rfd) as pipe_rf: | |
| with subprocess.Popen(['apk', '--progress-fd', str(pipe_wfd), '--no-cache', 'add', package], pass_fds=[pipe_wfd]) as p: | |
| # Close write pipe for vmmgr to not block the pipe once apk finishes | |
| os.close(pipe_wfd) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import sys | |
| import time | |
| ### Configuration changes here ### | |
| BACKUP_DIR = "/tmp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ipset -F cz.zone | |
| ipset -N cz.zone nethash | |
| for IP in $(wget -O - http://www.ipdeny.com/ipblocks/data/countries/cz.zone) | |
| do ipset -A cz.zone $IP | |
| echo $IP | |
| done | |
| iptables -A INPUT -m set --match-set cz.zone src -p tcp --dport 80 -j ACCEPT | |
| iptables -A INPUT -p tcp --dport 80 -j DROP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| youtube-dl --download-archive "archive.log" -i \ | |
| --add-metadata --all-subs --embed-subs --embed-thumbnail \ | |
| --match-filter "playlist_title != 'Liked videos' & playlist_title != 'Favorites'" \ | |
| -f "(bestvideo[vcodec^=av01][height>=1080][fps>30]/bestvideo[vcodec=vp9.2][height>=1080][fps>30]/bestvideo[vcodec=vp9][height>=1080][fps>30]/bestvideo[vcodec^=av01][height>=1080]/bestvideo[vcodec=vp9.2][height>=1080]/bestvideo[vcodec=vp9][height>=1080]/bestvideo[height>=1080]/bestvideo[vcodec^=av01][height>=720][fps>30]/bestvideo[vcodec=vp9.2][height>=720][fps>30]/bestvideo[vcodec=vp9][height>=720][fps>30]/bestvideo[vcodec^=av01][height>=720]/bestvideo[vcodec=vp9.2][height>=720]/bestvideo[vcodec=vp9][height>=720]/bestvideo[height>=720]/bestvideo)+(bestaudio[acodec=opus]/bestaudio)/best" \ | |
| --merge-output-format mkv \ | |
| -o "%cd%/%%(playlist_uploader)s/%%(playlist)s/%%(playlist_index)s - %%(title)s - %%(id)s.%%(ext)s" \ | |
| "[URL HERE TO CHANNELS PLAYLISTS]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find . -type f -exec ls --full-time {} + | sort -k 6,7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mysql -NB information_schema -e "SELECT table_name FROM tables WHERE table_schema = 'yourdb' AND table_name like 'yourprefix_%'" | xargs -n 1 -I"{}" mysql dbname -e "DROP TABLE {}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IFACE=$(ip route get 1 | head -1 | awk '{print $5}') | |
| echo "net.ipv6.conf.${IFACE}.disable_ipv6 = 1" >/etc/sysctl.d/60-disable-ipv6.conf | |
| systemctl restart procps | |
| echo "Disabled IPv6 on ${IFACE}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import errno | |
| import os | |
| import subprocess | |
| import sys | |
| # Run command and immediately print output as it is generated | |
| def passthru(cmd): | |
| # Create stdout and stderr pseudoterminal pairs | |
| stdout_master, stdout_slave = os.openpty() | |
| stderr_master, stderr_slave = os.openpty() |