• bash lame convertor

     

    #!/bin/sh
    # name of this script: wav2mp3.sh
    # wav to mp3
    
    for i in *.wav; do
     if [ -e "$i" ]; then
       file=`basename "$i" .wav`
       lame -h -b 192 "$i" "$file.mp3"
     fi
    done

     


  • Python sshfs pieslēgšanās ar paroli

    #!/usr/bin/python
    import pexpect
    import time

    command = "sshfs username@server:/path/to/home/folder /mount/point/"

    def start_sshfs():
    try:
    sshfs = pexpect.spawn(command)
    sshfs.expect("Password: ")
    time.sleep (0.1)
    sshfs.sendline ("YourPassword")
    time.sleep (10)
    sshfs.expect (pexpect.EOF)

    except Exception, e:
    print str(e)

    def main ():
    start_sshfs()

    if __name__ == '__main__':
    main ()


  • Aizvieto tekstu failos kas atrodas vienā direktorijā

    #!/bin/bash
    FILES=/home/john/something/*
    for f in $FILES
    do
    replaceit --input=$f "ko" "ar_ko"
    done

    * nepieciešams uzinstalēt replaceit pakotni


  • Skripts kas failus saspiež un noliek uz FTP servera

    #!/bin/bash
    USERNAME="lietotajvards"
    PASSWORD="parole"
    SERVER="mansserveris.lv"
    MYFILES="/home/user/myfiles"
    ARH="/home/user/temp"
    DOW=$(date +"%A")
    tar cpPzf $ARH/myfiles.tgz $MYFILES
    echo "myfiles ok"
    lftp -u $USERNAME,$PASSWORD -e "cd /$DOW; mput $ARH/*; quit" $SERVER
    rm $ARH/*

    * nepieciešams uzinstalēt lftp pakotni