vault backup: 2024-01-25 14:02:02
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
if [ $# -ne 1 ]; then
|
||||
echo You need to give just one argument
|
||||
elif [ -d "$1" ]; then
|
||||
echo Deleting directory \"$1\"
|
||||
mv "$1" ~/wastebasket/
|
||||
elif [ -f "$1" ]; then
|
||||
echo Deleting file \"$1\"
|
||||
mv "$1" ~/wastebasket/
|
||||
else
|
||||
echo \"$1\" does not exist
|
||||
fi
|
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
if [ $# -ne 1 ]; then
|
||||
echo You need to give just one argument
|
||||
elif [ -e ~/wastebasket/"$1" ]; then
|
||||
echo \"$1\" already exists in wastebasket, so I will not delete
|
||||
elif [ -d "$1" ]; then
|
||||
if [ $(ls -A "$1" | wc -l) -gt 0 ]; then
|
||||
echo Directory \"$1\" is not empty, so I will not delete
|
||||
else
|
||||
echo Deleting directory \"$1\"
|
||||
mv "$1" ~/wastebasket
|
||||
fi
|
||||
elif [ -f "$1" ]; then
|
||||
echo Deleting file \"$1\"
|
||||
mv "$1" ~/wastebasket
|
||||
else
|
||||
echo \"$1\" does not exist
|
||||
fi
|
BIN
Semester 2/Computer Systems Internals & Linux/Week 2/media.zip
Normal file
BIN
Semester 2/Computer Systems Internals & Linux/Week 2/media.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 3.3 MiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 MiB |
Binary file not shown.
After Width: | Height: | Size: 435 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.0 MiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 MiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
num=1;
|
||||
while [ $# -gt 0 ]; do
|
||||
echo argument $num is \"$1\".
|
||||
shift
|
||||
let num++
|
||||
done
|
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
cat ~/.bash_history | while read line; do
|
||||
if echo $line | grep -Eq "^(mkdir|cd)"; then
|
||||
dir=$(echo $line | sed -r 's/(mkdir|cd) +//')
|
||||
if [ -d "$dir" ]; then
|
||||
echo "YES: $dir"
|
||||
else
|
||||
echo "NO: $dir"
|
||||
fi
|
||||
fi
|
||||
done
|
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
file=1;
|
||||
for audio in media/*.mp3; do
|
||||
if [ $audio != "media/footsteps_forest_01.mp3" ]; then
|
||||
echo Processing $audio
|
||||
filename="00$file"
|
||||
filename=${filename:(-3)}
|
||||
sox $audio temp.wav silence 1 0 0
|
||||
sox media/footsteps_forest_01.mp3 temp.wav -C 128 $filename.mp3
|
||||
rm temp.wav
|
||||
let file=file+1
|
||||
fi
|
||||
done
|
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
date=$(date "+%a %d-%m-%Y %H:%M")
|
||||
for image in media/*.jpg; do
|
||||
filename=$(basename $image)
|
||||
if [ -e thumbs/$filename ]; then
|
||||
echo $filename has already been converted
|
||||
else
|
||||
echo Converting $filename
|
||||
convert $image -resize "640x480>" -rotate 90 -background magenta -pointsize 15 -gravity Center label:"$date" -append -rotate -90 thumbs/$filename
|
||||
fi
|
||||
done
|
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
dir=$(dirname "$1")
|
||||
file=$(basename "$1")
|
||||
if [ $# -ne 1 ]; then
|
||||
echo You need to give just one argument
|
||||
elif [ ! -e ~/wastebasket/"$file" ]; then
|
||||
echo \"$file\" does not exist in wastebasket
|
||||
elif [ -e "$1" ]; then
|
||||
echo \"$1\" already exists, so I will not undelete
|
||||
else
|
||||
echo Restoring \"$file\" to \"$dir\"
|
||||
if [ ! -d "$dir" ]; then
|
||||
mkdir "$dir"
|
||||
fi
|
||||
mv ~/wastebasket/"$file" "$dir"
|
||||
fi
|
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
for video in media/*.mp4 media/*.mov; do
|
||||
if [ ! -e $video ]; then
|
||||
echo No videos to convert
|
||||
exit 1
|
||||
fi
|
||||
echo Processing $video
|
||||
dir=$(dirname "$video")
|
||||
file=$(basename "$video" .mp4)
|
||||
file=$(basename "$file" .mov)
|
||||
avconv -i $video -s 80x50 $dir/$file.mpg
|
||||
|
||||
mv $video $video.backup
|
||||
done
|
Reference in New Issue
Block a user