- List Formats:
youtube-dl --list-formats <URL>
- Download video with english subtitles, and embed them, using best formats available
youtube-dl --no-playlist --format best --sub-lang en --sub-format best --write-sub --embed-subs <URL>
#!/bin/bash | |
for i in $(sed -r 's@^http[s]?://([[:alnum:].]+)[/]?$@\1@' $1); do | |
echo "=== $i ===" | |
echo $i | egrep -q "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | |
if [ $? -eq 0 ]; then | |
echo $i | |
else | |
host -t A $i | grep address | awk '{print $4}'| sort | |
fi | |
done |
youtube-dl --list-formats <URL>
youtube-dl --no-playlist --format best --sub-lang en --sub-format best --write-sub --embed-subs <URL>
#!/bin/bash | |
n=$1 | |
j=0 | |
pages="" | |
for i in $(seq 1 $(( n / 2))); do | |
if [ $((i%2)) -ne 0 ]; then | |
if [[ $pages != '' ]]; then | |
pages=$pages',' | |
fi | |
pages=$pages$(( n - j ))','$i |
docker run --name debian9 --hostname debian9 -d debian:9 /bin/bash -c "trap : TERM INT; sleep infinity & wait" |
#!/bin/bash | |
# Enable Extended Globbing | |
shopt -s extglob | |
# Simple version | |
rm !(a|b|c) | |
# Scriptable version | |
function join_by { |
#!/usr/bin/env python3 | |
"""Percentage output.""" | |
count = 0 | |
items_nb = 500000 | |
while True: | |
# You can replace .0f by .2f to output decimals | |
print(f'{count * 100 / items_nb:.0f}%', end='\r') | |
count += 1 |
#!/usr/bin/env python3 | |
"""Display a progressbar.""" | |
import sys | |
import time | |
def progressbar( | |
progress: int, total: int, | |
percentage: bool = True, bar_width: int = 40, | |
todo: str = ' ', done: str = '=', |
#!/usr/bin/python3 | |
import random | |
people = [ | |
"Foo", | |
"Bar", | |
"Baz", | |
"Qux", | |
"Quux", | |
"Corge", |
Here is a work around to automate OCSP stapling on Opnsense with HAproxy plugin.
Hope it helps :)
I created a script based on acme.sh's haproxy deploy hook.
As /tmp
is emptied on reboot you need to regenerate ocsp files on startup so I put the script as a startup script: /usr/local/etc/rc.syshook.d/start/99-ocsp
(symoblic links in rc.syshook.d don't work).
#!/bin/sh