#!/bin/bash [ "${alias_dir}" = "" ] && alias_dir=$(pwd) source "${alias_dir}/common" alias ${prefix}archive_each_file_into_separate_archive="find . -mindepth 1 -maxdepth 1 -type f -exec tar -cvzf 'out/{}.tgz' '{}' \;" unicode_U200B_correct () { [ $1 == '' ] && printf "Корректировка ошибки в latex U200B\nУкажите входной файл" && return perl -CSD -pe "s/\N{U+200B}//gu" < $1 > noU200B_$1 } mkalias_with_prefix 'unicode_U200B_correct' festival_txt2mp3 () { [ $1 == '' ] && printf "Озвучивание текста\nУкажите входной текстовый файл. Выходной будет с тем же именем, но mp3\n" && return in_file=$1 out_wav_file_name="$1.wav" out_mp3_file_name="$1.mp3" cat "$1" | sed 's/[^a-zA-ZА-Яа-я0-9., ]//g' | text2wave -o "$out_wav_file_name" lame "$out_wav_file_name" "$out_mp3_file_name" rm "$out_wav_file_name" } mkalias_with_prefix 'festival_txt2mp3' alias ${prefix}gen_password='pwgen -n 16' rand_string() { tr -dc A-Za-z0-9 < /dev/urandom | dd bs=${RANDOM:1:2} count=1 2>/dev/null } mkalias_with_prefix 'rand_string' check_internet_script() { host="ya.ru" while true; do result=$(ping -c 3 $host | tail -2 | head -1 | awk '{print $4}') if [ $result -eq 0 ]; then echo "Нет интернета" break fi sleep 180 done } mkalias_with_prefix 'check_internet_script' sensors_one_line() { sens=$(sensors | grep -E 'power1|temp1|Core 0|fan|Package' | grep -o -E ":\s*([\+0-9\.°]+)" | sed 's/\([0-9]*\)[\.][0-9]*/\1/g') && sens=${sens// /} && sens=${sens//:/} && echo ${sens} } mkalias_with_prefix 'sensors_one_line' reload_bashrc() { source ~/.bashrc } mkalias_with_prefix 'reload_bashrc' check_seconds() { sec=$(date +%s) && if [[ "${sec: -2}" == "00" ]]; then echo "check"; fi; echo ${sec: -2} } mkalias_with_prefix 'check_seconds' cpu_frequency_set() { freq=$1 [ "$freq" = '' ] && printf "Укажите частоту, например 1.5g\n" && return sudo cpupower frequency-set --max ${freq} } mkalias_with_prefix 'cpu_frequency_set' cpu_frequency_get() { cpupower frequency-info } mkalias_with_prefix 'cpu_frequency_get'