Skip to content

Instantly share code, notes, and snippets.

@pedrokoblitz
Created October 22, 2013 17:44

Revisions

  1. @SuzanaK SuzanaK revised this gist Aug 27, 2013. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions Linux Bash Snippets
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,9 @@
    # recursively replace text in all files with a certain file ending

    find . -type f -iname '*.html' -exec sed -i 's,href="../css/stylesheet.css",href="../../css/stylesheet.css",g' {} +



    # download Springer Link Books via University Proxy and add the ".pdf" file ending

    export http_proxy="http://proxy.zfn.uni-bremen.de:3128";
  2. @SuzanaK SuzanaK revised this gist Mar 26, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Linux Bash Snippets
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ done
    # do continuous screenshots every 2 seconds

    while true; do
    scrot -d 2 ~/screenshots/stargate-%M-%S.png
    scrot -d 2 ~/screenshots/screenshot-%M-%S.png

    done

  3. @SuzanaK SuzanaK revised this gist Mar 26, 2013. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions Linux Bash Snippets
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,15 @@ for i in *.jpg;
    do convert "$i" -resize 1024x "small/$i" ;
    done


    # do continuous screenshots every 2 seconds

    while true; do
    scrot -d 2 ~/screenshots/stargate-%M-%S.png

    done


    # autorotate all jpeg files in a directory according to EXIF information
    jhead -autorot *.jpg

  4. @SuzanaK SuzanaK revised this gist Mar 22, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Linux Bash Snippets
    Original file line number Diff line number Diff line change
    @@ -60,5 +60,8 @@ lsb_release -d
    # eject DVD
    eject -r

    # kill skype process
    kill `ps -e | grep skype | cut -d" " -f1`



  5. @SuzanaK SuzanaK revised this gist Jan 13, 2013. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion Linux Bash Snippets
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # download Springer Link Books via University Proxy and add the ".pdf" file ending

    export http_proxy="http://proxy.zfn.uni-bremen.de:3128";
    wget -r -l 1 --proxy-user STUD_IP_USERNAME --proxy-passwd STUD_IP_PASSWORD LINK_TO_BOOK;
    wget -r -l 1 --reject html,js,css,jpg,png --proxy-user STUD_IP_USERNAME --proxy-passwd STUD_IP_PASSWORD LINK_TO_BOOK;
    for i in link.springer.com/content/pdf/*;
    do j=`echo $i | cut -f 1`; j=$j".pdf";
    mv $i $j;
    @@ -57,5 +57,8 @@ ffmpeg -i film.mp4 -vn audio.wav
    # show Ubuntu version
    lsb_release -d

    # eject DVD
    eject -r



  6. @SuzanaK SuzanaK revised this gist Jan 11, 2013. 1 changed file with 19 additions and 1 deletion.
    20 changes: 19 additions & 1 deletion Linux Bash Snippets
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,9 @@ for i in *.jpg;
    do convert "$i" -resize 1024x "small/$i" ;
    done

    # autorotate all jpeg files in a directory according to EXIF information
    jhead -autorot *.jpg

    # do a full text search in all pdf files of a directory

    mkdir findings;
    @@ -40,4 +43,19 @@ COMMAND | at now + 1 min
    sudo fdisk -l
    # unmount and mount again in case of error message
    sudo mount -o rw /dev/sda7/ /mnt/sda7
    sudo chroot /mnt/sda7
    sudo chroot /mnt/sda7

    # convert all .mov files into .avi files
    for i in *.mov; do ffmpeg -i $i.MOV -ar 44100 $i.avi; done

    # convert .csv file to LateX table
    cat example.csv | sed "s/;/\t\&\t/g"|sed 's/$/\t\\\\/g' > example.tex

    # extract audio from movie
    ffmpeg -i film.mp4 -vn audio.wav

    # show Ubuntu version
    lsb_release -d



  7. @SuzanaK SuzanaK revised this gist Jan 11, 2013. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion Linux Bash Snippets
    Original file line number Diff line number Diff line change
    @@ -29,4 +29,15 @@ done
    mkdir img;
    for i in *.pdf;
    do pdfimages "$i" img/img_$i;
    done
    done

    # execute command one minute later
    COMMAND | at now + 1 min

    # enter system via live CD

    # view partitions
    sudo fdisk -l
    # unmount and mount again in case of error message
    sudo mount -o rw /dev/sda7/ /mnt/sda7
    sudo chroot /mnt/sda7
  8. @SuzanaK SuzanaK revised this gist Jan 11, 2013. 1 changed file with 14 additions and 1 deletion.
    15 changes: 14 additions & 1 deletion Linux Bash Snippets
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # download Springer Link Books via University Proxy
    # download Springer Link Books via University Proxy and add the ".pdf" file ending

    export http_proxy="http://proxy.zfn.uni-bremen.de:3128";
    wget -r -l 1 --proxy-user STUD_IP_USERNAME --proxy-passwd STUD_IP_PASSWORD LINK_TO_BOOK;
    @@ -16,4 +16,17 @@ rename 's/\[[0-9]+\]_//' *
    mkdir small_images;
    for i in *.jpg;
    do convert "$i" -resize 1024x "small/$i" ;
    done

    # do a full text search in all pdf files of a directory

    mkdir findings;
    for i in *.PDF;
    do pdftotext "$i" - | grep "KEYWORD" > findings/finding_in_$i.txt;
    done

    # extract images from all pdf files in a directory
    mkdir img;
    for i in *.pdf;
    do pdfimages "$i" img/img_$i;
    done
  9. @SuzanaK SuzanaK created this gist Jan 11, 2013.
    19 changes: 19 additions & 0 deletions Linux Bash Snippets
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # download Springer Link Books via University Proxy

    export http_proxy="http://proxy.zfn.uni-bremen.de:3128";
    wget -r -l 1 --proxy-user STUD_IP_USERNAME --proxy-passwd STUD_IP_PASSWORD LINK_TO_BOOK;
    for i in link.springer.com/content/pdf/*;
    do j=`echo $i | cut -f 1`; j=$j".pdf";
    mv $i $j;
    done

    # rename files downloaded from StudIP

    rename 's/\[[0-9]+\]_//' *

    # copy image files into a subdirectory and rescale them to a width of 1024

    mkdir small_images;
    for i in *.jpg;
    do convert "$i" -resize 1024x "small/$i" ;
    done