Skip to content

Instantly share code, notes, and snippets.

@pedrokoblitz
Created October 22, 2013 17:44
Show Gist options
  • Save pedrokoblitz/7104872 to your computer and use it in GitHub Desktop.
Save pedrokoblitz/7104872 to your computer and use it in GitHub Desktop.
# 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";
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;
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
# do continuous screenshots every 2 seconds
while true; do
scrot -d 2 ~/screenshots/screenshot-%M-%S.png
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;
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
# 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
# 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
# eject DVD
eject -r
# kill skype process
kill `ps -e | grep skype | cut -d" " -f1`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment