This file contains 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/env bash | |
source="/home/user/source" | |
target="/home/user/target" | |
find "$source" -type f -name "*.mkv" -print0 | while read -d $'\0' f; do | |
name=$(basename "$f" .mkv) | |
echo "$name" | |
ss=$(ffprobe -i "$f" 2>&1 | grep "Chapter #0:1" | grep -Eo "[0-9.]+" | head -3 | tail +3) |
This file contains 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 | |
videoPageUrl=$1 # first argument must has page url | |
# request html page with gzip encoding only! coz it can be Brotli encoding | |
html=$(curl \ | |
-H "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \ | |
-H "accept-encoding: gzip" \ | |
-H "accept-language: en-US,en;q=0.9,ru;q=0.8" \ | |
-H "cache-control: max-age=0" \ |
This file contains 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 | |
getUid() { | |
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1 | |
} | |
. "$HOME/.bashrc" | |
if [ -z "$NVM_DIR" ]; then | |
if [ -d "$HOME/.nvm" ] && [ -f "$HOME/.nvm/nvm.sh" ]; then |
This file contains 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
ASC | DESC | |
1 | 3 | |
2 | 2 | |
3 | 1 |
This file contains 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 | |
# Flush the file system buffer | |
sync | |
# Clear PageCache, dentries and inodes | |
echo 3 > /proc/sys/vm/drop_caches | |
# Restart swap | |
swapoff -av && swapon -av |
This file contains 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
# @see https://serverfault.com/questions/129503/save-remote-ssl-certificate-via-linux-command-line | |
sudo bash -c "openssl s_client -servername remote.server.net -connect remote.server.net:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /usr/local/share/ca-certificates/my-cert.crt" | |
# @see https://thomas-leister.de/en/how-to-import-ca-root-certificate/ | |
sudo update-ca-certificates |
This file contains 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
// еле вспомнил, так что положу тут, что бы не забыть! | |
1e8.toString().replace(/(\d{1,3})(?=(\d{3})+$)/g, '$1 '); // "100 000 000" |
This file contains 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 | |
### | |
# Save as /etc/bash_completion.d/mem.complete.sh | |
## | |
_complete_mem() { | |
commands=`ps --no-headers -e -o command | grep -Eo "^[a-zA-Z0-9_\.\-\/]+" | { while read line; do basename $line; done; } | sort -u` | |
current="${COMP_WORDS[COMP_CWORD]}" | |
COMPREPLY=( $(compgen -W "${commands}" "${current}") ) |
This file contains 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/env node | |
function sub(a, b) { | |
let prefix = '0'.repeat(Math.abs(a.length - b.length)); | |
let flip = false; | |
if (prefix.length) { | |
if (a.length > b.length) { | |
b = `${prefix}${b}`; | |
} else if (b.length > a.length) { |
This file contains 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/env bash | |
command_timeout=$1 | |
command_line=$2 | |
command_next=$3 | |
timeout="${command_timeout}" | |
logname="/tmp/run.$(date +%Y%m%d%H%M%S).log" | |
function hasNext { |
NewerOlder