gulli
useful linux
resurrection

 #############################################################################
 #
 # WINDOWS/DOS 2 UNIX encoding
 #
 #############################################################################

 convmv [--notest] -f cp1252 -t utf8 $FILES


 #############################################################################
 #
 # SED pattern replacement
 #
 #############################################################################

 find . -type f -exec sed -i "s/www\.wyz\.domain/aaa\.bbb\.ccc\.domain/g" '{}' \;
 sed -i 's/$search_text/$replace_text/g' $filename


 #############################################################################
 #
 # Crypto
 #
 #############################################################################

 #
 # SSL Fingerabdruck holen
 #
 openssl s_client -connect $SERVER:$PORT -showcerts | openssl x509 -fingerprint -noout -md5


 #############################################################################
 #
 # SSH
 #
 #############################################################################

 socks:   ssh -p PORT -C2qTnN -D 8080 user@server
 privoxy: ssh -p PORT -L 8118:127.0.0.1:8118 user@server
 ssh-copy-id -i ~/.ssh/id_rsa.pub user@server
 sshfs -p PORT name@server:/REMOTEPATH LOCAL_MOUNTPOINT

 #----------------------------------------------------------------------------
 # server key changed
 #
 ssh-keygen -f "$HOME/.ssh/known_hosts" -R SERVERNAME


 #############################################################################
 #
 # MAIL / EXIM
 #
 #############################################################################
 #
 #
 #

 swaks -f sender@sender.dom -t recipient@recipient.dom -a PLAIN -au senderauth -s mailserver -tlsc --body -
 X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
 ^D

 #----------------------------------------------------------------------------
 # check/reset exims retry database
 #

 exim_dumpdb /var/spool/exim4/ retry
 exinext mx.testdomain.net

 #----------------------------------------------------------------------------
 # delete the entry
 #

 exim_fixdb /var/spool/exim4/ retry    [> d [ENTER], > q [ENTER]]

 #----------------------------------------------------------------------------
 # reset the retry db regularly
 #

 exim_tidydb -t 7d /var/spool/exim4/ retry

 #----------------------------------------------------------------------------
 #!/bin/bash

 BLUE_START='\n\E[37;44m'
 BLUE_STOP="tput sgr0"
 BOLD_START="\033[1m"
 BOLD_STOP="\033[0m"
 NONE=`tput sgr0`

 usage () {
    echo -e "\n\t"
    echo -e "${BLUE_START}${BOLD_START}Usage:\t$0 FAILED_RECIPIENT NEW_RECIPIENT${BOLD_STOP}\n"
    echo -e "\tWhat it will do:\n"
    echo -e "\t\t1. show() all mails in exim's queue,"
    echo -e "\t\t   which could not send to FAILED_RECIPIENT\n"
    echo -e "\t\t2. add() NEW_RECIPIENT to this mails\n"
    echo -e "\t\t3. deliver() this mails to NEW_RECIPIENT\n"
    echo -e "\t\t4. remove() this mails from exim's queue\n"
 }

 if [ $# != 2 ]
    then
        usage
        exit 0
 fi

 FAILED_RECIPIENT=$1
 NEW_RECIPIENT=$2
 STUCKED_MAILS=( `mailq | grep -B 1 $FAILED_RECIPIENT  | awk '{printf "%s\n",$3}' | egrep -v ^$` );

 show (){
    COUNTER=1
    echo -e "${BLUE_START}${BOLD_START}==============================================================="
    echo -e "undeliverable mails for: $FAILED_RECIPIENT      "
    echo -e "===============================================================${BOLD_STOP}\n"
    echo -e "$BLUE_STOP"

    if [ ${#STUCKED_MAILS[@]} -eq 0 ]
        then
            echo -e "no undeliverable mails found for: $FAILED_RECIPIENT\n"
            exit 0
    else
        for FOUND in "${STUCKED_MAILS[@]}";
            do
                echo -e "$COUNTER:\t$FOUND"
                (( COUNTER++ ))
            done
    fi
 }

 add(){
    COUNTER=1
    echo -e "${BLUE_START}${BOLD_START}==============================================================="
    echo -e "add new recipient to mails: $NEW_RECIPIENT      "
    echo -e "===============================================================$BOLD_STOP\n"
    tput sgr0

    for FOUND in "${STUCKED_MAILS[@]}";
        do
            echo -e "$COUNTER:\texim -Mar $FOUND $NEW_RECIPIENT"
            exim -Mar $FOUND $NEW_RECIPIENT
            (( COUNTER++ ))
        done
 }

 deliver(){
    COUNTER=1
    echo -e "${BLUE_START}${BOLD_START}==============================================================="
    echo -e "deliver mails to newly added recipient: $NEW_RECIPIENT      "
    echo -e "===============================================================$BOLD_STOP\n"
    tput sgr0

    for FOUND in "${STUCKED_MAILS[@]}";
        do
            echo -e "$COUNTER:\texim -Mc $FOUND"
            exim -Mc $FOUND
            #echo -e "$COUNTER:\texim -R $FOUND"
            #exim -R
            (( COUNTER++ ))
        done
 }

 remove(){
    COUNTER=1
    echo -e "${BLUE_START}${BOLD_START}==============================================================="
    echo -e "remove undeliverable mails to: $FAILED_RECIPIENT      "
    echo -e "===============================================================$BOLD_STOP\n"
    tput sgr0

    for FOUND in "${STUCKED_MAILS[@]}";
        do
            echo -e "$COUNTER:\texim -Mrm $FOUND"
            exim -Mrm $FOUND
            (( COUNTER++ ))
        done
}

 show
 add
 deliver
 #remove

 echo -e "\n"
 exit 0


 #############################################################################
 #
 # SQL
 #
 #############################################################################

 #
 # convert character set
 #
 mysqldump  -uroot -p -A --add-drop-database --add-drop-table  --events --all-databases --default-character-set=utf8 --single-transaction > dump.sql
 cat dump.sql | sed 's/SET NAMES latin1/SET NAMES utf8/g' > tmp_dump.sql
 cat tmp_dump.sql < dump.sql
 rm -f tmp_dump.sql
 cat dump.sql | sed 's/CHARSET=latin1/CHARSET=utf8/g' > tmp_dump.sql
 cat tmp_dump.sql > dump.sql
 rm -f tmp_dump.sql
 iconv -f LATIN1 -t UTF-8 dump.sql
 mysql -uroot -p < dump.sql

 #----------------------------------------------------------------------------
 # restore one database from dump all
 #
 mysql -uroot -p --one-database destdbname < alldatabases.sql

 #----------------------------------------------------------------------------
 # change table prefix
 #
 SELECT
    CONCAT(
        'DROP TABLE ',GROUP_CONCAT(CONCAT(table_schema,'.',table_name)),';'
    )
 FROM information_schema.tables
 WHERE table_schema=database() AND table_name like '%PREFIX_OLD%';
 SET group_concat_max_len = 524288;
 SELECT
    CONCAT(
        'RENAME TABLE ', GROUP_CONCAT('`', TABLE_SCHEMA, '`.`', TABLE_NAME, '` TO `', TABLE_SCHEMA, '`.`PREFIX_NEW_', TABLE_NAME, '`')
    ) AS q
 FROM `information_schema`.`Tables` WHERE TABLE_SCHEMA='PREFIX_OLD_';

 #----------------------------------------------------------------------------
 # reset root passwd
 #
 /etc/init.d/mysql stop || skill -9 mysqld
 mysqld --skip-grant-tables  --skip-networking
 mysql -uroot

 UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
 FLUSH PRIVILEGES;
 exit

 /etc/init.d/mysql restart


 #############################################################################
 #
 # IMAGE MANIPULATION
 #
 #############################################################################
 #
 # resize images (recursive)
 #
 find . -type f -name '*.JPG' -exec mogrify -resize 2160 {} \;

 #----------------------------------------------------------------------------
 # canon image conversion, CR2 to jpg or whatever image format
 #
 for i in *.CR2;
    do newname=$(echo $(basename "$i" ".CR2").jpg);
    dcraw -c -w -W -v -h "$i" | cjpeg -quality 95 -optimize -progressive > "$newname";
    exiftool -overwrite_original -tagsFromFile "$i" "$newname";
 done


 #############################################################################
 #
 # AUDIO MANIPULATION
 #
 #############################################################################
 #
 # convert mediatype to mediatype (recursive)
 #
 nice -+19 find . -type f -name *.wma -exec bash -c "if [ ! -f \"{}.mp3\" ]; then ffmpeg -i \"{}\" -vn -aq 1 -ar 44100 -acodec libmp3lame \"{}.mp3\" ; fi" \;


 #############################################################################
 #
 # VIDEO MANIPULATION
 #
 #############################################################################
 #
 # ffmpeg
 #
 ffmpeg -report -i input.mkv -threads 16 -r 23.98 \
        -vf "subtitles=input-forced.srt" \
        -vcodec libx264 -vf "crop=960:1040:1920:0,scale=1024:576,setsar=1:1,setdar=24:13" -sameq \
        -af "volume=10dB" -acodec copy \
        -map 0:0 -map 0:1 \
        output.mkv

 #############################################################################
 #
 # NETWORK
 #
 #############################################################################

 ifconfig wlan0 down
 iwconfig wlan0 mode Monitor
 macchanger -r wlan0
 ifconfig wlan0 up
 iwconfig

 #----------------------------------------------------------------------------
            
Address :  54.226.227.175 : 55436
Security : 
Method :  GET
Query : 
Status :  200
UserAgent :  CCBot/2.0 (http://commoncrawl.org/faq/)
Accept :  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Language : 
Encoding :  x-gzip, gzip, deflate
DoNotTrack : 
Connection :  close
Time :  2017-12-13 06:55:38